Project

General

Profile

Bug #5993 » redmine5993.patch

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

View differences:

src/etc/inc/interfaces.inc
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
?>
src/usr/local/www/interfaces.php
317 317
               $pconfig['dhcp6prefixonly'] = isset($wancfg['dhcp6prefixonly']);
318 318
               $pconfig['dhcp6usev4iface'] = isset($wancfg['dhcp6usev4iface']);
319 319
               $pconfig['dhcp6debug'] = isset($wancfg['dhcp6debug']);
320
               $pconfig['dhcp6pppoe'] = isset($wancfg['dhcp6pppoe']);
320 321
               break;
321 322
       case "6to4":
322 323
               $pconfig['type6'] = "6to4";
......
1009 1010
               unset($wancfg['dhcp6prefixonly']);
1010 1011
               unset($wancfg['dhcp6usev4iface']);
1011 1012
               unset($wancfg['dhcp6debug']);
1013
               unset($wancfg['dhcp6pppoe']);
1012 1014
               unset($wancfg['track6-interface']);
1013 1015
               unset($wancfg['track6-prefix-id']);
1014 1016
               unset($wancfg['prefix-6rd']);
......
1257 1259
                               if ($_POST['dhcp6debug'] == "yes") {
1258 1260
                                       $wancfg['dhcp6debug'] = true;
1259 1261
                               }
1262
                               if ($_POST['dhcp6pppoe'] == "yes") {
1263
                                       $wancfg['dhcp6pppoe'] = true;
1264
                               }
1260 1265

  
1261 1266
                               if (!empty($_POST['adv_dhcp6_interface_statement_send_options'])) {
1262 1267
                                       $wancfg['adv_dhcp6_interface_statement_send_options'] = $_POST
......
2154 2159
       'Start DHCP6 client in debug mode',
2155 2160
       $pconfig['dhcp6debug']
2156 2161
));
2162
$section->addInput(new Form_Checkbox(
2163
       'dhcp6pppoe',
2164
       'IPV6 PPPoE',
2165
       'RA Triggers DHCP6 Solicit.',
2166
       $pconfig['dhcp6pppoe']
2167
))->setHelp('Set if your ISP require RA before DHCP (PPPoE). Unset if your ISP requires DHCP before R
2168

  
2157 2169

  
2158 2170
$section->addInput(new Form_Input(
2159 2171
       'adv_dhcp6_config_file_override_path',
(2-2/5)