Project

General

Profile

Bug #5993 » redmine5993.patch

Chris Buechler, 03/18/2016 06:48 PM

View differences:

src/etc/inc/interfaces.inc
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;
......
$rtsoldscript .= "echo $2 > {$g['tmp_path']}/{$wanif}_routerv6\n";
$rtsoldscript .= "echo $2 > {$g['tmp_path']}/{$wanif}_defaultgwv6\n";
$rtsoldscript .= "/usr/bin/logger -t rtsold \"Recieved RA specifying route \$2 for interface {
$rtsoldscript .= "if [ -f {$g['varrun_path']}/dhcp6c_{$wanif}.pid ]; then\n";
$rtsoldscript .= "\t/bin/pkill -F {$g['varrun_path']}/dhcp6c_{$wanif}.pid\n";
/* non ipoe Process - prevent dhcp6c launch for now */
if (isset($wancfg['dhcp6pppoe'])){
$rtsoldscript .= "if [ -f {$g['varrun_path']}/dhcp6c_{$wanif}.pid ]; then\n";
/* I don't like this, there is no guarentee you are killing the process if the pid is
$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";
......
mwexec("/sbin/ifconfig {$wanif} inet6 accept_rtadv");
/* fire up rtsold for IPv6 RAs first, this backgrounds immediately. It will call dhcp6c */
if (isvalidpid("{$g['varrun_path']}/rtsold_{$wanif}.pid")) {
if (isset($wancfg['dhcp6pppoe'])){
if (isvalidpid("{$g['varrun_path']}/rtsold_{$wanif}.pid")) {
killbypid("{$g['varrun_path']}/rtsold_{$wanif}.pid");
sleep(2);
}
}
}
mwexec("/usr/sbin/rtsold -1 -p {$g['varrun_path']}/rtsold_{$wanif}.pid -O {$g['varetc_path']}/
/* NOTE: will be called from rtsold invoked script
* link_interface_to_track6($interface, "update");
*/
/* ipoe Process - kill any running dhcp6c daemons and launch a new one. This is if the interf
if (!isset($wancfg['dhcp6pppoe'])){
kill_dhcp6client_process($wanif);
mwexec("/usr/local/sbin/dhcp6c -d -c {$g['varetc_path']}/dhcp6c_wan.conf -
mwexec("/usr/bin/logger -t mwtag 'Starting dhcp6 client for interface wan({$wanif} in
if (isvalidpid("{$g['varrun_path']}/rtsold_{$wanif}.pid")) {
killbypid("{$g['varrun_path']}/rtsold_{$wanif}.pid");
sleep(2);
}
}
return 0;
}
......
return preg_replace("/[0-9]+$/", "", $ifname);
}
?>
?>
src/usr/local/www/interfaces.php
$pconfig['dhcp6prefixonly'] = isset($wancfg['dhcp6prefixonly']);
$pconfig['dhcp6usev4iface'] = isset($wancfg['dhcp6usev4iface']);
$pconfig['dhcp6debug'] = isset($wancfg['dhcp6debug']);
$pconfig['dhcp6pppoe'] = isset($wancfg['dhcp6pppoe']);
break;
case "6to4":
$pconfig['type6'] = "6to4";
......
unset($wancfg['dhcp6prefixonly']);
unset($wancfg['dhcp6usev4iface']);
unset($wancfg['dhcp6debug']);
unset($wancfg['dhcp6pppoe']);
unset($wancfg['track6-interface']);
unset($wancfg['track6-prefix-id']);
unset($wancfg['prefix-6rd']);
......
if ($_POST['dhcp6debug'] == "yes") {
$wancfg['dhcp6debug'] = true;
}
if ($_POST['dhcp6pppoe'] == "yes") {
$wancfg['dhcp6pppoe'] = true;
}
if (!empty($_POST['adv_dhcp6_interface_statement_send_options'])) {
$wancfg['adv_dhcp6_interface_statement_send_options'] = $_POST
......
'Start DHCP6 client in debug mode',
$pconfig['dhcp6debug']
));
$section->addInput(new Form_Checkbox(
'dhcp6pppoe',
'IPV6 PPPoE',
'RA Triggers DHCP6 Solicit.',
$pconfig['dhcp6pppoe']
))->setHelp('Set if your ISP require RA before DHCP (PPPoE). Unset if your ISP requires DHCP before R
$section->addInput(new Form_Input(
'adv_dhcp6_config_file_override_path',
(2-2/5)