Example #1
0
            // End force pppoe reset at specific time
            // End if type == pppoe
        } else {
            if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp") {
                $pconfig['pptp_username'] = $a_ppps[$pppid]['username'];
                $pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']);
                $pconfig['pptp_localip'] = explode(",", $a_ppps[$pppid]['localip']);
                $pconfig['pptp_subnet'] = explode(",", $a_ppps[$pppid]['subnet']);
                $pconfig['pptp_remote'] = explode(",", $a_ppps[$pppid]['gateway']);
                $pconfig['pptp_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
                $pconfig['pptp_idletimeout'] = $a_ppps[$pppid]['timeout'];
            }
        }
    }
} else {
    $pconfig['ptpid'] = interfaces_ptpid_next();
    $pppid = count($a_ppps);
}
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
$pconfig['alias-address'] = $wancfg['alias-address'];
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
$pconfig['dhcprejectfrom'] = $wancfg['dhcprejectfrom'];
$pconfig['adv_dhcp_pt_timeout'] = $wancfg['adv_dhcp_pt_timeout'];
$pconfig['adv_dhcp_pt_retry'] = $wancfg['adv_dhcp_pt_retry'];
$pconfig['adv_dhcp_pt_select_timeout'] = $wancfg['adv_dhcp_pt_select_timeout'];
$pconfig['adv_dhcp_pt_reboot'] = $wancfg['adv_dhcp_pt_reboot'];
$pconfig['adv_dhcp_pt_backoff_cutoff'] = $wancfg['adv_dhcp_pt_backoff_cutoff'];
$pconfig['adv_dhcp_pt_initial_interval'] = $wancfg['adv_dhcp_pt_initial_interval'];
$pconfig['adv_dhcp_pt_values'] = $wancfg['adv_dhcp_pt_values'];
$pconfig['adv_dhcp_send_options'] = $wancfg['adv_dhcp_send_options'];
$pconfig['adv_dhcp_request_options'] = $wancfg['adv_dhcp_request_options'];
                 $port_data[$field_label][] = $_POST[$field_label . $iface];
                 $pconfig[$field_label][$iface] = $_POST[$field_label . $iface];
                 $parent_array = get_parent_interface($iface);
                 $parent = $parent_array[0];
                 $friendly = convert_real_interface_to_friendly_interface_name($parent);
                 if ($field_label == "mtu" && isset($config['interfaces'][$friendly]['mtu']) && $_POST[$field_label . $iface] > $config['interfaces'][$friendly]['mtu'] - 8) {
                     $input_errors[] = sprintf(gettext("The MTU (%d) is too big for %s (maximum allowed with current settings: %d)."), $_POST[$field_label . $iface], $iface, $config['interfaces'][$friendly]['mtu'] - 8);
                 }
             }
         }
     }
 }
 if (!$input_errors) {
     $ppp = array();
     if (!isset($id)) {
         $ppp['ptpid'] = interfaces_ptpid_next();
     } else {
         $ppp['ptpid'] = $a_ppps[$id]['ptpid'];
     }
     $ppp['type'] = $_POST['type'];
     $ppp['if'] = $ppp['type'] . $ppp['ptpid'];
     $ppp['ports'] = implode(',', $_POST['interfaces']);
     $ppp['username'] = $_POST['username'];
     if ($_POST['passwordfld'] != DMYPWD) {
         $ppp['password'] = base64_encode($_POST['passwordfld']);
     } else {
         $ppp['password'] = $a_ppps[$id]['password'];
     }
     $ppp['ondemand'] = $_POST['ondemand'] ? true : false;
     if (!empty($_POST['idletimeout'])) {
         $ppp['idletimeout'] = $_POST['idletimeout'];