Commit 1bf2326f authored by Franco Fichtner's avatar Franco Fichtner

interfaces: wait for dhcp6c to exit et al for #1202

(cherry picked from commit c8524059)
parent 6b1adad4
...@@ -1282,11 +1282,7 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg = ...@@ -1282,11 +1282,7 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg =
switch ($ipaddrv6) { switch ($ipaddrv6) {
case "slaac": case "slaac":
case "dhcp6": case "dhcp6":
$pidv6 = find_dhcp6c_process($realif); killbypid("/var/run/dhcp6c_{$realif}.pid", 'TERM', true);
if ($pidv6) {
exec('/bin/kill ' . $pidv6);
}
sleep(3);
@unlink("/var/etc/dhcp6c_{$interface}.conf"); @unlink("/var/etc/dhcp6c_{$interface}.conf");
if (does_interface_exist($realifv6)) { if (does_interface_exist($realifv6)) {
$ip6 = find_interface_ipv6($realifv6); $ip6 = find_interface_ipv6($realifv6);
...@@ -2581,16 +2577,6 @@ function kill_dhclient_process($interface) ...@@ -2581,16 +2577,6 @@ function kill_dhclient_process($interface)
unset($i); unset($i);
} }
function find_dhcp6c_process($interface)
{
if ($interface && isvalidpid("/var/run/dhcp6c_{$interface}.pid")) {
$pid = trim(file_get_contents("/var/run/dhcp6c_{$interface}.pid"), " \n");
return intval($pid);
}
return false;
}
function interface_vlan_mtu_configured($realhwif, $mtu) function interface_vlan_mtu_configured($realhwif, $mtu)
{ {
global $config; global $config;
...@@ -2971,10 +2957,7 @@ function interface_track6_configure($interface = 'lan', $wancfg, $linkupevent = ...@@ -2971,10 +2957,7 @@ function interface_track6_configure($interface = 'lan', $wancfg, $linkupevent =
* XXX: Probably DHCPv6 client should handle this autmagically itself? * XXX: Probably DHCPv6 client should handle this autmagically itself?
*/ */
$parentrealif = get_real_interface($wancfg['track6-interface']); $parentrealif = get_real_interface($wancfg['track6-interface']);
$pidv6 = find_dhcp6c_process($parentrealif); killbypid("/var/run/dhcp6c_{$parentrealif}.pid", 'HUP');
if ($pidv6) {
exec('/bin/kill -HUP ' . $pidv6);
}
} }
break; break;
} }
......
...@@ -1250,10 +1250,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -1250,10 +1250,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($old_config['ipaddrv6']) && $old_config['ipaddrv6'] == 'dhcp6' && $new_config['ipaddrv6'] != 'dhcp6') { if (!empty($old_config['ipaddrv6']) && $old_config['ipaddrv6'] == 'dhcp6' && $new_config['ipaddrv6'] != 'dhcp6') {
// change from dhcp to something else, kill dhcp6c // change from dhcp to something else, kill dhcp6c
$pid = find_dhcp6c_process($old_config['if']); killbypid("/var/run/dhcp6c_{$old_config['if']}.pid");
if ($pid) {
exec('/bin/kill ' . $pid);
}
} }
// save to config // save to config
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment