From 07c304a5593e4fc7d574964bbf3641f92c16d8fa Mon Sep 17 00:00:00 2001 From: marjohn56 Date: Sat, 11 Mar 2017 09:59:44 +0000 Subject: WAN flap loss of IPv6 Some hardware is taking too long to set ACCEPT_RTADV on the Interface, this results in RTSOLD exiting and this not sending RS to start the process. Apart from adding a delay to the start of RTSOLD which did improve but not totally fix the issue the other change is to prevent the call to -ACCEPT_RTADV if the interface is using DHCP6. -ACCEPT_RTADV in the case of wancfg['dhcp6usev4iface'] || $wancfg['ipaddr']==='ppp' Cleaning up dhcp6c kill calls. ppp-ipv6 Changed to call kill_dhcp6client_process() to make sure the lock files are also cleared. Interfaces.php Changed to call kill_dhcp6client_process() to make sure the lock files are also cleared. --- src/etc/inc/interfaces.inc | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/etc/inc/interfaces.inc') diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 273b8ff..57f53fb 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -3095,6 +3095,14 @@ function kill_dhcp6client_process($interface, $force, $release = false) { unlink_if_exists("/tmp/dhcp6c_{$interface}_lock"); unlink_if_exists("{$g['varrun_path']}/dhcp6c_{$interface}.pid"); // just in case! } +function reset_dhcp6client_process($interface) { + + $pid = find_dhcp6c_process($interface); + + if($pid != 0) { + posix_kill($pid, SIGHUP); + } +} function run_dhcp6client_process($interface, $wancfg) { global $g; @@ -3292,8 +3300,10 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven if ($g['debug']) { log_error(sprintf(gettext("Deny router advertisements for interface %s"), $interface)); } - mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 -accept_rtadv", true); - + if (isset($wancfg['dhcp6usev4iface']) || $wancfg['ipaddr']==='ppp') + { + mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 -accept_rtadv", true); + } /* wireless configuration? */ if (is_array($wancfg['wireless'])) { interface_wireless_configure($realif, $wancfg, $wancfg['wireless']); @@ -4211,7 +4221,9 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { "-p {$g['varrun_path']}/dhcp6c_{$wanif}.pid {$wanif}\n"; $rtsoldscript .= "\t/usr/bin/logger -t rtsold \"Starting dhcp6 client for interface {$interface}({$wanif})\"\n"; $rtsoldscript .= "else\n"; - $rtsoldscript .= "\t/usr/bin/logger -t rtsold \"RTSOLD Lock in place\"\n"; + $rtsoldscript .= "\t/usr/bin/logger -t rtsold \"RTSOLD Lock in place - sending SIGHUP to dhcp6c\"\n"; + $rtsoldscript .= "\tdhcp6c_pid=\$(cat \"{$g['varrun_path']}/dhcp6c_{$wanif}.pid\")\n"; + $rtsoldscript .= "\t/bin/kill -1 \${dhcp6c_pid}\n"; $rtsoldscript .= "fi\n"; } else { /* @@ -4233,6 +4245,7 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { if (isvalidpid("{$g['varrun_path']}/rtsold_{$wanif}.pid")) { killbypid("{$g['varrun_path']}/rtsold_{$wanif}.pid"); + log_error("Killing running rtsold process"); sleep(2); } @@ -4265,6 +4278,8 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { * ( it does not background, it exits! ) It will launch dhcp6c * if dhcpwihtoutra is not set */ + log_error("Starting rtsold process"); + sleep(2); mwexec("/usr/sbin/rtsold -1 " . "-p {$g['varrun_path']}/rtsold_{$wanif}.pid " . "-O {$g['varetc_path']}/rtsold_{$wanif}_script.sh " . -- cgit v1.1