summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormarjohn56 <martin@queens-park.com>2016-08-07 21:06:25 +0100
committerNewEraCracker <neweracracker@gmail.com>2016-09-02 19:21:01 +0100
commitc4ddb03acbbb4ff2a88162a9afc9e589a6f4d053 (patch)
treefd83688de68a6a34a430acedc916d668beef4ea2 /src
parentb85d0e0397f218c2fcb45070ec7811c9dd0dd060 (diff)
downloadpfsense-c4ddb03acbbb4ff2a88162a9afc9e589a6f4d053.zip
pfsense-c4ddb03acbbb4ff2a88162a9afc9e589a6f4d053.tar.gz
DHCP6 Before RA. Additions and ammendments
Replaced posix_kill() in kill_dhcp6client_process() with mwexec("kill -9 $pid"), this is because the posix_kill call was not reliably killing the dhcp6c process, kill -9 works every time. Changes to the rtsold script creation. The script lines starting dhcp6c should not have be written to the script when dhcpwithoutra is true. Style corrections, I spend more time doing these than changing code!
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/interfaces.inc41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index 3bfc16f..d50aaed 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -1300,11 +1300,7 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg =
switch ($ifcfg['ipaddrv6']) {
case "slaac":
case "dhcp6":
- $pidv6 = find_dhcp6c_process($realif);
- if ($pidv6) {
- posix_kill($pidv6, SIGTERM);
- }
- sleep(3);
+ kill_dhcp6client_process($realif);
unlink_if_exists("{$g['varetc_path']}/dhcp6c_{$interface}.conf");
unlink_if_exists("{$g['varetc_path']}/dhcp6c_{$interface}_script.sh");
unlink_if_exists("{$g['varetc_path']}/rtsold_{$realifv6}_script.sh");
@@ -3030,19 +3026,14 @@ function find_dhcp6c_process($interface) {
}
function kill_dhcp6client_process($interface) {
- if (empty($interface) || !does_interface_exist($interface)) {
- return;
- }
+ 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);
+ if (($pid = find_dhcp6c_process($interface)) != 0) {
+ mwexec("kill -9 {$pid}");
+ sleep(1);
+ }
}
function interface_virtual_create($interface) {
@@ -3975,15 +3966,9 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) {
$rtsoldscript .= "echo $2 > {$g['tmp_path']}/{$wanif}_routerv6\n";
$rtsoldscript .= "echo $2 > {$g['tmp_path']}/{$wanif}_defaultgwv6\n";
$rtsoldscript .= "/usr/bin/logger -t rtsold \"Received RA specifying route \$2 for interface {$interface}({$wanif})\"\n";
- $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";
- $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'])) {
+ 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";
@@ -3992,6 +3977,8 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) {
$rtsoldscript .= "\t/bin/sleep 1\n";
}
$debugOption = isset($wancfg['dhcp6debug']) ? "-D" : "-d";
+
+ /* add the start of dhcp6c to the rtsold script if we are going to wait for ra */
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";
@@ -4014,11 +4001,13 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) {
killbypid("{$g['varrun_path']}/rtsold_{$wanif}.pid");
sleep(2);
}
+
+ /* start dhcp6c here if we don't want to wait for ra */
if (isset($wancfg['dhcp6withoutra'])) {
kill_dhcp6client_process($wanif);
mwexec("/usr/local/sbin/dhcp6c {$debugOption} -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/bin/logger -t info 'Starting dhcp6 client for interface wan({$wanif} in DHCP6 without RA mode)'");
}
mwexec("/usr/sbin/rtsold -1 -p {$g['varrun_path']}/rtsold_{$wanif}.pid -O {$g['varetc_path']}/rtsold_{$wanif}_script.sh {$wanif}");
OpenPOWER on IntegriCloud