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 =
switch ($ipaddrv6) {
case "slaac":
case "dhcp6":
$pidv6 = find_dhcp6c_process($realif);
if ($pidv6) {
exec('/bin/kill ' . $pidv6);
}
sleep(3);
killbypid("/var/run/dhcp6c_{$realif}.pid", 'TERM', true);
@unlink("/var/etc/dhcp6c_{$interface}.conf");
if (does_interface_exist($realifv6)) {
$ip6 = find_interface_ipv6($realifv6);
......@@ -2581,16 +2577,6 @@ function kill_dhclient_process($interface)
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)
{
global $config;
......@@ -2971,10 +2957,7 @@ function interface_track6_configure($interface = 'lan', $wancfg, $linkupevent =
* XXX: Probably DHCPv6 client should handle this autmagically itself?
*/
$parentrealif = get_real_interface($wancfg['track6-interface']);
$pidv6 = find_dhcp6c_process($parentrealif);
if ($pidv6) {
exec('/bin/kill -HUP ' . $pidv6);
}
killbypid("/var/run/dhcp6c_{$parentrealif}.pid", 'HUP');
}
break;
}
......
......@@ -1250,10 +1250,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($old_config['ipaddrv6']) && $old_config['ipaddrv6'] == 'dhcp6' && $new_config['ipaddrv6'] != 'dhcp6') {
// change from dhcp to something else, kill dhcp6c
$pid = find_dhcp6c_process($old_config['if']);
if ($pid) {
exec('/bin/kill ' . $pid);
}
killbypid("/var/run/dhcp6c_{$old_config['if']}.pid");
}
// 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