diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-07-17 21:15:26 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-07-17 21:15:26 -0500 |
commit | 655fb9df95aaac301a2df3fb2198492050f40b49 (patch) | |
tree | 076ce091885fb40943f9c28f4698b6e6b84c5d1b /src/etc | |
parent | 8f70ba67a94b21e3a78728a7ba52057424b0a013 (diff) | |
parent | 8c661bc8555321b76656e8a9723b4a7189eceb30 (diff) | |
download | pfsense-655fb9df95aaac301a2df3fb2198492050f40b49.zip pfsense-655fb9df95aaac301a2df3fb2198492050f40b49.tar.gz |
Merge pull request #3055 from marjohn56/master
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/interfaces.inc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index c120bb9..76ea359 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -3028,6 +3028,22 @@ function find_dhcp6c_process($interface) { return intval($pid); } +function kill_dhcp6client_process($interface) { + if (empty($interface) || !does_interface_exist($interface)) { + return; + } + + $i = 0; + while ((($pid = find_dhcp6c_process($interface)) != 0) && ($i < 3)) { + /* 3rd time make it die for sure */ + $sig = ($i == 2 ? SIGKILL : SIGTERM); + posix_kill($pid, $sig); + sleep(1); + $i++; + } + unset($i); +} + function interface_virtual_create($interface) { global $config; @@ -3965,6 +3981,20 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { $debugOption = isset($wancfg['dhcp6debug']) ? "-D" : "-d"; $rtsoldscript .= "/usr/local/sbin/dhcp6c {$debugOption} -c {$g['varetc_path']}/dhcp6c_{$interface}.conf -p {$g['varrun_path']}/dhcp6c_{$wanif}.pid {$wanif}\n"; $rtsoldscript .= "/usr/bin/logger -t rtsold \"Starting dhcp6 client for interface {$interface}({$wanif})\"\n"; + /* non ipoe Process */ + if (!isset($wancfg['dhcp6withoutra'])) { + $rtsoldscript .= "if [ -f {$g['varrun_path']}/dhcp6c_{$wanif}.pid ]; then\n"; + $rtsoldscript .= "\t/bin/pkill -F {$g['varrun_path']}/dhcp6c_{$wanif}.pid\n"; + $rtsoldscript .= "\t/bin/sleep 1\n"; + $rtsoldscript .= "fi\n"; + } else { + $rtsoldscript .= "\t/bin/sleep 1\n"; + } + $debugOption = isset($wancfg['dhcp6debug']) ? "-D" : "-d"; + if (!isset($wancfg['dhcp6withoutra'])){ + $rtsoldscript .= "/usr/local/sbin/dhcp6c {$debugOption} -c {$g['varetc_path']}/dhcp6c_{$interface}.conf -p {$g['varrun_path']}/dhcp6c_{$wanif}.pid {$wanif}\n"; + $rtsoldscript .= "/usr/bin/logger -t rtsold \"Starting dhcp6 client for interface {$interface}({$wanif})\"\n"; + } /* Add wide-dhcp6c shell script here. Because we can not pass a argument to it. */ if (!@file_put_contents("{$g['varetc_path']}/rtsold_{$wanif}_script.sh", $rtsoldscript)) { printf("Error: cannot open rtsold_{$wanif}_script.sh in interface_dhcpv6_configure() for writing.\n"); @@ -3983,6 +4013,12 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { killbypid("{$g['varrun_path']}/rtsold_{$wanif}.pid"); sleep(2); } + if (isset($wancfg['dhcp6withoutra'])) { + kill_dhcp6client_process($wanif); + + mwexec("/usr/local/sbin/dhcp6c {$debugOption} -x -c {$g['varetc_path']}/dhcp6c_wan.conf -p {$g['varrun_path']}/dhcp6c_{$wanif}.pid {$wanif}"); + mwexec("/usr/bin/logger -t mwtag 'Starting dhcp6 client for interface wan({$wanif} in IPoE mode)'"); + } mwexec("/usr/sbin/rtsold -1 -p {$g['varrun_path']}/rtsold_{$wanif}.pid -O {$g['varetc_path']}/rtsold_{$wanif}_script.sh {$wanif}"); /* NOTE: will be called from rtsold invoked script |