Ejemplo n.º 1
0
         }
     }
 }
 if (!$input_errors) {
     // These 3 fields can be a list of multiple data items when used for MLPPP.
     // The UI in this code only processes the first of the list, so save the data here then we can preserve any other entries.
     $poriginal['pptp_localip'] = explode(",", $a_ppps[$pppid]['localip']);
     $poriginal['pptp_subnet'] = explode(",", $a_ppps[$pppid]['subnet']);
     $poriginal['pptp_remote'] = explode(",", $a_ppps[$pppid]['gateway']);
     if ($wancfg['ipaddr'] != $_POST['type']) {
         if (in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp"))) {
             $wancfg['if'] = $a_ppps[$pppid]['ports'];
             unset($a_ppps[$pppid]);
         } else {
             if ($wancfg['ipaddr'] == "dhcp") {
                 kill_dhclient_process($wancfg['if']);
             }
         }
         if ($wancfg['ipaddrv6'] == "dhcp6") {
             $pid = find_dhcp6c_process($wancfg['if']);
             if ($pid) {
                 posix_kill($pid, SIGTERM);
             }
         }
     }
     $ppp = array();
     if ($wancfg['ipaddr'] != "ppp") {
         unset($wancfg['ipaddr']);
     }
     if ($wancfg['ipaddrv6'] != "ppp") {
         unset($wancfg['ipaddrv6']);
Ejemplo n.º 2
0
     // quite obscure this... copies parts of the config
     interface_sync_wireless_clones($new_config, true);
 }
 if (count($new_ppp_config) > 0) {
     // ppp details changed
     $a_ppps[$pppid] = $new_ppp_config;
 } elseif (!empty($a_ppps[$pppid])) {
     // ppp removed
     $new_config['if'] = $a_ppps[$pppid]['ports'];
     unset($a_ppps[$pppid]);
 }
 // save interface details
 $a_interfaces[$if] = $new_config;
 if (!empty($old_config['ipaddr']) && $old_config['ipaddr'] == 'dhcp' && $new_config['ipaddr'] != 'dhcp') {
     // change from dhcp to something else, kill dhclient
     kill_dhclient_process($old_config['if']);
 }
 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);
     }
 }
 // yak... room for improvement here....
 handle_pppoe_reset($pconfig);
 // save to config
 write_config();
 // log changes for apply action
 // (it would be better to diff the physical situation with the new config for changes)
 if (file_exists('/tmp/.interfaces.apply')) {