Here's the patch to test.
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index 72f15c50e6171375c62890f0edf32b6eade6292b..b1efb81279388a832b569d8c0ffe432506322477 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -3766,6 +3766,8 @@ function kill_dhclient_process($interface) {
$i++;
}
unset($i);
+
+ unlink_if_exists(g_get('vardb_path') . "/{$interface}_cacheip");
}
function find_dhcp6c_process() {
@@ -4760,6 +4762,7 @@ function interface_dhcpv6_configure($ifconf, $ifcfg, $destroy = false) {
unlink_if_exists("{$g['varetc_path']}/dhcp6c_{$interface}_script.sh");
unlink_if_exists("{$g['varetc_path']}/dhcp6c_{$interface}_dhcp6withoutra_script.sh");
unlink_if_exists("{$g['varetc_path']}/rtsold_{$wanif}_script.sh");
+ unlink_if_exists(g_get('vardb_path') . "/{$wanif}_cacheipv6");
continue;
}
diff --git a/src/etc/rc.newwanip b/src/etc/rc.newwanip
index 6c0e5ca58aa1ac649a2fe157adc0857fe8979bbf..f0686333d0c05315ed3e761662115672658a19e2 100755
--- a/src/etc/rc.newwanip
+++ b/src/etc/rc.newwanip
@@ -108,8 +108,8 @@ if (empty($interface)) {
}
$oldip = "0.0.0.0";
-if (file_exists("{$g['vardb_path']}/{$interface}_cacheip")) {
- $oldip = file_get_contents("{$g['vardb_path']}/{$interface}_cacheip");
+if (file_exists(g_get('vardb_path') . "/{$interface_real}_cacheip")) {
+ $oldip = file_get_contents(g_get('vardb_path') . "/{$interface_real}_cacheip");
}
/* regenerate resolv.conf */
@@ -117,7 +117,7 @@ system_resolvconf_generate(true);
/* write the current interface IP to file */
if (is_ipaddr($curwanip)) {
- @file_put_contents("{$g['vardb_path']}/{$interface}_ip", $curwanip);
+ @file_put_contents(g_get('vardb_path') . "/{$interface_real}_ip", $curwanip);
}
link_interface_to_vips($interface, "update");
@@ -244,7 +244,7 @@ if (!is_ipaddr($oldip) || ($curwanip != $oldip) || file_exists("{$g['tmp_path']}
services_unbound_configure(true, $interface);
if (is_ipaddr($curwanip)) {
- @file_put_contents("{$g['vardb_path']}/{$interface}_cacheip", $curwanip);
+ @file_put_contents(g_get('vardb_path') . "/{$interface_real}_cacheip", $curwanip);
}
/* perform RFC 2136 DNS update */
diff --git a/src/etc/rc.newwanipv6 b/src/etc/rc.newwanipv6
index 3cf3805a048c360f72309b523dd302dff65aafb6..a3e61d7f7938d2f99dd43f2e588b20b27d06aad8 100755
--- a/src/etc/rc.newwanipv6
+++ b/src/etc/rc.newwanipv6
@@ -114,14 +114,14 @@ if (!empty($new_domain_name)) {
/* write current WAN IPv6 to file */
if (is_ipaddrv6($curwanipv6)) {
- @file_put_contents("{$g['vardb_path']}/{$interface}_ipv6", $curwanipv6);
+ @file_put_contents(g_get('vardb_path') . "/{$interface_real}_ipv6", $curwanipv6);
}
log_error("rc.newwanipv6: on (IP address: {$curwanipv6}) (interface: {$interface}) (real interface: {$interface_real}).");
$oldipv6 = '';
-if (file_exists("{$g['vardb_path']}/{$interface}_cacheipv6")) {
- $oldipv6 = file_get_contents("{$g['vardb_path']}/{$interface}_cacheipv6");
+if (file_exists(g_get('vardb_path') . "/{$interface_real}_cacheipv6")) {
+ $oldipv6 = file_get_contents(g_get('vardb_path') . "/{$interface_real}_cacheipv6");
}
$grouptmp = link_interface_to_group($interface);
@@ -163,7 +163,7 @@ if (empty($oldipv6) || is_ipaddrv6($oldipv6)) {
mwexec("/sbin/ifconfig {$interface_real} inet6 {$oldipv6} delete");
}
- file_put_contents("{$g['vardb_path']}/{$interface}_cacheipv6", $curwanipv6);
+ file_put_contents(g_get('vardb_path') . "/{$interface_real}_cacheipv6", $curwanipv6);
}
if ($srvupdate) {