diff options
author | Phil Davis <phil.davis@inf.org> | 2016-07-20 16:24:32 +0930 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2016-07-20 16:24:32 +0930 |
commit | f50f74a45898f1fd31883e8a2bc903b0659d2a35 (patch) | |
tree | 56a2ce1f0d31986c6e623a8c92e310dca8c16663 /src | |
parent | c9d6b915daced9767ff596ee9485ec2d9a573a41 (diff) | |
download | pfsense-f50f74a45898f1fd31883e8a2bc903b0659d2a35.zip pfsense-f50f74a45898f1fd31883e8a2bc903b0659d2a35.tar.gz |
Backport DHCP6 init before RA
Original PR to master was #3055
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/interfaces.inc | 36 | ||||
-rw-r--r-- | src/usr/local/www/interfaces.php | 13 |
2 files changed, 49 insertions, 0 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 4eee7bc..97f09fc 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -3061,6 +3061,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; @@ -3997,6 +4013,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"); @@ -4015,6 +4045,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 diff --git a/src/usr/local/www/interfaces.php b/src/usr/local/www/interfaces.php index c8d38f3..beaad37 100644 --- a/src/usr/local/www/interfaces.php +++ b/src/usr/local/www/interfaces.php @@ -316,6 +316,7 @@ switch ($wancfg['ipaddrv6']) { $pconfig['dhcp6prefixonly'] = isset($wancfg['dhcp6prefixonly']); $pconfig['dhcp6usev4iface'] = isset($wancfg['dhcp6usev4iface']); $pconfig['dhcp6debug'] = isset($wancfg['dhcp6debug']); + $pconfig['dhcp6withoutra'] = isset($wancfg['dhcp6withoutra']); break; case "6to4": $pconfig['type6'] = "6to4"; @@ -1010,6 +1011,7 @@ if ($_POST['apply']) { unset($wancfg['dhcp6debug']); unset($wancfg['track6-interface']); unset($wancfg['track6-prefix-id']); + unset($wancfg['dhcp6withoutra']); unset($wancfg['prefix-6rd']); unset($wancfg['prefix-6rd-v4plen']); unset($wancfg['gateway-6rd']); @@ -1257,6 +1259,10 @@ if ($_POST['apply']) { $wancfg['dhcp6debug'] = true; } + if ($_POST['dhcp6withoutra'] == "yes") { + $wancfg['dhcp6withoutra'] = true; + } + if (!empty($_POST['adv_dhcp6_interface_statement_send_options'])) { $wancfg['adv_dhcp6_interface_statement_send_options'] = $_POST['adv_dhcp6_interface_statement_send_options']; } @@ -2154,6 +2160,13 @@ $section->addInput(new Form_Checkbox( $pconfig['dhcp6debug'] )); +$section->addInput(new Form_Checkbox( + 'dhcp6withoutra', + 'Do not wait for a RA', + 'Required by some ISPs, especially those not using PPPoE', + $pconfig['dhcp6withoutra'] +)); + $section->addInput(new Form_Input( 'adv_dhcp6_config_file_override_path', 'Configuration File Override', |