Commit f729d881 authored by Franco Fichtner's avatar Franco Fichtner

rc: align the behaviour of IPv4 and IPv6 IP renewal

PR: https://github.com/opnsense/core/pull/1524
parent 955e1fca
...@@ -94,11 +94,7 @@ if ($curwanip == "0.0.0.0" || !is_ipaddr($curwanip)) { ...@@ -94,11 +94,7 @@ if ($curwanip == "0.0.0.0" || !is_ipaddr($curwanip)) {
} }
} }
if (file_exists("/var/db/{$interface}_cacheip")) { $oldip = @file_get_contents("/var/db/{$interface}_cacheip");
$oldip = file_get_contents("/var/db/{$interface}_cacheip");
} else {
$oldip = "0.0.0.0";
}
system_resolvconf_generate(); system_resolvconf_generate();
......
...@@ -83,12 +83,12 @@ if (!empty($new_domain_name_servers)) { ...@@ -83,12 +83,12 @@ if (!empty($new_domain_name_servers)) {
} }
if (count($valid_ns) > 0) { if (count($valid_ns) > 0) {
file_put_contents("/var/etc/nameserver_v6{$interface}", implode("\n", $valid_ns)); @file_put_contents("/var/etc/nameserver_v6{$interface}", implode("\n", $valid_ns));
} }
} }
$new_domain_name = getenv("new_domain_name"); $new_domain_name = getenv("new_domain_name");
if (!empty($new_domain_name)) { if (!empty($new_domain_name)) {
file_put_contents("/var/etc/searchdomain_v6{$interface}", $new_domain_name); @file_put_contents("/var/etc/searchdomain_v6{$interface}", $new_domain_name);
} }
/* write current WAN IPv6 to file */ /* write current WAN IPv6 to file */
...@@ -98,10 +98,7 @@ if (is_ipaddrv6($curwanipv6)) { ...@@ -98,10 +98,7 @@ if (is_ipaddrv6($curwanipv6)) {
log_error("rc.newwanipv6: on (IP address: {$curwanipv6}) (interface: {$interface}) (real interface: {$interface_real})."); log_error("rc.newwanipv6: on (IP address: {$curwanipv6}) (interface: {$interface}) (real interface: {$interface_real}).");
$oldipv6 = ""; $oldipv6 = @file_get_contents("/var/db/{$interface}_cacheipv6");
if (file_exists("/var/db/{$interface}_cacheipv6")) {
$oldipv6 = file_get_contents("/var/db/{$interface}_cacheipv6");
}
$grouptmp = link_interface_to_group($interface); $grouptmp = link_interface_to_group($interface);
if (!empty($grouptmp)) { if (!empty($grouptmp)) {
...@@ -110,30 +107,32 @@ if (!empty($grouptmp)) { ...@@ -110,30 +107,32 @@ if (!empty($grouptmp)) {
link_interface_to_track6($interface, "update"); link_interface_to_track6($interface, "update");
system_resolvconf_generate(); system_resolvconf_generate();
system_routing_configure($interface);
setup_gateways_monitor(); /*
* We need to force sync VPNs on such even when the IP is the same for dynamic interfaces.
/* signal filter reload */ * Even with the same IP the VPN software is unhappy with the IP disappearing, and we
filter_configure(); * could be failing back in which case we need to switch IPs back anyhow.
*/
if (is_ipaddrv6($oldipv6)) { if (!is_ipaddr($oldipv6) || $curwanipv6 != $oldipv6 || !is_ipaddrv6($config['interfaces'][$interface]['ipaddrv6'])) {
if ($curwanipv6 == $oldipv6) { system_routing_configure($interface);
// Still need to sync VPNs on PPPoE and such, as even with the same IP the VPN software is unhappy with the IP disappearing. setup_gateways_monitor();
if (in_array($config['interfaces'][$interface]['ipaddrv6'], array('pppoe', 'pptp', 'ppp'))) {
/* XXX migrate this: we should unify the reload */ if (is_ipaddrv6($oldipv6)) {
ipsec_configure_do(false, $inteface); if (does_interface_exist($interface_real)) {
openvpn_configure_do(false, $interface); mwexec("/sbin/ifconfig {$interface_real} inet6 {$oldipv6} delete");
} }
return;
} elseif (does_interface_exist($interface_real)) {
mwexec("/sbin/ifconfig {$interface_real} inet6 {$oldipv6} delete");
} }
file_put_contents("/var/db/{$interface}_cacheipv6", $curwanipv6); if (is_ipaddrv6($curwanip)) {
} @file_put_contents("/var/db/{$interface}_cacheipv6", $curwanipv6);
}
/* reload plugins */ /* reload plugins */
plugins_configure('interface', false, array($interface)); plugins_configure('interface', false, array($interface));
/* reload graphing functions */
rrd_configure();
}
/* reload graphing functions */ /* reload filter, don't try to sync to carp slave */
rrd_configure(); filter_configure_sync();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment