3067 |
3067 |
|
3068 |
3068 |
return intval($pid);
|
3069 |
3069 |
}
|
3070 |
|
|
|
3070 |
function kill_dhcp6client_process($interface) {
|
|
3071 |
if (empty($interface) || !does_interface_exist($interface)) {
|
|
3072 |
return;
|
|
3073 |
}
|
|
3074 |
|
|
3075 |
$i = 0;
|
|
3076 |
while ((($pid = find_dhcp6c_process($interface)) != 0) && ($i < 3)) {
|
|
3077 |
/* 3rd time make it die for sure */
|
|
3078 |
$sig = ($i == 2 ? SIGKILL : SIGTERM);
|
|
3079 |
posix_kill($pid, $sig);
|
|
3080 |
sleep(1);
|
|
3081 |
$i++;
|
|
3082 |
}
|
|
3083 |
unset($i);
|
|
3084 |
}
|
3071 |
3085 |
function interface_virtual_create($interface) {
|
3072 |
3086 |
global $config;
|
3073 |
3087 |
|
... | ... | |
3992 |
4006 |
$rtsoldscript .= "echo $2 > {$g['tmp_path']}/{$wanif}_routerv6\n";
|
3993 |
4007 |
$rtsoldscript .= "echo $2 > {$g['tmp_path']}/{$wanif}_defaultgwv6\n";
|
3994 |
4008 |
$rtsoldscript .= "/usr/bin/logger -t rtsold \"Recieved RA specifying route \$2 for interface {
|
3995 |
|
$rtsoldscript .= "if [ -f {$g['varrun_path']}/dhcp6c_{$wanif}.pid ]; then\n";
|
3996 |
|
$rtsoldscript .= "\t/bin/pkill -F {$g['varrun_path']}/dhcp6c_{$wanif}.pid\n";
|
|
4009 |
/* non ipoe Process - prevent dhcp6c launch for now */
|
|
4010 |
if (isset($wancfg['dhcp6pppoe'])){
|
|
4011 |
$rtsoldscript .= "if [ -f {$g['varrun_path']}/dhcp6c_{$wanif}.pid ]; then\n";
|
|
4012 |
|
|
4013 |
/* I don't like this, there is no guarentee you are killing the process if the pid is
|
|
4014 |
$rtsoldscript .= "\t/bin/pkill -F {$g['varrun_path']}/dhcp6c_{$wanif}.pid\n";
|
|
4015 |
}
|
3997 |
4016 |
$rtsoldscript .= "\t/bin/sleep 1\n";
|
3998 |
4017 |
$rtsoldscript .= "fi\n";
|
3999 |
4018 |
$debugOption = isset($wancfg['dhcp6debug']) ? "-D" : "-d";
|
... | ... | |
4013 |
4032 |
mwexec("/sbin/ifconfig {$wanif} inet6 accept_rtadv");
|
4014 |
4033 |
|
4015 |
4034 |
/* fire up rtsold for IPv6 RAs first, this backgrounds immediately. It will call dhcp6c */
|
4016 |
|
if (isvalidpid("{$g['varrun_path']}/rtsold_{$wanif}.pid")) {
|
|
4035 |
if (isset($wancfg['dhcp6pppoe'])){
|
|
4036 |
if (isvalidpid("{$g['varrun_path']}/rtsold_{$wanif}.pid")) {
|
4017 |
4037 |
killbypid("{$g['varrun_path']}/rtsold_{$wanif}.pid");
|
4018 |
4038 |
sleep(2);
|
4019 |
|
}
|
|
4039 |
}
|
|
4040 |
}
|
4020 |
4041 |
mwexec("/usr/sbin/rtsold -1 -p {$g['varrun_path']}/rtsold_{$wanif}.pid -O {$g['varetc_path']}/
|
4021 |
4042 |
|
4022 |
4043 |
/* NOTE: will be called from rtsold invoked script
|
4023 |
4044 |
* link_interface_to_track6($interface, "update");
|
4024 |
4045 |
*/
|
|
4046 |
/* ipoe Process - kill any running dhcp6c daemons and launch a new one. This is if the interf
|
|
4047 |
if (!isset($wancfg['dhcp6pppoe'])){
|
|
4048 |
kill_dhcp6client_process($wanif);
|
|
4049 |
mwexec("/usr/local/sbin/dhcp6c -d -c {$g['varetc_path']}/dhcp6c_wan.conf -
|
|
4050 |
mwexec("/usr/bin/logger -t mwtag 'Starting dhcp6 client for interface wan({$wanif} in
|
|
4051 |
|
|
4052 |
if (isvalidpid("{$g['varrun_path']}/rtsold_{$wanif}.pid")) {
|
|
4053 |
killbypid("{$g['varrun_path']}/rtsold_{$wanif}.pid");
|
|
4054 |
sleep(2);
|
|
4055 |
}
|
|
4056 |
}
|
4025 |
4057 |
|
4026 |
4058 |
return 0;
|
4027 |
4059 |
}
|
... | ... | |
5911 |
5943 |
return preg_replace("/[0-9]+$/", "", $ifname);
|
5912 |
5944 |
}
|
5913 |
5945 |
|
5914 |
|
?>
|
|
5946 |
?>
|