Пример #1
0
         $wancfg['ipaddrv6'] = "track6";
         $wancfg['track6-interface'] = $_POST['track6-interface'];
         if ($_POST['track6-prefix-id--hex'] === "") {
             $wancfg['track6-prefix-id'] = 0;
         } else {
             if (is_numeric("0x" . $_POST['track6-prefix-id--hex'])) {
                 $wancfg['track6-prefix-id'] = intval($_POST['track6-prefix-id--hex'], 16);
             } else {
                 $wancfg['track6-prefix-id'] = 0;
             }
         }
         break;
     case "none":
         break;
 }
 handle_pppoe_reset($_POST);
 if ($_POST['blockpriv'] == "yes") {
     $wancfg['blockpriv'] = true;
 } else {
     unset($wancfg['blockpriv']);
 }
 if ($_POST['blockbogons'] == "yes") {
     $wancfg['blockbogons'] = true;
 } else {
     unset($wancfg['blockbogons']);
 }
 $wancfg['spoofmac'] = $_POST['spoofmac'];
 if (empty($_POST['mtu'])) {
     unset($wancfg['mtu']);
 } else {
     $wancfg['mtu'] = $_POST['mtu'];
Пример #2
0
 }
 // 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();
 }
 $old_config['realif'] = get_real_interface($if);
 $toapplylist[$if]['ifcfg'] = $old_config;
 $toapplylist[$if]['ppps'] = $old_ppps;
 file_put_contents('/tmp/.interfaces.apply', serialize($toapplylist));
 mark_subsystem_dirty('interfaces');
 /* regenerate cron settings/crontab file */
Пример #3
0
        return false;
    }
    foreach ($iflist as $if) {
        if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) {
            return true;
        }
    }
    return false;
}
if ($_GET['act'] == "del") {
    /* check if still in use */
    if (ppp_inuse($_GET['id'])) {
        $input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
    } elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_GET['id']])) {
        unset($config['ppps']['ppp'][$_GET['id']]['pppoe-reset-type']);
        handle_pppoe_reset($config['ppps']['ppp'][$_GET['id']]);
        unset($config['ppps']['ppp'][$_GET['id']]);
        write_config();
        header("Location: interfaces_ppps.php");
        exit;
    }
}
if (!is_array($config['ppps']['ppp'])) {
    $config['ppps']['ppp'] = array();
}
$a_ppps = $config['ppps']['ppp'];
$pgtitle = array(gettext("Interfaces"), gettext("PPPs"));
$shortcut_section = "interfaces";
include "head.inc";
$tab_array = array();
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
Пример #4
0
}
if (!isset($config['ppps']['ppp']) || !is_array($config['ppps']['ppp'])) {
    $a_ppps = array();
} else {
    $a_ppps =& $config['ppps']['ppp'];
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (!empty($a_ppps[$_POST['id']])) {
        $id = $_POST['id'];
    }
    if (!empty($_POST['action']) && $_POST['action'] == "del" && isset($id)) {
        if (ppp_inuse($a_ppps[$id]['if'])) {
            $input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
        } else {
            unset($a_ppps[$id]['pppoe-reset-type']);
            handle_pppoe_reset($a_ppps[$id]);
            unset($a_ppps[$id]);
            write_config();
            header("Location: interfaces_ppps.php");
            exit;
        }
    }
}
include "head.inc";
legacy_html_escape_form_data($a_ppps);
$main_buttons = array(array('href' => 'interfaces_ppps_edit.php', 'label' => gettext('Add')));
?>
<body>
  <script type="text/javascript">
  $( document ).ready(function() {
    // link delete buttons