diff options
-rw-r--r-- | etc/inc/interfaces.inc | 106 | ||||
-rw-r--r-- | etc/inc/upgrade_config.inc | 5 | ||||
-rwxr-xr-x | usr/local/www/interfaces.php | 7 | ||||
-rw-r--r-- | usr/local/www/interfaces_bridge.php | 8 | ||||
-rw-r--r-- | usr/local/www/interfaces_gif.php | 8 | ||||
-rw-r--r-- | usr/local/www/interfaces_gre.php | 8 | ||||
-rwxr-xr-x | usr/local/www/interfaces_groups.php | 8 | ||||
-rw-r--r-- | usr/local/www/interfaces_lagg.php | 8 | ||||
-rw-r--r-- | usr/local/www/interfaces_ppps_edit.php | 159 | ||||
-rwxr-xr-x | usr/local/www/interfaces_qinq.php | 8 | ||||
-rwxr-xr-x | usr/local/www/interfaces_vlan.php | 8 | ||||
-rw-r--r-- | usr/local/www/interfaces_wireless.php | 8 | ||||
-rw-r--r-- | usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js | 57 |
13 files changed, 229 insertions, 169 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index ca0af88..9bdfa43 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1099,12 +1099,16 @@ function interface_ppps_configure($interface) { if (is_ipaddr($ppp['gateway'])) $gateway = $ppp['gateway']; else - $gateway = "10.0.0.{$pppid}"; + $gateway = "10.6.6.{$pppid}"; $ranges = "{$localip}/0 {$gateway}/0"; } else $ranges = "0.0.0.0/0 0.0.0.0/0"; - + + $localips = explode(',',$ppp['localip']); + $gateways = explode(',',$ppp['gateway']); + $subnets = explode(',',$ppp['subnet']); + if (isset($ppp['ondemand'])) $ondemand = "enable"; else @@ -1120,12 +1124,13 @@ function interface_ppps_configure($interface) { $passwd = "none"; else $passwd = base64_decode($ppp['password']); - if (isset($ppp['bandwidth'])) - $bandwidths = explode(',',$ppp['bandwidth']); - if (isset($ppp['mtu'])) - $mtus = explode(',',$ppp['mtu']); - if (isset($ppp['mru'])) - $mrus = explode(',',$ppp['mru']); + + $bandwidths = explode(',',$ppp['bandwidth']); + $mtus = explode(',',$ppp['mtu']); + $mrus = explode(',',$ppp['mru']); + + if (!isset($ppp['idletimeout'])) + $mrrus = explode(',',$ppp['mrru']); // Construct the mpd.conf file $mpdconf = <<<EOD startup: @@ -1140,13 +1145,31 @@ default: set iface name {$pppif} EOD; + $setdefaultgw = false; + $founddefaultgw = false; + if (is_array($config['gateways']['gateway_item'])) { + foreach($config['gateways']['gateway_item'] as $gateway) { + if($interface == $gateway['interface'] && isset($gateway['defaultgw'])) { + $setdefaultgw = true; + break; + } else if (isset($gateway['defaultgw']) && !empty($gateway['interface'])) { + $founddefaultgw = true; + break; + } + } + } + if (($interface == "wan" && $founddefaultgw == false) || $setdefaultgw == true) + $mpdconf .= <<<EOD + set iface route default - if (isset($ppp['defaultgw'])) { +EOD; +/* + if (isset($ppp['defaultgw'])) $mpdconf .= <<<EOD set iface route default EOD; - } +*/ $mpdconf .= <<<EOD set iface {$ondemand} on-demand @@ -1154,74 +1177,72 @@ EOD; EOD; - if (isset($ppp['ondemand'])) { + if (isset($ppp['ondemand'])) $mpdconf .= <<<EOD set iface addrs 10.10.1.1 10.10.1.2 EOD; - } - if (isset($ppp['tcpmssfix'])) { + + if (isset($ppp['tcpmssfix'])) $mpdconf .= <<<EOD set iface enable tcpmssfix EOD; - } + $mpdconf .= <<<EOD set iface up-script /usr/local/sbin/ppp-linkup set iface down-script /usr/local/sbin/ppp-linkdown set ipcp ranges {$ranges} EOD; - if (isset($ppp['vjcomp'])){ + if (isset($ppp['vjcomp'])) $mpdconf .= <<<EOD set ipcp no vjcomp EOD; - } - if (isset($config['system']['dnsallowoverride']) && isset($ppp['defaultgw'])) { + if (isset($config['system']['dnsallowoverride']) && isset($ppp['defaultgw'])) $mpdconf .= <<<EOD set ipcp enable req-pri-dns set ipcp enable req-sec-dns EOD; - } + /* - if (!isset($intcfg['dnsnosec']) && isset($config['system']['dnsallowoverride'])) { + if (!isset($intcfg['dnsnosec']) && isset($config['system']['dnsallowoverride'])) $mpdconf .= <<<EOD set ipcp enable req-sec-dns EOD; - } */ foreach($ports as $pid => $port){ $mpdconf .= <<<EOD - create link static link{$pid}-{$interface} {$type} + create link static {$interface}_link{$pid} {$type} set link action bundle {$interface} set link {$multilink} multilink set link keep-alive 10 60 set link max-redial 0 EOD; - if (isset($ppp['shortseq'])){ + if (isset($ppp['shortseq'])) $mpdconf .= <<<EOD set link no shortseq EOD; - } - if (isset($ppp['acfcomp'])){ + + if (isset($ppp['acfcomp'])) $mpdconf .= <<<EOD set link no acfcomp EOD; - } - if (isset($ppp['protocomp'])){ + + if (isset($ppp['protocomp'])) $mpdconf .= <<<EOD set link no protocomp EOD; - } + $mpdconf .= <<<EOD set link disable chap pap set link accept chap pap eap @@ -1230,24 +1251,24 @@ EOD; EOD; - if (isset($bandwidths)){ + if (!empty($bandwidths[$pid])) $mpdconf .= <<<EOD set link bandwidth {$bandwidths[$pid]} EOD; - } - if (isset($mtus)){ + + if (!empty($mtus[$pid])) $mpdconf .= <<<EOD set link mtu {$mtus[$pid]} EOD; - } - if (isset($mrus)){ + + if (!empty($mrus[$pid])) $mpdconf .= <<<EOD set link mru {$mrus[$pid]} EOD; - } + $mpdconf .= <<<EOD set auth authname "{$ppp['username']}" set auth password {$passwd} @@ -1291,24 +1312,23 @@ EOD; EOD; } - if (isset($ppp['provider']) && $type == "pppoe") { $mpdconf .= <<<EOD set pppoe service "{$ppp['provider']}" EOD; } - if ($type == "pppoe") { + if ($type == "pppoe") $mpdconf .= <<<EOD set pppoe iface {$port} EOD; - } + if ($type == "pptp") { $mpdconf .= <<<EOD set bundle no noretry - set pptp self {$ppp['localip']} - set pptp peer {$ppp['gateway']} + set pptp self {$localips[$pid]} + set pptp peer {$gateways[$pid]} set pptp disable windowing EOD; @@ -1344,22 +1364,22 @@ EOD; if(file_exists("{$g['varrun_path']}/{$ppp['type']}_{$interface}.pid") and $g['booting']) { /* if we are booting and mpd has already been started then don't start again. */ } else { - foreach($ports as $port){ + foreach($ports as $pid => $port){ switch ($ppp['type']) { case "pppoe": /* Bring the parent interface up */ if($port) interfaces_bring_up($port); else - log_error("Could not bring up interface {$port} for {$ppp['type']} link on {$interface} in interface_ppps_configure()."); + log_error("Could not bring up interface {$port} for {$interface} {$ppp['type']} link in interface_ppps_configure()."); break; case "pptp": /* configure interface */ if($port) mwexec("/sbin/ifconfig " . escapeshellarg($port) . " " . - escapeshellarg($ppp['localip'] . "/" . $ppp['subnet']) . " up"); + escapeshellarg($localips[$pid] . "/" . $subnets[$pid]) . " up"); else - log_error("Could not bring up interface {$port} for {$ppp['type']} link on {$interface} in interface_ppps_configure()."); + log_error("Could not bring up interface {$port} for {$interface} {$ppp['type']} link in interface_ppps_configure()."); break; case "ppp": if (!file_exists("{$port}")) { @@ -1377,7 +1397,7 @@ EOD; } /* sleep until wan is up - or 30 seconds, whichever comes first */ - for ($count = 0; $count < 30; $count++) { + for ($count = 0; $count < 12; $count++) { if(file_exists("{$g['tmp_path']}/{$pppif}up")) { break; } diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 25b7456..af0f15f 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -2006,11 +2006,6 @@ function upgrade_063_to_064() { $ppp['username'] = $ifinfo['pptp_username']; $ppp['password'] = base64_encode($ifinfo['pptp_password']); } - foreach ($config['gateways']['gateway_item'] as $gateway){ - if ($gateway['name'] == $ifname && isset($gateway['defaultgw'])){ - $ppp['defaultgw'] = true; - } - } if (isset($ifinfo['provider'])) $ppp['provider'] = $ifinfo['provider']; diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 22055f8..a68112a 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -103,11 +103,6 @@ if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) { if ($wancfg['ptpid'] == $a_ppps[$pppid]['ptpid']) { $pconfig['pppid'] = $pppid; - if (isset($a_ppps[$pppid]['defaultgw'])) - $pconfig['defaultgw'] = true; - else - $pconfig['defaultgw'] = false; - if ($a_ppps[$pppid]['type'] == "pppoe"){ $pconfig['pppoe_username'] = $a_ppps[$pppid]['username']; $pconfig['pppoe_password'] = base64_decode($a_ppps[$pppid]['password']); @@ -584,7 +579,6 @@ if ($_POST) { $wancfg['if'] = $_POST['type'] . $if_num; $wancfg['ptpid'] = $_POST['ptpid']; $wancfg['ipaddr'] = $_POST['type']; - $ppp['defaultgw'] = $_POST['defaultgw']; if($gateway_item) { $a_gateways[] = $gateway_item; } @@ -1769,7 +1763,6 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" <input name="pppid" type="hidden" value="<?=$pppid;?>"> <input name="ppp_port" type="hidden" value="<?=$a_ppps[$pppid]['ports'];?>"> <input name="ptpid" type="hidden" value="<?=$a_ppps[$pppid]['ptpid'];?>"> - <input name="defaultgw" type="hidden" value="<?=$pconfig['defaultgw'];?>"> <?php else: ?> <input name="ptpid" type="hidden" value="<?=uniqid('', true);?>"> <?php endif; ?> diff --git a/usr/local/www/interfaces_bridge.php b/usr/local/www/interfaces_bridge.php index 8244d50..e7aa71d 100644 --- a/usr/local/www/interfaces_bridge.php +++ b/usr/local/www/interfaces_bridge.php @@ -92,10 +92,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", true, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", true, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_gif.php b/usr/local/www/interfaces_gif.php index f09ef95..08ef8f8 100644 --- a/usr/local/www/interfaces_gif.php +++ b/usr/local/www/interfaces_gif.php @@ -91,10 +91,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", true, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", true, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_gre.php b/usr/local/www/interfaces_gre.php index b92a25f..17b14fe 100644 --- a/usr/local/www/interfaces_gre.php +++ b/usr/local/www/interfaces_gre.php @@ -91,10 +91,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", true, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", true, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_groups.php b/usr/local/www/interfaces_groups.php index b582eb2..27a088a 100755 --- a/usr/local/www/interfaces_groups.php +++ b/usr/local/www/interfaces_groups.php @@ -77,10 +77,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_lagg.php b/usr/local/www/interfaces_lagg.php index 19d2aa2..a8445e2 100644 --- a/usr/local/www/interfaces_lagg.php +++ b/usr/local/www/interfaces_lagg.php @@ -97,10 +97,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", true, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", true, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_ppps_edit.php b/usr/local/www/interfaces_ppps_edit.php index 0464a49..f9cd4ef 100644 --- a/usr/local/www/interfaces_ppps_edit.php +++ b/usr/local/www/interfaces_ppps_edit.php @@ -109,13 +109,13 @@ if (isset($id) && $a_ppps[$id]) { $pconfig['apnum'] = $a_ppps[$id]['apnum']; $pconfig['phone'] = $a_ppps[$id]['phone']; $pconfig['connect-timeout'] = $a_ppps[$id]['connect-timeout']; - $pconfig['localip'] = $a_ppps[$id]['localip']; - $pconfig['gateway'] = $a_ppps[$id]['gateway']; + $pconfig['localip'] = explode(",",$a_ppps[$id]['localip']); + $pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']); } if ($a_ppps[$id]['type'] == "pptp") { - $pconfig['localip'] = $a_ppps[$id]['localip']; - $pconfig['subnet'] = $a_ppps[$id]['subnet']; - $pconfig['gateway'] = $a_ppps[$id]['gateway']; + $pconfig['localip'] = explode(",",$a_ppps[$id]['localip']); + $pconfig['subnet'] = explode(",",$a_ppps[$id]['subnet']); + $pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']); } if ($a_ppps[$id]['type'] == "pppoe") { $pconfig['provider'] = $a_ppps[$id]['provider']; @@ -216,8 +216,6 @@ if ($_POST) { } if ($_POST['type'] == "ppp" && count($_POST['interfaces']) > 1) $input_errors[] = "Multilink connections (MLPPP) using the PPP link type is not currently supported. Please select only one Link Interface."; - if ($_POST['type'] == "pptp" && count($_POST['interfaces']) > 1) - $input_errors[] = "Multilink connections (MLPPP) using the PPTP link type is not currently supported. Please select only one Link Interface."; if (($_POST['provider'] && !is_domain($_POST['provider']))) $input_errors[] = "The service name contains invalid characters."; if (($_POST['idletimeout'] != "") && !is_numericint($_POST['idletimeout'])) @@ -239,20 +237,22 @@ if ($_POST) { if ($date_nums[2] < date("Y")) $input_errors[] = gettext("A valid PPPoE reset year must be specified. Don't select a year in the past!"); } - if (($_POST['localip'] && !is_ipaddr($_POST['localip']))) - $input_errors[] = "A valid PPTP local IP address must be specified."; - if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) - $input_errors[] = "A valid PPTP subnet bit count must be specified."; - if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) - $input_errors[] = "A valid PPTP remote IP address must be specified."; -/* - if (($_POST['bandwidth'] != "") && !is_numericint($_POST['bandwidth'])) - $input_errors[] = "The bandwidth value must be an integer."; - if ($_POST['mtu'] && ($_POST['mtu'] < 576)) - $input_errors[] = "The MTU must be greater than 576 bytes."; - if ($_POST['mru'] && ($_POST['mru'] < 576)) - $input_errors[] = "The MRU must be greater than 576 bytes."; + + foreach($_POST['interfaces'] as $iface){ + if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) + $input_errors[] = "A valid local IP address must be specified for {$iface}."; +/* if (($_POST['subnet'][$iface] && !is_numeric($_POST['subnet'][$iface]))) + $input_errors[] = "A valid PPTP subnet bit count must be specified for {$iface}."; */ + if (($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]))) + $input_errors[] = "A valid gateway (remote IP) address must be specified for {$iface}."; + if (($_POST['bandwidth'][$iface] != "") && !is_numericint($_POST['bandwidth'][$iface])) + $input_errors[] = "The bandwidth value for {$iface} must be an integer."; + if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576)) + $input_errors[] = "The MTU for {$iface} must be greater than 576 bytes."; + if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576)) + $input_errors[] = "The MRU for {$iface} must be greater than 576 bytes."; + } /* foreach ($a_ppps as $ppp) { @@ -310,12 +310,18 @@ if ($_POST) { unset($ppp['apnum']); } $ppp['phone'] = $_POST['phone']; - if (!empty($_POST['localip'])) - $ppp['localip'] = $_POST['localip']; + foreach($_POST['interfaces'] as $iface){ + if (isset($_POST['localip'][$iface])) + $localip_array[] = $_POST['localip'][$iface]; + if (isset($_POST['gateway'][$iface])) + $gateway_array[] = $_POST['gateway'][$iface]; + } + if (count($localip_array)) + $ppp['localip'] = implode(',',$localip_array); else unset($ppp['localip']); - if (!empty($_POST['gateway'])) - $ppp['gateway'] = $_POST['gateway']; + if (count($gateway_array)) + $ppp['gateway'] = implode(',',$gateway_array); else unset($ppp['gateway']); if (!empty($_POST['connect-timeout'])) @@ -335,9 +341,26 @@ if ($_POST) { break; case "pptp": - $ppp['localip'] = $_POST['localip']; - $ppp['subnet'] = $_POST['subnet']; - $ppp['gateway'] = $_POST['gateway']; + foreach($_POST['interfaces'] as $iface){ + if (isset($_POST['localip'][$iface])) + $localip_array[] = $_POST['localip'][$iface]; + if (isset($_POST['gateway'][$iface])) + $gateway_array[] = $_POST['gateway'][$iface]; + if (isset($_POST['subnet'][$iface])) + $subnet_array[] = $_POST['subnet'][$iface]; + } + if (count($localip_array)) + $ppp['localip'] = implode(',',$localip_array); + else + unset($ppp['localip']); + if (count($gateway_array)) + $ppp['gateway'] = implode(',',$gateway_array); + else + unset($ppp['gateway']); + if (count($subnet_array)) + $ppp['subnet'] = implode(',',$subnet_array); + else + unset($ppp['subnet']); break; default: break; @@ -349,41 +372,35 @@ if ($_POST) { $ppp['protocomp'] = $_POST['protocomp'] ? true : false; $ppp['vjcomp'] = $_POST['vjcomp'] ? true : false; $ppp['tcpmssfix'] = $_POST['tcpmssfix'] ? true : false; - -/* while(count($_POST['bandwidth'])){ - if($_POST['bandwidth'][count($_POST['bandwidth'])-1] == "") - array_pop(&$_POST['bandwidth']); - else - break; +/* + $bw_array = array(); + $mtu_array = array(); + $mru_array = array(); + $mrru_array = array(); +*/ + foreach($_POST['interfaces'] as $iface){ + if (isset($_POST['bandwidth'][$iface])) + $bw_array[] = $_POST['bandwidth'][$iface]; + if (isset($_POST['mtu'][$iface])) + $mtu_array[] = $_POST['mtu'][$iface]; + if (isset($_POST['mru'][$iface])) + $mru_array[] = $_POST['mru'][$iface]; + if (isset($_POST['mrru'][$iface])) + $mrru_array[] = $_POST['mrru'][$iface]; } - */ - foreach($_POST['bandwidth'] as $bw){ - if(!empty($bw) && count($bw_array) < count($_POST['interfaces'])+1) - $bw_array[] = $bw; - } - if (count($bw_array)){ - + if (count($bw_array)) $ppp['bandwidth'] = implode(',', $bw_array); - } else + else unset($ppp['bandwidth']); - - foreach($_POST['mtu'] as $mtu){ - if(!empty($mtu)) - $mtu_array[] = $mtu; - } - if (count($mtu_array)){ + if (count($mtu_array)) $ppp['mtu'] = implode(',', $mtu_array); - } else + else unset($ppp['mtu']); - foreach($_POST['mru'] as $mru){ - if(!empty($mru)) - $mru_array[] = $mru; - } - if (count($mru_array)){ + if (count($mru_array)) $ppp['mru'] = implode(',', $mru_array); - } else + else unset($ppp['mru']); /* handle_pppoe_reset is called here because if user changes Link Type from PPPoE to another type we must be able to clear the config data in the <cron> section of config.xml if it exists @@ -764,31 +781,33 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" </table> </td> </tr> - <tr style="display:none" id="ipfields"> + <?php for($j=0; $j < $port_count; $j++) : ?> + <tr style="display:none" id="ipfields<?=$j;?>"> <td colspan="2" style="padding:0px;"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("Local IP address"); ?></td> + <td width="22%" name="<?= gettext("Local IP address"); ?>" id="localiplabel<?=$j;?>" valign="top" class="vncell"></td> <td width="78%" class="vtable"> - <input name="localip" type="text" class="formfld unknown" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip']);?>"> + <input name="localip[]" type="text" class="formfld unknown" id="localip<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['localip'][$j]);?>"> / - <select style="display:none" name="subnet" class="formselect" id="subnet"> + <select style="display:none" name="subnet[]" class="formselect" id="subnet<?=$j;?>"> <?php for ($i = 31; $i > 0; $i--): ?> - <option value="<?=$i;?>"<?php if ($i == $pconfig['subnet']) echo "selected"; ?>><?=$i;?></option> + <option value="<?=$i;?>"<?php if ($i == $pconfig['subnet'][$j]) echo "selected"; ?>><?=$i;?></option> <?php endfor; ?> </select> <br><span class="vexpl"><?= gettext("Note: Local IP/subnet is required for PPTP connections. LocalIP is automatically assigned for PPP links if this field is empty."); ?></span> </td> </tr> <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("Remote IP (Gateway)"); ?></td> + <td width="22%" name="<?= gettext("Remote IP (Gateway)"); ?>" id="gatewaylabel<?=$j;?>" valign="top" class="vncell"></td> <td width="78%" class="vtable"> - <input name="gateway" type="text" class="formfld unknown" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"> + <input name="gateway[]" type="text" class="formfld unknown" id="gateway<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['gateway'][$j]);?>"> <br><span class="vexpl"><?= gettext("Note: This is where the packets will be routed. Remote IP is required for PPTP connections. Remote IP is automatically assigned for PPP links if this field is empty."); ?></span> </td> </tr> </table> </td> + </tr><?php endfor; ?> <tr> <td colspan="2" valign="top" height="16"></td> </tr> @@ -844,23 +863,23 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" <td class="vtable"> <table name="link_parameters" border="0" cellpadding="6" cellspacing="0"> <tr> - <td width="22%" valign="top"class="vncell"> Bandwidth</td> - <td width="78%" id="bandwidth<?=$i;?>" class="vtable"> - <br/><input name="bandwidth[]" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['bandwidth'][$i]);?>"> + <td width="22%" id="bwlabel<?=$i;?>" valign="top"class="vncell"> Bandwidth</td> + <td width="78%" class="vtable"> + <br/><input name="bandwidth[]" id="bandwidth<?=$i;?>" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['bandwidth'][$i]);?>"> <br/> <span class="vexpl">Set Bandwidth for each link ONLY for MLPPP connections and ONLY when links have different bandwidths.</span> </td> </tr> <tr> - <td width="22%" valign="top" class="vncell"> MTU</td> - <td width="78%" id="mtu<?=$i;?>" class="vtable"> - <input name="mtu[]" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mtu'][$i]);?>"> + <td width="22%" id="mtulabel<?=$i;?>" valign="top" class="vncell"> MTU</td> + <td width="78%" class="vtable"> + <input name="mtu[]" id="mtu<?=$i;?>" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mtu'][$i]);?>"> <br> <span class="vexpl">Set MTU for each link if links have different bandwidths, otherwise, mtu will default to 1492.</span> </td> </tr> <tr> - <td width="22%" valign="top" class="vncell"> MRU</td> - <td width="78%" id="mru<?=$i;?>" class="vtable"> - <input name="mru[]" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mru'][$i]);?>"> + <td width="22%" id="mrulabel<?=$i;?>" valign="top" class="vncell"> MRU</td> + <td width="78%" class="vtable"> + <input name="mru[]" id="mru<?=$i;?>" type="text" class="formfld unknown" size="6" value="<?=htmlspecialchars($pconfig['mru'][$i]);?>"> <br> <span class="vexpl">Set MRU for each link if links have different bandwidths, otherwise, mru will default to 1492.</span> </td> </tr> diff --git a/usr/local/www/interfaces_qinq.php b/usr/local/www/interfaces_qinq.php index 62e4a41..f25a5dc 100755 --- a/usr/local/www/interfaces_qinq.php +++ b/usr/local/www/interfaces_qinq.php @@ -99,10 +99,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", true, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_vlan.php b/usr/local/www/interfaces_vlan.php index 20f41bb..cd8975c 100755 --- a/usr/local/www/interfaces_vlan.php +++ b/usr/local/www/interfaces_vlan.php @@ -93,10 +93,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", true, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/interfaces_wireless.php b/usr/local/www/interfaces_wireless.php index f639615..42fd149 100644 --- a/usr/local/www/interfaces_wireless.php +++ b/usr/local/www/interfaces_wireless.php @@ -91,10 +91,10 @@ include("head.inc"); $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPPs", false, "interfaces_ppps.php"); - $tab_array[7] = array("GRE", false, "interfaces_gre.php"); - $tab_array[8] = array("GIF", false, "interfaces_gif.php"); - $tab_array[9] = array("Bridges", false, "interfaces_bridge.php"); - $tab_array[10] = array("LAGG", false, "interfaces_lagg.php"); + $tab_array[6] = array("GRE", false, "interfaces_gre.php"); + $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[8] = array("Bridges", false, "interfaces_bridge.php"); + $tab_array[9] = array("LAGG", false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> </td></tr> diff --git a/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js b/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js index c9ace67..5f7c4dc 100644 --- a/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js +++ b/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js @@ -23,17 +23,50 @@ function clear_selected(list_name){ function show_hide_linkfields(options){ var select_count = 0; - // this for loop is not used currently for(var j=0; j < options.length; j++){ - var label = "link" + select_count.toString(); + var count = select_count.toString(); + var type = $('type').value; + var label = "link" + count; + var bw = "bandwidth" + count; + var mtu = "mtu" + count; + var mru = "mru" + count; + var ipfields = "ipfields" + count; + var localip = "localip" + count; + var localiplabel = "localiplabel" + count; + var subnet = "subnet" + count; + var gateway = "gateway" + count; + var gatewaylabel = "gatewaylabel" + count; + $(ipfields,label,subnet).invoke('hide'); + //$(label).hide(); + //$(subnet).hide(); + $(bw).name = "bandwidth[]"; + $(mtu).name = "mtu[]"; + $(mru).name = "mru[]"; + $(localip).name = "localip[]"; + $(subnet).name = "subnet[]"; + $(gateway).name = "gateway[]"; if (options[j].selected){ - var linklabel = "linklabel" + select_count.toString(); - $(linklabel).innerHTML = "Link Parameters (" + options[j].value + ")"; + var lnklabel = "linklabel" + count; + var bwlabel = "bwlabel" + count; + $(lnklabel).innerHTML = "Link Parameters (" + options[j].value + ")"; + $(bwlabel).innerHTML = "Bandwidth (" + options[j].value + ")"; + $(bw).name = "bandwidth[" + options[j].value + "]"; + $(mtu).name = "mtu[" + options[j].value + "]"; + $(mru).name = "mru[" + options[j].value + "]"; + if (type == 'pptp' || type == 'ppp'){ + $(localiplabel).innerHTML = "Local IP (" + options[j].value + ")"; + $(gatewaylabel).innerHTML = "Gateway (" + options[j].value + ")"; + $(localip).name = "localip[" + options[j].value + "]"; + $(subnet).name = "subnet[" + options[j].value + "]"; + $(gateway).name = "gateway[" + options[j].value + "]"; + if (type == 'pptp'){ + $(subnet).show(); + } + $(ipfields).show(); + } $(label).show(); select_count++; - continue; } - $(label).hide(); } } @@ -44,26 +77,26 @@ function updateType(t){ var select_list = document.iform["interfaces[]"].options; switch(t) { case "select": { - $('ppp','pppoe','pptp','ipfields','prefil_ppp').invoke('hide'); + $('ppp','pppoe','pptp','prefil_ppp').invoke('hide'); select_list.length = 0; - select_list.options[0] = new Option("Select Link Type First",""); + select_list[0] = new Option("Select Link Type First",""); break; } case "ppp": { update_select_list(serialports, select_list); - $('select','pppoe','pptp','subnet').invoke('hide'); - $('ipfields','prefil_ppp').invoke('show'); + $('select','pppoe','pptp').invoke('hide'); + $('prefil_ppp').show(); break; } case "pppoe": { update_select_list(ports, select_list); - $('select','ppp','pptp','ipfields','prefil_ppp').invoke('hide'); + $('select','ppp','pptp','prefil_ppp').invoke('hide'); break; } case "pptp": { update_select_list(ports, select_list); $('select','ppp','pppoe','prefil_ppp').invoke('hide'); - $('ipfields','subnet').invoke('show'); + //$('ipfields','subnet').invoke('show'); break; } default: |