mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
rc: align the behaviour of IPv4 and IPv6 IP renewal
PR: https://github.com/opnsense/core/pull/1524
This commit is contained in:
parent
955e1fcaa6
commit
f729d881c7
@ -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");
|
||||
} else {
|
||||
$oldip = "0.0.0.0";
|
||||
}
|
||||
$oldip = @file_get_contents("/var/db/{$interface}_cacheip");
|
||||
|
||||
system_resolvconf_generate();
|
||||
|
||||
|
||||
@ -83,12 +83,12 @@ if (!empty($new_domain_name_servers)) {
|
||||
}
|
||||
|
||||
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");
|
||||
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 */
|
||||
@ -98,10 +98,7 @@ if (is_ipaddrv6($curwanipv6)) {
|
||||
|
||||
log_error("rc.newwanipv6: on (IP address: {$curwanipv6}) (interface: {$interface}) (real interface: {$interface_real}).");
|
||||
|
||||
$oldipv6 = "";
|
||||
if (file_exists("/var/db/{$interface}_cacheipv6")) {
|
||||
$oldipv6 = file_get_contents("/var/db/{$interface}_cacheipv6");
|
||||
}
|
||||
$oldipv6 = @file_get_contents("/var/db/{$interface}_cacheipv6");
|
||||
|
||||
$grouptmp = link_interface_to_group($interface);
|
||||
if (!empty($grouptmp)) {
|
||||
@ -110,30 +107,32 @@ if (!empty($grouptmp)) {
|
||||
|
||||
link_interface_to_track6($interface, "update");
|
||||
system_resolvconf_generate();
|
||||
system_routing_configure($interface);
|
||||
setup_gateways_monitor();
|
||||
|
||||
/* signal filter reload */
|
||||
filter_configure();
|
||||
/*
|
||||
* We need to force sync VPNs on such even when the IP is the same for dynamic interfaces.
|
||||
* Even with the same IP the VPN software is unhappy with the IP disappearing, and we
|
||||
* could be failing back in which case we need to switch IPs back anyhow.
|
||||
*/
|
||||
if (!is_ipaddr($oldipv6) || $curwanipv6 != $oldipv6 || !is_ipaddrv6($config['interfaces'][$interface]['ipaddrv6'])) {
|
||||
system_routing_configure($interface);
|
||||
setup_gateways_monitor();
|
||||
|
||||
if (is_ipaddrv6($oldipv6)) {
|
||||
if ($curwanipv6 == $oldipv6) {
|
||||
// Still need to sync VPNs on PPPoE and such, as even with the same IP the VPN software is unhappy with the IP disappearing.
|
||||
if (in_array($config['interfaces'][$interface]['ipaddrv6'], array('pppoe', 'pptp', 'ppp'))) {
|
||||
/* XXX migrate this: we should unify the reload */
|
||||
ipsec_configure_do(false, $inteface);
|
||||
openvpn_configure_do(false, $interface);
|
||||
if (is_ipaddrv6($oldipv6)) {
|
||||
if (does_interface_exist($interface_real)) {
|
||||
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 */
|
||||
plugins_configure('interface', false, array($interface));
|
||||
|
||||
/* reload graphing functions */
|
||||
rrd_configure();
|
||||
}
|
||||
|
||||
/* reload plugins */
|
||||
plugins_configure('interface', false, array($interface));
|
||||
|
||||
/* reload graphing functions */
|
||||
rrd_configure();
|
||||
/* reload filter, don't try to sync to carp slave */
|
||||
filter_configure_sync();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user