コード例 #1
0
ファイル: interfaces.php プロジェクト: paudam/opnsense-core
     // 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')) {
     $toapplylist = unserialize(file_get_contents('/tmp/.interfaces.apply'));
 } else {
     $toapplylist = array();
 }
コード例 #2
0
ファイル: interfaces.php プロジェクト: simudream/pfsense
 // 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']);
 }
 unset($wancfg['subnet']);
 unset($wancfg['gateway']);
 unset($wancfg['subnetv6']);
コード例 #3
0
     }
     if ($_POST['passphrase']) {
         $passlen = strlen($_POST['passphrase']);
         if ($passlen < 8 || $passlen > 64) {
             $input_errors[] = gettext("The length of the passphrase should be between 8 and 63 characters.");
         }
     }
 }
 if (!$input_errors) {
     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['ipaddrv6'] == "dhcp6") {
                 $pid = find_dhcp6c_process($realif);
                 if ($pid) {
                     posix_kill($pid, SIGTERM);
                 }
             } else {
                 if ($wancfg['ipaddr'] == "dhcp") {
                     $pid = find_dhclient_process($realif);
                     if ($pid) {
                         posix_kill($pid, SIGTERM);
                     }
                 }
             }
         }
     }
     $ppp = array();
     if ($wancfg['ipaddr'] != "ppp") {