summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/interfaces.inc
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2016-07-20 16:24:32 +0930
committerPhil Davis <phil.davis@inf.org>2016-07-20 16:24:32 +0930
commitf50f74a45898f1fd31883e8a2bc903b0659d2a35 (patch)
tree56a2ce1f0d31986c6e623a8c92e310dca8c16663 /src/etc/inc/interfaces.inc
parentc9d6b915daced9767ff596ee9485ec2d9a573a41 (diff)
downloadpfsense-f50f74a45898f1fd31883e8a2bc903b0659d2a35.zip
pfsense-f50f74a45898f1fd31883e8a2bc903b0659d2a35.tar.gz
Backport DHCP6 init before RA
Original PR to master was #3055
Diffstat (limited to 'src/etc/inc/interfaces.inc')
-rw-r--r--src/etc/inc/interfaces.inc36
1 files changed, 36 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
OpenPOWER on IntegriCloud