From 589f92bb3ecbec0847952da5aa4bd17f11b7c979 Mon Sep 17 00:00:00 2001 From: gnhb Date: Tue, 30 Mar 2010 12:29:07 +0700 Subject: [PATCH 001/101] mlppp implementation starts --- usr/local/www/interfaces_mlppp.php | 147 +++++++++++++++++++ usr/local/www/interfaces_mlppp_edit.php | 180 ++++++++++++++++++++++++ 2 files changed, 327 insertions(+) create mode 100644 usr/local/www/interfaces_mlppp.php create mode 100644 usr/local/www/interfaces_mlppp_edit.php diff --git a/usr/local/www/interfaces_mlppp.php b/usr/local/www/interfaces_mlppp.php new file mode 100644 index 0000000000..389fbfe549 --- /dev/null +++ b/usr/local/www/interfaces_mlppp.php @@ -0,0 +1,147 @@ +. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +/* + pfSense_BUILDER_BINARIES: /sbin/ifconfig + pfSense_MODULE: interfaces +*/ + +##|+PRIV +##|*IDENT=page-interfaces-vlan +##|*NAME=Interfaces: VLAN page +##|*DESCR=Allow access to the 'Interfaces: VLAN' page. +##|*MATCH=interfaces_vlan.php* +##|-PRIV + +require("guiconfig.inc"); + +if (!is_array($config['vlans']['vlan'])) + $config['vlans']['vlan'] = array(); + +$a_vlans = &$config['vlans']['vlan'] ; + +function vlan_inuse($num) { + global $config, $a_vlans; + + $iflist = get_configured_interface_list(false, true); + foreach ($iflist as $if) { + if ($config['interfaces'][$if]['if'] == $a_vlans[$num]['vlanif']) + return true; + } + + return false; +} + +if ($_GET['act'] == "del") { + /* check if still in use */ + if (vlan_inuse($_GET['id'])) { + $input_errors[] = "This VLAN cannot be deleted because it is still being used as an interface."; + } else { + mwexec("/sbin/ifconfig " . $a_vlans[$_GET['id']]['vlanif'] . " destroy"); + unset($a_vlans[$_GET['id']]); + + write_config(); + + header("Location: interfaces_vlan.php"); + exit; + } +} + + +$pgtitle = array("Interfaces","VLAN"); +include("head.inc"); + +?> + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
InterfaceVLAN tagDescription
+ + + + +   + +  
 

+ Note:
+
+ Not all drivers/NICs support 802.1Q VLAN tagging properly. On cards that do not explicitly support it, VLAN tagging will still work, but the reduced MTU may cause problems. See the handbook for information on supported cards.

+
 
+
+
+ + + diff --git a/usr/local/www/interfaces_mlppp_edit.php b/usr/local/www/interfaces_mlppp_edit.php new file mode 100644 index 0000000000..1d958fdd44 --- /dev/null +++ b/usr/local/www/interfaces_mlppp_edit.php @@ -0,0 +1,180 @@ +. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +/* + pfSense_MODULE: interfaces +*/ + +##|+PRIV +##|*IDENT=page-interfaces-mlppp-edit +##|*NAME=Interfaces: mlppp: Edit page +##|*DESCR=Allow access to the 'Interfaces: mlppp: Edit' page. +##|*MATCH=interfaces_mlppp_edit.php* +##|-PRIV + +require("guiconfig.inc"); + +if (!is_array($config['mlppps']['mlppp'])) + $config['mlppps']['mlppp'] = array(); + +$a_mlppps = &$config['mlppps']['mlppp']; + +$portlist = get_interface_list(); + +$id = $_GET['id']; +if (isset($_POST['id'])) + $id = $_POST['id']; + +if (isset($id) && $a_mlppps[$id]) { + $pconfig['if'] = $a_mlppps[$id]['if']; + $pconfig['mlpppif'] = $a_mlppps[$id]['mlpppif']; + $pconfig['tag'] = $a_mlppps[$id]['tag']; + $pconfig['descr'] = $a_mlppps[$id]['descr']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "if tag"); + $reqdfieldsn = explode(",", "Parent interface,mlppp tag"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + if ($_POST['tag'] && (!is_numericint($_POST['tag']) || ($_POST['tag'] < '1') || ($_POST['tag'] > '4094'))) { + $input_errors[] = "The mlppp tag must be an integer between 1 and 4094."; + } + + foreach ($a_mlppps as $mlppp) { + if (isset($id) && ($a_mlppps[$id]) && ($a_mlppps[$id] === $mlppp)) + continue; + + if (($mlppp['if'] == $_POST['if']) && ($mlppp['tag'] == $_POST['tag'])) { + $input_errors[] = "A mlppp with the tag {$mlppp['tag']} is already defined on this interface."; + break; + } + } + if (is_array($config['qinqs']['qinqentry'])) { + foreach ($config['qinqs']['qinqentry'] as $qinq) + if ($qinq['tag'] == $_POST['tag'] && $qinq['if'] == $_POST['if']) + $input_errors[] = "A QinQ mlppp exists with this tag please remove it to use this tag with."; + } + + if (!$input_errors) { + $mlppp = array(); + $mlppp['if'] = $_POST['if']; + $mlppp['tag'] = $_POST['tag']; + $mlppp['descr'] = $_POST['descr']; + $mlppp['mlpppif'] = "{$_POST['if']}_mlppp{$_POST['tag']}"; + + $mlppp['mlpppif'] = interface_mlppp_configure($mlppp); + if ($mlppp['mlpppif'] == "" || !stristr($mlppp['mlpppif'], "mlppp")) + $input_errors[] = "Error occured creating interface, please retry."; + else { + if (isset($id) && $a_mlppps[$id]) + $a_mlppps[$id] = $mlppp; + else + $a_mlppps[] = $mlppp; + + write_config(); + + $confif = convert_real_interface_to_friendly_interface_name($mlppp['mlpppif']); + if ($confif <> "") + interface_configure($confif); + + header("Location: interfaces_mlppp.php"); + exit; + } + } +} + +$pgtitle = array("Firewall","mlppp","Edit"); +include("head.inc"); + +?> + + + + +
+ + + + + + + + + + + + + + + + + + + + +
mlppp configuration
Parent interface + +
+ Only mlppp capable interfaces will be shown.
mlppp tag + +
+ 802.1Q mlppp tag (between 1 and 4094)
Description + +
You may enter a description here + for your reference (not parsed).
  + + + + + +
+
+ + + From 57b053e94e966e4e9fe42596eebaa05421c98e6f Mon Sep 17 00:00:00 2001 From: gnhb Date: Tue, 30 Mar 2010 14:43:53 +0700 Subject: [PATCH 002/101] Add new menu name to other interfaces_* pages. --- usr/local/www/interfaces_assign.php | 5 +++-- usr/local/www/interfaces_bridge.php | 1 + usr/local/www/interfaces_gif.php | 1 + usr/local/www/interfaces_gre.php | 1 + usr/local/www/interfaces_groups.php | 1 + usr/local/www/interfaces_lagg.php | 1 + usr/local/www/interfaces_mlppp.php | 5 +++-- usr/local/www/interfaces_mlppp_edit.php | 11 +++++++---- usr/local/www/interfaces_ppp.php | 1 + usr/local/www/interfaces_qinq.php | 5 +++-- usr/local/www/interfaces_vlan.php | 5 +++-- usr/local/www/interfaces_wireless.php | 1 + 12 files changed, 26 insertions(+), 12 deletions(-) diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php index 663be60bdf..06a2f0bc8b 100755 --- a/usr/local/www/interfaces_assign.php +++ b/usr/local/www/interfaces_assign.php @@ -375,8 +375,9 @@ if(file_exists("/var/run/interface_mismatch_reboot_needed")) $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPP", false, "interfaces_ppp.php"); - $tab_array[6] = array("GRE", false, "interfaces_gre.php"); - $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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); diff --git a/usr/local/www/interfaces_bridge.php b/usr/local/www/interfaces_bridge.php index 9e009ba5b3..c27a3290d6 100644 --- a/usr/local/www/interfaces_bridge.php +++ b/usr/local/www/interfaces_bridge.php @@ -92,6 +92,7 @@ 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("PPP", false, "interfaces_ppp.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); diff --git a/usr/local/www/interfaces_gif.php b/usr/local/www/interfaces_gif.php index cd214e7b91..924ad1f155 100644 --- a/usr/local/www/interfaces_gif.php +++ b/usr/local/www/interfaces_gif.php @@ -91,6 +91,7 @@ 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("PPP", false, "interfaces_ppp.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); diff --git a/usr/local/www/interfaces_gre.php b/usr/local/www/interfaces_gre.php index 5ad7026e21..248d52086f 100644 --- a/usr/local/www/interfaces_gre.php +++ b/usr/local/www/interfaces_gre.php @@ -91,6 +91,7 @@ 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("PPP", false, "interfaces_ppp.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); diff --git a/usr/local/www/interfaces_groups.php b/usr/local/www/interfaces_groups.php index 65564ddcd9..afad3af8e9 100755 --- a/usr/local/www/interfaces_groups.php +++ b/usr/local/www/interfaces_groups.php @@ -77,6 +77,7 @@ 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("PPP", false, "interfaces_ppp.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); diff --git a/usr/local/www/interfaces_lagg.php b/usr/local/www/interfaces_lagg.php index 0beac77dd1..1ec48fb3a5 100644 --- a/usr/local/www/interfaces_lagg.php +++ b/usr/local/www/interfaces_lagg.php @@ -97,6 +97,7 @@ 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("PPP", false, "interfaces_ppp.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); diff --git a/usr/local/www/interfaces_mlppp.php b/usr/local/www/interfaces_mlppp.php index 389fbfe549..a5e5ba4567 100644 --- a/usr/local/www/interfaces_mlppp.php +++ b/usr/local/www/interfaces_mlppp.php @@ -93,8 +93,9 @@ 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("PPP", false, "interfaces_ppp.php"); - $tab_array[6] = array("GRE", false, "interfaces_gre.php"); - $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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); diff --git a/usr/local/www/interfaces_mlppp_edit.php b/usr/local/www/interfaces_mlppp_edit.php index 1d958fdd44..5c7b3a8f13 100644 --- a/usr/local/www/interfaces_mlppp_edit.php +++ b/usr/local/www/interfaces_mlppp_edit.php @@ -55,8 +55,11 @@ if (isset($_POST['id'])) if (isset($id) && $a_mlppps[$id]) { $pconfig['if'] = $a_mlppps[$id]['if']; $pconfig['mlpppif'] = $a_mlppps[$id]['mlpppif']; - $pconfig['tag'] = $a_mlppps[$id]['tag']; - $pconfig['descr'] = $a_mlppps[$id]['descr']; + $pconfig['username'] = $a_mlppps[$id]['username']; + $pconfig['password'] = $a_mlppps[$id]['password']; + $pconfig['service'] = $a_mlppps[$id]['service']; + $pconfig['ondemand'] = $a_mlppps[$id]['ondemand']; + $pconfig['timeout'] = $a_mlppps[$id]['timeout']; } if ($_POST) { @@ -117,7 +120,7 @@ if ($_POST) { } } -$pgtitle = array("Firewall","mlppp","Edit"); +$pgtitle = array("Interfaces","MLPPP","Edit"); include("head.inc"); ?> @@ -126,7 +129,7 @@ include("head.inc");
- +
diff --git a/usr/local/www/interfaces_ppp.php b/usr/local/www/interfaces_ppp.php index 41d36f91f3..1e9fae8113 100644 --- a/usr/local/www/interfaces_ppp.php +++ b/usr/local/www/interfaces_ppp.php @@ -90,6 +90,7 @@ 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("PPP", true, "interfaces_ppp.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); diff --git a/usr/local/www/interfaces_qinq.php b/usr/local/www/interfaces_qinq.php index 604d778ac2..6276f6e752 100755 --- a/usr/local/www/interfaces_qinq.php +++ b/usr/local/www/interfaces_qinq.php @@ -99,8 +99,9 @@ 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("PPP", false, "interfaces_ppp.php"); - $tab_array[6] = array("GRE", false, "interfaces_gre.php"); - $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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); diff --git a/usr/local/www/interfaces_vlan.php b/usr/local/www/interfaces_vlan.php index 0adfa7d230..6440020948 100755 --- a/usr/local/www/interfaces_vlan.php +++ b/usr/local/www/interfaces_vlan.php @@ -93,8 +93,9 @@ 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("PPP", false, "interfaces_ppp.php"); - $tab_array[6] = array("GRE", false, "interfaces_gre.php"); - $tab_array[7] = array("GIF", false, "interfaces_gif.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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); diff --git a/usr/local/www/interfaces_wireless.php b/usr/local/www/interfaces_wireless.php index f833fba581..180de39a01 100644 --- a/usr/local/www/interfaces_wireless.php +++ b/usr/local/www/interfaces_wireless.php @@ -91,6 +91,7 @@ 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("PPP", false, "interfaces_ppp.php"); + $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); From d02951e924a787c18a5cd941822b0236920df460 Mon Sep 17 00:00:00 2001 From: gnhb Date: Tue, 30 Mar 2010 18:28:19 +0700 Subject: [PATCH 003/101] Fix other interfaces_* pages and keep working with mlppp. --- usr/local/www/interfaces_assign.php | 10 ++-- usr/local/www/interfaces_bridge.php | 10 ++-- usr/local/www/interfaces_gif.php | 10 ++-- usr/local/www/interfaces_gre.php | 10 ++-- usr/local/www/interfaces_groups.php | 22 ++++----- usr/local/www/interfaces_lagg.php | 10 ++-- usr/local/www/interfaces_mlppp.php | 64 ++++++++++++------------- usr/local/www/interfaces_mlppp_edit.php | 59 ++++++++++++++++++++--- usr/local/www/interfaces_ppp.php | 10 ++-- usr/local/www/interfaces_qinq.php | 10 ++-- usr/local/www/interfaces_vlan.php | 10 ++-- usr/local/www/interfaces_wireless.php | 10 ++-- 12 files changed, 141 insertions(+), 94 deletions(-) diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php index 06a2f0bc8b..6d4dfe1508 100755 --- a/usr/local/www/interfaces_assign.php +++ b/usr/local/www/interfaces_assign.php @@ -375,11 +375,11 @@ if(file_exists("/var/run/interface_mismatch_reboot_needed")) $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPP", false, "interfaces_ppp.php"); - $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); + $tab_array[6] = array("MLPPP", false, "interfaces_mlppp.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"); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/interfaces_bridge.php b/usr/local/www/interfaces_bridge.php index c27a3290d6..e42e5e50f2 100644 --- a/usr/local/www/interfaces_bridge.php +++ b/usr/local/www/interfaces_bridge.php @@ -92,11 +92,11 @@ 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("PPP", false, "interfaces_ppp.php"); - $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); + $tab_array[6] = array("MLPPP", false, "interfaces_mlppp.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"); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/interfaces_gif.php b/usr/local/www/interfaces_gif.php index 924ad1f155..056fa84e8c 100644 --- a/usr/local/www/interfaces_gif.php +++ b/usr/local/www/interfaces_gif.php @@ -91,11 +91,11 @@ 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("PPP", false, "interfaces_ppp.php"); - $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); + $tab_array[6] = array("MLPPP", false, "interfaces_mlppp.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"); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/interfaces_gre.php b/usr/local/www/interfaces_gre.php index 248d52086f..8d72127303 100644 --- a/usr/local/www/interfaces_gre.php +++ b/usr/local/www/interfaces_gre.php @@ -91,11 +91,11 @@ 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("PPP", false, "interfaces_ppp.php"); - $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); + $tab_array[6] = array("MLPPP", false, "interfaces_mlppp.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"); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/interfaces_groups.php b/usr/local/www/interfaces_groups.php index afad3af8e9..6560a1258a 100755 --- a/usr/local/www/interfaces_groups.php +++ b/usr/local/www/interfaces_groups.php @@ -70,19 +70,19 @@ include("head.inc");
mlppp configuration
diff --git a/usr/local/www/interfaces_lagg.php b/usr/local/www/interfaces_lagg.php index 1ec48fb3a5..0bd1704a33 100644 --- a/usr/local/www/interfaces_lagg.php +++ b/usr/local/www/interfaces_lagg.php @@ -97,11 +97,11 @@ 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("PPP", false, "interfaces_ppp.php"); - $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); + $tab_array[6] = array("MLPPP", false, "interfaces_mlppp.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"); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/interfaces_mlppp.php b/usr/local/www/interfaces_mlppp.php index a5e5ba4567..b3990d3634 100644 --- a/usr/local/www/interfaces_mlppp.php +++ b/usr/local/www/interfaces_mlppp.php @@ -34,25 +34,25 @@ */ ##|+PRIV -##|*IDENT=page-interfaces-vlan -##|*NAME=Interfaces: VLAN page -##|*DESCR=Allow access to the 'Interfaces: VLAN' page. -##|*MATCH=interfaces_vlan.php* +##|*IDENT=page-interfaces-mlppp +##|*NAME=Interfaces: mlppp page +##|*DESCR=Allow access to the 'Interfaces: mlppp' page. +##|*MATCH=interfaces_mlppp.php* ##|-PRIV require("guiconfig.inc"); -if (!is_array($config['vlans']['vlan'])) - $config['vlans']['vlan'] = array(); +if (!is_array($config['mlppps']['mlppp'])) + $config['mlppps']['mlppp'] = array(); -$a_vlans = &$config['vlans']['vlan'] ; +$a_mlppps = &$config['mlppps']['mlppp'] ; -function vlan_inuse($num) { - global $config, $a_vlans; +function mlppp_inuse($num) { + global $config, $a_mlppps; $iflist = get_configured_interface_list(false, true); foreach ($iflist as $if) { - if ($config['interfaces'][$if]['if'] == $a_vlans[$num]['vlanif']) + if ($config['interfaces'][$if]['if'] == $a_mlppps[$num]['mlpppif']) return true; } @@ -61,21 +61,21 @@ function vlan_inuse($num) { if ($_GET['act'] == "del") { /* check if still in use */ - if (vlan_inuse($_GET['id'])) { - $input_errors[] = "This VLAN cannot be deleted because it is still being used as an interface."; + if (mlppp_inuse($_GET['id'])) { + $input_errors[] = "This interface cannot be deleted because it is still being used as an interface."; } else { - mwexec("/sbin/ifconfig " . $a_vlans[$_GET['id']]['vlanif'] . " destroy"); - unset($a_vlans[$_GET['id']]); + mwexec("/sbin/ifconfig " . $a_mlppps[$_GET['id']]['mlpppif'] . " destroy"); + unset($a_mlppps[$_GET['id']]); write_config(); - header("Location: interfaces_vlan.php"); + header("Location: interfaces_mlppp.php"); exit; } } -$pgtitle = array("Interfaces","VLAN"); +$pgtitle = array("Interfaces","MLPPP"); include("head.inc"); ?> @@ -90,14 +90,14 @@ include("head.inc"); $tab_array[0] = array("Interface assignments", false, "interfaces_assign.php"); $tab_array[1] = array("Interface Groups", false, "interfaces_groups.php"); $tab_array[2] = array("Wireless", false, "interfaces_wireless.php"); - $tab_array[3] = array("VLANs", true, "interfaces_vlan.php"); + $tab_array[3] = array("VLANs", false, "interfaces_vlan.php"); $tab_array[4] = array("QinQs", false, "interfaces_qinq.php"); $tab_array[5] = array("PPP", false, "interfaces_ppp.php"); - $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); + $tab_array[6] = array("MLPPP", true, "interfaces_mlppp.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"); display_top_tabs($tab_array); ?> @@ -107,34 +107,34 @@ include("head.inc");
- + - - + + - + - + diff --git a/usr/local/www/interfaces_mlppp_edit.php b/usr/local/www/interfaces_mlppp_edit.php index 5c7b3a8f13..744a6f202f 100644 --- a/usr/local/www/interfaces_mlppp_edit.php +++ b/usr/local/www/interfaces_mlppp_edit.php @@ -153,18 +153,65 @@ include("head.inc"); Only mlppp capable interfaces will be shown. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
You may enter a description here for your reference (not parsed). + diff --git a/usr/local/www/interfaces_ppp.php b/usr/local/www/interfaces_ppp.php index 1e9fae8113..0ef20f08d0 100644 --- a/usr/local/www/interfaces_ppp.php +++ b/usr/local/www/interfaces_ppp.php @@ -90,11 +90,11 @@ 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("PPP", true, "interfaces_ppp.php"); - $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); + $tab_array[6] = array("MLPPP", false, "interfaces_mlppp.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"); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/interfaces_qinq.php b/usr/local/www/interfaces_qinq.php index 6276f6e752..22ba5786e8 100755 --- a/usr/local/www/interfaces_qinq.php +++ b/usr/local/www/interfaces_qinq.php @@ -99,11 +99,11 @@ 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("PPP", false, "interfaces_ppp.php"); - $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); + $tab_array[6] = array("MLPPP", false, "interfaces_mlppp.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"); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/interfaces_vlan.php b/usr/local/www/interfaces_vlan.php index 6440020948..ab901e6ee4 100755 --- a/usr/local/www/interfaces_vlan.php +++ b/usr/local/www/interfaces_vlan.php @@ -93,11 +93,11 @@ 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("PPP", false, "interfaces_ppp.php"); - $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); + $tab_array[6] = array("MLPPP", false, "interfaces_mlppp.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"); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/interfaces_wireless.php b/usr/local/www/interfaces_wireless.php index 180de39a01..847dfe0c12 100644 --- a/usr/local/www/interfaces_wireless.php +++ b/usr/local/www/interfaces_wireless.php @@ -91,11 +91,11 @@ 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("PPP", false, "interfaces_ppp.php"); - $tab_array[5] = array("MLPPP", false, "interfaces_mlppp.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"); + $tab_array[6] = array("MLPPP", false, "interfaces_mlppp.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"); display_top_tabs($tab_array); ?> From 9abc78df94adba23d1cc2545388a4697ac5e662e Mon Sep 17 00:00:00 2001 From: gnhb Date: Wed, 31 Mar 2010 17:27:27 +0700 Subject: [PATCH 004/101] Select interfaces from a list instead of a dropdown. --- usr/local/www/interfaces_mlppp_edit.php | 46 +++++++++++++++++-------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/usr/local/www/interfaces_mlppp_edit.php b/usr/local/www/interfaces_mlppp_edit.php index 744a6f202f..93bd291624 100644 --- a/usr/local/www/interfaces_mlppp_edit.php +++ b/usr/local/www/interfaces_mlppp_edit.php @@ -47,6 +47,7 @@ if (!is_array($config['mlppps']['mlppp'])) $a_mlppps = &$config['mlppps']['mlppp']; $portlist = get_interface_list(); +$types = array("pppoe" => "PPPoE", "pptp" => "PPTP", "l2tp" => "LT2TP", "tcp" => "TCP", "udp" => "UDP", "ng" => "Netgraph" /* , "carpdev-dhcp" => "CarpDev"*/); $id = $_GET['id']; if (isset($_POST['id'])) @@ -130,28 +131,45 @@ include("head.inc");
InterfaceVLAN tagmlppp tag Description
- + - + -   +   -   +  
 

Note:
- Not all drivers/NICs support 802.1Q VLAN tagging properly. On cards that do not explicitly support it, VLAN tagging will still work, but the reduced MTU may cause problems. See the handbook for information on supported cards.

+ Not all drivers/NICs support 802.1Q mlppp tagging properly. On cards that do not explicitly support it, mlppp tagging will still work, but the reduced MTU may cause problems. See the handbook for information on supported cards.

 
mlppp tag Username - -
- 802.1Q mlppp tag (between 1 and 4094)
Password + +
Service + +
Bandwidth +  (bits/sec) +
Set Bandwidth for each link if links have different bandwidths, otherwise, leave blank. +
Link MTU + +
Set Bandwidth for each link if links have different bandwidths, otherwise, leave blank. +
Link MRU + +
Set Bandwidth for each link if links have different bandwidths, otherwise, leave blank. +
Dial On Demand + > Enable Dial-on-Demand mode +
This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection. + The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected. +
Idle Timeout + +
Idle Timeout goes with the OnDemand selection above. If OnDemand is not checked this is ignored. +
Description -
You may enter a description here - for your reference (not parsed).
 
- - + + - + - +
Interfaces participating in the multilink connection. + + + + + + - + + - - + - - + + + + + + - - - - + + + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + @@ -491,25 +477,25 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" - + - - + + - - + + @@ -696,31 +682,34 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" - - + - + + + - - + - + - */?> - + @@ -730,7 +719,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" From 5ae3c9d00edae8dca65a9156f2a8aeaaa1478398 Mon Sep 17 00:00:00 2001 From: gnhb Date: Mon, 5 Apr 2010 18:53:52 +0700 Subject: [PATCH 008/101] Working again. --- usr/local/www/interfaces_mlppp_edit.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/usr/local/www/interfaces_mlppp_edit.php b/usr/local/www/interfaces_mlppp_edit.php index 75bddf88d2..9fe0aa6f1a 100644 --- a/usr/local/www/interfaces_mlppp_edit.php +++ b/usr/local/www/interfaces_mlppp_edit.php @@ -118,9 +118,8 @@ if (isset($id) && $a_ppps[$id]) { break; } } - } - - + } + } } if ($_POST) { @@ -727,4 +726,4 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" - + \ No newline at end of file From fd7ef955ffd6a932efaeae1a66cc75299808b0d7 Mon Sep 17 00:00:00 2001 From: gnhb Date: Mon, 5 Apr 2010 20:45:29 +0700 Subject: [PATCH 009/101] Improved formatting, and only one localip and gateway field for both PPP and PPTP. --- usr/local/www/interfaces_mlppp_edit.php | 43 ++++++++++++------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/usr/local/www/interfaces_mlppp_edit.php b/usr/local/www/interfaces_mlppp_edit.php index 9fe0aa6f1a..fc8b53fb6b 100644 --- a/usr/local/www/interfaces_mlppp_edit.php +++ b/usr/local/www/interfaces_mlppp_edit.php @@ -304,6 +304,8 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" document.getElementById("pptp").style.display = 'none'; document.getElementById("interface").style.display = 'none'; document.getElementById("serialport").style.display = 'none'; + document.getElementById("ipfields").style.display = 'none'; + document.getElementById("subnet").style.display = 'none'; break; } case "ppp": { @@ -312,6 +314,8 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" document.getElementById("pptp").style.display = 'none'; document.getElementById("interface").style.display = 'none'; document.getElementById("serialport").style.display = ''; + document.getElementById("ipfields").style.display = ''; + document.getElementById("subnet").style.display = 'none'; break; } case "pppoe": { @@ -320,14 +324,17 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" document.getElementById("pptp").style.display = 'none'; document.getElementById("interface").style.display = 'none'; document.getElementById("serialport").style.display = 'none'; + document.getElementById("ipfields").style.display = 'none'; break; } case "pptp": { document.getElementById("select").style.display = 'none'; document.getElementById("ppp").style.display = 'none'; document.getElementById("pppoe").style.display = 'none'; - document.getElementById("interface").style.display = 'none'; + document.getElementById("interface").style.display = ''; document.getElementById("serialport").style.display = 'none'; + document.getElementById("ipfields").style.display = ''; + document.getElementById("subnet").style.display = ''; break; } } @@ -459,13 +466,13 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" @@ -548,21 +555,6 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
Note: Typically (*99# or *99***# or *99***1#) for GSM networks and *777 for CDMA networks - - - - - - - - - +
mlppp configuration
MLPPP configuration
Parent interfaceMember interfaces - $ifinfo) + + foreach ($portlist as $ifn => $ifinfo) if (is_jumbo_capable($ifn)) { echo ""; + echo htmlspecialchars($ifn . " (" . $ifinfo['mac'] . ")"); + echo ""; } - ?> + ?> -
- Only mlppp capable interfaces will be shown.
Type + +
Username @@ -192,7 +210,8 @@ include("head.inc");
Dial On Demand
Dial On Demand > Enable Dial-on-Demand mode
This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection. @@ -213,8 +232,7 @@ include("head.inc");
You may enter a description here for your reference (not parsed).
   From 4b32eb9deb765ae8624e0f5322e459a0aea9097e Mon Sep 17 00:00:00 2001 From: gnhb Date: Thu, 1 Apr 2010 12:04:44 +0700 Subject: [PATCH 005/101] More work on interfaces_ppp_edit.php --- usr/local/www/interfaces_mlppp_edit.php | 398 ++++++++++++++++++++---- 1 file changed, 331 insertions(+), 67 deletions(-) diff --git a/usr/local/www/interfaces_mlppp_edit.php b/usr/local/www/interfaces_mlppp_edit.php index 93bd291624..1b81368ada 100644 --- a/usr/local/www/interfaces_mlppp_edit.php +++ b/usr/local/www/interfaces_mlppp_edit.php @@ -47,7 +47,6 @@ if (!is_array($config['mlppps']['mlppp'])) $a_mlppps = &$config['mlppps']['mlppp']; $portlist = get_interface_list(); -$types = array("pppoe" => "PPPoE", "pptp" => "PPTP", "l2tp" => "LT2TP", "tcp" => "TCP", "udp" => "UDP", "ng" => "Netgraph" /* , "carpdev-dhcp" => "CarpDev"*/); $id = $_GET['id']; if (isset($_POST['id'])) @@ -120,12 +119,113 @@ if ($_POST) { } } } - +$closehead = false; $pgtitle = array("Interfaces","MLPPP","Edit"); include("head.inc"); +$types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP"/*, "l2tp" => "L2TP", "tcp" => "TCP", "udp" => "UDP", "ng" => "Netgraph" */); + ?> + + @@ -135,41 +235,61 @@ include("head.inc"); MLPPP configuration
Member interfaces - -
Interfaces participating in the multilink connection. -
Link Type + +
Type - -
Username @@ -181,37 +301,15 @@ include("head.inc");
Service - -
Bandwidth -  (bits/sec) -
Set Bandwidth for each link if links have different bandwidths, otherwise, leave blank. -
Link MTU - -
Set Bandwidth for each link if links have different bandwidths, otherwise, leave blank. -
Link MRU - -
Set Bandwidth for each link if links have different bandwidths, otherwise, leave blank. -
Dial On DemandGateway + >This link will be used as the default gateway. +
Dial On Demand > Enable Dial-on-Demand mode
This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection. @@ -232,9 +330,175 @@ include("head.inc");
You may enter a description here for your reference (not parsed).
Advanced Options -
+ + + + + + + + + + + + + +
Bandwidth +  (bits/sec) +
Set Bandwidth for each link if links have different bandwidths, otherwise, leave blank. +
Link MTU + +
Set Bandwidth for each link if links have different bandwidths, otherwise, leave blank. +
Link MRU + +
Set Bandwidth for each link if links have different bandwidths, otherwise, leave blank. +
+
  - + From 80bc7a5c0c8f9661825767392ec9a118de711288 Mon Sep 17 00:00:00 2001 From: gnhb Date: Sun, 4 Apr 2010 21:47:14 +0700 Subject: [PATCH 006/101] Still working on GUI for mlppp. . . --- usr/local/www/interfaces_gif.php | 2 +- usr/local/www/interfaces_mlppp_edit.php | 499 +++++++++++++++++------- 2 files changed, 365 insertions(+), 136 deletions(-) diff --git a/usr/local/www/interfaces_gif.php b/usr/local/www/interfaces_gif.php index 056fa84e8c..ad33234293 100644 --- a/usr/local/www/interfaces_gif.php +++ b/usr/local/www/interfaces_gif.php @@ -73,7 +73,7 @@ if ($_GET['act'] == "del") { } } -$pgtitle = array("Interfaces","gif"); +$pgtitle = array("Interfaces","GIF"); include("head.inc"); ?> diff --git a/usr/local/www/interfaces_mlppp_edit.php b/usr/local/www/interfaces_mlppp_edit.php index 1b81368ada..a31bde0f7d 100644 --- a/usr/local/www/interfaces_mlppp_edit.php +++ b/usr/local/www/interfaces_mlppp_edit.php @@ -6,6 +6,8 @@ Copyright (C) 2003-2004 Manuel Kasper . All rights reserved. + Copyright (C) 2010 Gabriel B. . + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -41,10 +43,10 @@ require("guiconfig.inc"); -if (!is_array($config['mlppps']['mlppp'])) - $config['mlppps']['mlppp'] = array(); +if (!is_array($config['ppps']['ppp'])) + $config['ppps']['ppp'] = array(); -$a_mlppps = &$config['mlppps']['mlppp']; +$a_ppps = &$config['ppps']['ppp']; $portlist = get_interface_list(); @@ -52,115 +54,289 @@ $id = $_GET['id']; if (isset($_POST['id'])) $id = $_POST['id']; -if (isset($id) && $a_mlppps[$id]) { - $pconfig['if'] = $a_mlppps[$id]['if']; - $pconfig['mlpppif'] = $a_mlppps[$id]['mlpppif']; - $pconfig['username'] = $a_mlppps[$id]['username']; - $pconfig['password'] = $a_mlppps[$id]['password']; - $pconfig['service'] = $a_mlppps[$id]['service']; - $pconfig['ondemand'] = $a_mlppps[$id]['ondemand']; - $pconfig['timeout'] = $a_mlppps[$id]['timeout']; +if (isset($id) && $a_ppps[$id]) { + $pconfig['type'] = $a_ppps[$id]['type']; + $pconfig['username'] = $a_ppps[$id]['username']; + $pconfig['password'] = $a_ppps[$id]['password']; + if (isset($a_ppps[$id]['defaultgw'])) + $pconfig['defaultgw'] = true; + $pconfig['ondemand'] = $a_ppps[$id]['ondemand']; + $pconfig['idletimeout'] = $a_ppps[$id]['idletimeout']; + $pconfig['descr'] = $a_ppps[$id]['descr']; + if ($a_ppps[$id]['type'] == "ppp") { + $pconfig['serialports'] = $a_ppps[$id]['serialports']; + $pconfig['initstr'] = base64_decode($a_ppps[$id]['initstr']); + $pconfig['simpin'] = $a_ppps[$id]['simpin']; + $pconfig['pin-wait'] = $a_ppps[$id]['pin-wait']; + $pconfig['apn'] = $a_ppps[$id]['apn']; + $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']; + } + if ($a_ppps[$id]['type'] == "pptp") { + $pconfig['interfaces'] = $a_ppps[$id]['interfaces']; + $pconfig['localip'] = $a_ppps[$id]['localip']; + $pconfig['subnet'] = $a_ppps[$id]['subnet']; + $pconfig['gateway'] = $a_ppps[$id]['gateway']; + } + if ($a_ppps[$id]['type'] == "pppoe") { + $pconfig['interfaces'] = $a_ppps[$id]['interfaces']; + $pconfig['provider']; + /* ================================================ */ + /* = force a connection reset at a specific time? = */ + /* ================================================ */ + + if (isset($wancfg['pppoe']['pppoe-reset-type'])) { + $resetTime = getMPDResetTimeFromConfig(); + $pconfig['pppoe_preset'] = true; + if ($wancfg['pppoe']['pppoe-reset-type'] == "custom") { + $resetTime_a = split(" ", $resetTime); + $pconfig['pppoe_pr_custom'] = true; + $pconfig['pppoe_resetminute'] = $resetTime_a[0]; + $pconfig['pppoe_resethour'] = $resetTime_a[1]; + /* just initialize $pconfig['pppoe_resetdate'] if the + * coresponding item contains appropriate numeric values. + */ + if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*") + $pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y"); + } else if ($wancfg['pppoe']['pppoe-reset-type'] == "preset") { + $pconfig['pppoe_pr_preset'] = true; + switch ($resetTime) { + case CRON_MONTHLY_PATTERN: + $pconfig['pppoe_monthly'] = true; + break; + case CRON_WEEKLY_PATTERN: + $pconfig['pppoe_weekly'] = true; + break; + case CRON_DAILY_PATTERN: + $pconfig['pppoe_daily'] = true; + break; + case CRON_HOURLY_PATTERN: + $pconfig['pppoe_hourly'] = true; + break; + } + } + } + + } if ($_POST) { unset($input_errors); $pconfig = $_POST; - - /* input validation */ - $reqdfields = explode(" ", "if tag"); - $reqdfieldsn = explode(",", "Parent interface,mlppp tag"); - - do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - - if ($_POST['tag'] && (!is_numericint($_POST['tag']) || ($_POST['tag'] < '1') || ($_POST['tag'] > '4094'))) { - $input_errors[] = "The mlppp tag must be an integer between 1 and 4094."; + + /* filter out spaces from descriptions */ + $_POST['descr'] = remove_bad_chars($_POST['descr']); + /* okay first of all, cause we are just hiding the PPPoE HTML + * fields releated to PPPoE resets, we are going to unset $_POST + * vars, if the reset feature should not be used. Otherwise the + * data validation procedure below, may trigger a false error + * message. + */ + if (empty($_POST['pppoe_preset'])) { + unset($_POST['pppoe_pr_type']); + unset($_POST['pppoe_resethour']); + unset($_POST['pppoe_resetminute']); + unset($_POST['pppoe_resetdate']); + unset($_POST['pppoe_pr_preset_val']); } - foreach ($a_mlppps as $mlppp) { - if (isset($id) && ($a_mlppps[$id]) && ($a_mlppps[$id] === $mlppp)) + /* input validation */ + + switch($_POST['type']) { + case "PPP": + $reqdfields = explode(" ", "serialports, phone"); + $reqdfieldsn = explode(",", "Serial Port(s), Phone Number"); + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + break; + case "PPPoE": + if ($_POST['ondemand']) { + $reqdfields = explode(" ", "interfaces username password dialondemand idletimeout"); + $reqdfieldsn = explode(",", "Link Interface(s),PPPoE username,PPPoE password,Dial on demand,Idle timeout value"); + } else { + $reqdfields = explode(" ", "interfaces username password"); + $reqdfieldsn = explode(",", "Link Interface(s),PPPoE username,PPPoE password"); + } + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + break; + case "PPTP": + if ($_POST['ondemand']) { + $reqdfields = explode(" ", "interfaces username password localip subnet gateway dialondemand idletimeout"); + $reqdfieldsn = explode(",", "Link Interface(s),PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value"); + } else { + $reqdfields = explode(" ", "interfaces username password localip subnet gateway"); + $reqdfieldsn = explode(",", "Link Interface(s),PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address"); + } + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + break; + } + if (($_POST['provider'] && !is_domain($_POST['provider']))) + $input_errors[] = "The service name contains invalid characters."; + if (($_POST['idletimeout'] != "") && !is_numericint($_POST['idletimeout'])) + $input_errors[] = "The idle timeout value must be an integer."; + if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) && + $_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23) + $input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23)."); + if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) && + $_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59) + $input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59)."); + if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) + $input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy)."); + 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['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 ($a_ppps as $ppp) { + if (isset($id) && ($a_ppps[$id]) && ($a_ppps[$id] === $ppp)) continue; - if (($mlppp['if'] == $_POST['if']) && ($mlppp['tag'] == $_POST['tag'])) { - $input_errors[] = "A mlppp with the tag {$mlppp['tag']} is already defined on this interface."; + if ($ppp['serialport'] == $_POST['serialport']) { + $input_errors[] = "Port is in use"; break; } } - if (is_array($config['qinqs']['qinqentry'])) { - foreach ($config['qinqs']['qinqentry'] as $qinq) - if ($qinq['tag'] == $_POST['tag'] && $qinq['if'] == $_POST['if']) - $input_errors[] = "A QinQ mlppp exists with this tag please remove it to use this tag with."; - } + */ if (!$input_errors) { - $mlppp = array(); - $mlppp['if'] = $_POST['if']; - $mlppp['tag'] = $_POST['tag']; - $mlppp['descr'] = $_POST['descr']; - $mlppp['mlpppif'] = "{$_POST['if']}_mlppp{$_POST['tag']}"; - - $mlppp['mlpppif'] = interface_mlppp_configure($mlppp); - if ($mlppp['mlpppif'] == "" || !stristr($mlppp['mlpppif'], "mlppp")) - $input_errors[] = "Error occured creating interface, please retry."; - else { - if (isset($id) && $a_mlppps[$id]) - $a_mlppps[$id] = $mlppp; - else - $a_mlppps[] = $mlppp; - - write_config(); - - $confif = convert_real_interface_to_friendly_interface_name($mlppp['mlpppif']); - if ($confif <> "") - interface_configure($confif); + $ppp = array(); + $ppp['type'] = $_POST['type']; + $ppp['username'] = $_POST['username']; + $ppp['password'] = $_POST['password']; + $ppp['defaultgw'] = $_POST['defaultgw'] ? true : false; + /* if ($_POST['defaultgw'] == "on") + $ppp['defaultgw'] = true; + else + unset($ppp['defaultgw']); + */ + $ppp['ondemand'] = $_POST['ondemand'] ? true : false; + if ($_POST['ondemand']) + $ppp['idletimeout'] = $_POST['idletimeout']; + else + unset($ppp['idletimeout']); + $ppp['descr'] = $_POST['descr']; + switch($_POST['type']) { + case "ppp": + $ppp['ipaddr'] = "ppp"; + $ppp['serialports'] = implode(',', $_POST['serialports']); + if (!empty($_POST['initstr'])) + $ppp['initstr'] = base64_encode($_POST['initstr']); + else + unset($ppp['initstr']); + if (!empty($_POST['simpin'])) { + $ppp['simpin'] = $_POST['simpin']; + $ppp['pin-wait'] = $_POST['pin-wait']; + } else { + unset($ppp['simpin']); + unset($ppp['pin-wait']); + } - header("Location: interfaces_mlppp.php"); - exit; + if (!empty($_POST['apn'])){ + $ppp['apn'] = $_POST['apn']; + if (!empty($_POST['apnum'])) + $ppp['apnum'] = $_POST['apnum']; + else + $ppp['apnum'] = "1"; + } else { + unset($ppp['apn']); + unset($ppp['apnum']); + } + $ppp['phone'] = $_POST['phone']; + $ppp['localip'] = $_POST['localip']; + $ppp['gateway'] = $_POST['gateway']; + if (!empty($_POST['connect-timeout'])) + $ppp['connect-timeout'] = $_POST['connect-timeout']; + else + unset($ppp['connect-timeout']); + break; + case "pppoe": + $ppp['ipaddr'] = "pppoe"; + $ppp['interfaces'] = implode(',', $_POST['interfaces']); + $ppp['provider'] = $_POST['provider']; + break; + case "pptp": + $ppp['ipaddr'] = "pptp"; + $ppp['interfaces'] = implode(',', $_POST['interfaces']); + $ppp['localip'] = $_POST['localip']; + $ppp['subnet'] = $_POST['subnet']; + $ppp['gateway'] = $_POST['gateway']; + break; } + $iflist = get_configured_interface_list(); + foreach ($iflist as $if) { + if ($config['interfaces'][$if]['if'] == basename($a_ppps[$id]['port'])) + $config['interfaces'][$if]['if'] = basename($ppp['port']); + } + + if (isset($id) && $a_ppps[$id]) + $a_ppps[$id] = $ppp; + else + $a_ppps[] = $ppp; + + write_config(); + + header("Location: interfaces_mlppp.php"); + exit; } } + $closehead = false; $pgtitle = array("Interfaces","MLPPP","Edit"); include("head.inc"); -$types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP"/*, "l2tp" => "L2TP", "tcp" => "TCP", "udp" => "UDP", "ng" => "Netgraph" */); +$types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP"/*, "l2tp" => "L2TP", "tcp" => "TCP", "udp" => "UDP", "ng" => "Netgraph" */ ); ?> @@ -472,16 +458,16 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
Username - - Username + +
Password - - Password + +
Gateway
Dial On Demand - > Enable Dial-on-Demand mode -
This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection. - The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected. -
+ > Enable Dial-on-Demand mode +
This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection. + The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected. +
Idle Timeout - -
Idle Timeout goes with the OnDemand selection above. If OnDemand is not checked this is ignored. -
Idle Timeout + +
Idle Timeout goes with the OnDemand selection above. If OnDemand is not checked this is ignored. +
Description - -
You may enter a description here for your reference (not parsed). -
Description + +
You may enter a description here for your reference (not parsed). +
Advanced Options
Options - >Disable vjcomp(compression). + Compression + > Disable vjcomp(compression). - >Enable tcpmssfix. +
TCPmssfix + > Enable tcpmssfix.
Bandwidth -  (bits/sec) -
Set Bandwidth for each link *if* links have different bandwidths, otherwise, leave blank. +  (bits/sec) +
Set Bandwidth for each link if links have different bandwidths, otherwise, leave blank.
Link MTU/MRU + Link MTU
Set MTU for each link if links have different bandwidths, otherwise, leave blank.
Link MRU + Link MRU
Set MRU for each link separated by commas, otherwise, leave blank.
- +
Username - +
Password - +
Local IP - -
Note: Enter your IP address here if it is not automatically assigned. -
Remote IP (Gateway) - -
Note: Enter the remote IP here if not automatically assigned. This is where the packets will be routed. -
Connection Timeout @@ -651,29 +643,36 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp"
PPTP configuration
+ + + + + - + - +
Local IP addressLocal IP address / - 0; $i--): ?> +
Note: Enter the local IP here if not automatically assigned. Subnet is ignored for PPP connections.
Remote IP addressRemote IP (Gateway) +
Note: Enter the remote IP here if not automatically assigned. This is where the packets will be routed.
- From e51cea69a05c68356ec480350a0740c045b97e5b Mon Sep 17 00:00:00 2001 From: gnhb Date: Fri, 9 Apr 2010 10:48:13 +0700 Subject: [PATCH 010/101] onLoad still not working .. . --- usr/local/www/interfaces_mlppp.php | 56 ++++++-------- usr/local/www/interfaces_mlppp_edit.php | 98 ++++++++++++++++--------- 2 files changed, 84 insertions(+), 70 deletions(-) diff --git a/usr/local/www/interfaces_mlppp.php b/usr/local/www/interfaces_mlppp.php index b3990d3634..0f3f1ed90e 100644 --- a/usr/local/www/interfaces_mlppp.php +++ b/usr/local/www/interfaces_mlppp.php @@ -42,40 +42,34 @@ require("guiconfig.inc"); -if (!is_array($config['mlppps']['mlppp'])) - $config['mlppps']['mlppp'] = array(); +if (!is_array($config['ppps']['ppp'])) + $config['ppps']['ppp'] = array(); -$a_mlppps = &$config['mlppps']['mlppp'] ; - -function mlppp_inuse($num) { - global $config, $a_mlppps; +$a_ppps = &$config['ppps']['ppp'] ; +function ppp_inuse($num) { + global $config, $g, $a_ppps; $iflist = get_configured_interface_list(false, true); foreach ($iflist as $if) { - if ($config['interfaces'][$if]['if'] == $a_mlppps[$num]['mlpppif']) + if ($config['interfaces'][$if]['if'] == $a_ppps[$num]['port']) return true; } - return false; } if ($_GET['act'] == "del") { /* check if still in use */ - if (mlppp_inuse($_GET['id'])) { - $input_errors[] = "This interface cannot be deleted because it is still being used as an interface."; + if (ppp_inuse($_GET['id'])) { + $input_errors[] = "This MLPPP interface cannot be deleted because it is still being used as an interface."; } else { - mwexec("/sbin/ifconfig " . $a_mlppps[$_GET['id']]['mlpppif'] . " destroy"); - unset($a_mlppps[$_GET['id']]); - + unset($a_ppps[$_GET['id']]); write_config(); - header("Location: interfaces_mlppp.php"); exit; } } - -$pgtitle = array("Interfaces","MLPPP"); +$pgtitle = "Interfaces: MLPPP"; include("head.inc"); ?> @@ -106,37 +100,29 @@ include("head.inc");
- - - + + + - - - + +   - - - - - +
Interfacemlppp tagDescriptionTypeInterface(s)/Port(s)Description
- + $ppp): ?> +
+ - + -   +   -  
 

- Note:
-
- Not all drivers/NICs support 802.1Q mlppp tagging properly. On cards that do not explicitly support it, mlppp tagging will still work, but the reduced MTU may cause problems. See the handbook for information on supported cards.

-
 
diff --git a/usr/local/www/interfaces_mlppp_edit.php b/usr/local/www/interfaces_mlppp_edit.php index fc8b53fb6b..1f95df2354 100644 --- a/usr/local/www/interfaces_mlppp_edit.php +++ b/usr/local/www/interfaces_mlppp_edit.php @@ -43,6 +43,10 @@ require("guiconfig.inc"); +function remove_bad_chars($string) { + return preg_replace('/[^a-z|_|0-9]/i','',$string); +} + if (!is_array($config['ppps']['ppp'])) $config['ppps']['ppp'] = array(); @@ -60,11 +64,20 @@ if (isset($id) && $a_ppps[$id]) { $pconfig['password'] = $a_ppps[$id]['password']; if (isset($a_ppps[$id]['defaultgw'])) $pconfig['defaultgw'] = true; - $pconfig['ondemand'] = $a_ppps[$id]['ondemand']; - $pconfig['idletimeout'] = $a_ppps[$id]['idletimeout']; + if (isset($a_ppps[$id]['ondemand'])){ + $pconfig['ondemand'] = true; + $pconfig['idletimeout'] = $a_ppps[$id]['idletimeout']; + } $pconfig['descr'] = $a_ppps[$id]['descr']; + if (isset($a_ppps[$id]['vjcomp'])) + $pconfig['vjcomp'] = true; + if (isset($a_ppps[$id]['tcpmssfix'])) + $pconfig['tcpmssfix'] = true; + $pconfig['bandwidth'] = $a_ppps[$id]['bandwidth']; + $pconfig['mtu'] = $a_ppps[$id]['mtu']; + $pconfig['mru'] = $a_ppps[$id]['mru']; if ($a_ppps[$id]['type'] == "ppp") { - $pconfig['serialports'] = $a_ppps[$id]['serialports']; + $pconfig['serialports'] = $a_ppps[$id]['ports']; $pconfig['initstr'] = base64_decode($a_ppps[$id]['initstr']); $pconfig['simpin'] = $a_ppps[$id]['simpin']; $pconfig['pin-wait'] = $a_ppps[$id]['pin-wait']; @@ -76,14 +89,14 @@ if (isset($id) && $a_ppps[$id]) { $pconfig['gateway'] = $a_ppps[$id]['gateway']; } if ($a_ppps[$id]['type'] == "pptp") { - $pconfig['interfaces'] = $a_ppps[$id]['interfaces']; + $pconfig['interfaces'] = $a_ppps[$id]['ports']; $pconfig['localip'] = $a_ppps[$id]['localip']; $pconfig['subnet'] = $a_ppps[$id]['subnet']; $pconfig['gateway'] = $a_ppps[$id]['gateway']; } if ($a_ppps[$id]['type'] == "pppoe") { - $pconfig['interfaces'] = $a_ppps[$id]['interfaces']; - $pconfig['provider']; + $pconfig['interfaces'] = $a_ppps[$id]['ports']; + $pconfig['provider'] = $a_ppps[$id]['provider']; /* ================================================ */ /* = force a connection reset at a specific time? = */ /* ================================================ */ @@ -119,7 +132,8 @@ if (isset($id) && $a_ppps[$id]) { } } } - } + } + } if ($_POST) { @@ -195,17 +209,17 @@ if ($_POST) { $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 ($a_ppps as $ppp) { if (isset($id) && ($a_ppps[$id]) && ($a_ppps[$id] === $ppp)) continue; if ($ppp['serialport'] == $_POST['serialport']) { - $input_errors[] = "Port is in use"; + $input_errors[] = "Serial port is in use"; break; } } - +*/ if (!$input_errors) { $ppp = array(); @@ -213,20 +227,9 @@ if ($_POST) { $ppp['username'] = $_POST['username']; $ppp['password'] = $_POST['password']; $ppp['defaultgw'] = $_POST['defaultgw'] ? true : false; - if ($_POST['defaultgw'] == "on") - $ppp['defaultgw'] = true; - else - unset($ppp['defaultgw']); - - $ppp['ondemand'] = $_POST['ondemand'] ? true : false; - if ($_POST['ondemand']) - $ppp['idletimeout'] = $_POST['idletimeout']; - else - unset($ppp['idletimeout']); - $ppp['descr'] = $_POST['descr']; switch($_POST['type']) { case "ppp": - $ppp['serialports'] = implode(',', $_POST['serialports']); + $ppp['ports'] = implode(',', $_POST['serialports']); if (!empty($_POST['initstr'])) $ppp['initstr'] = base64_encode($_POST['initstr']); else @@ -249,31 +252,57 @@ if ($_POST) { unset($ppp['apn']); unset($ppp['apnum']); } - $ppp['phone'] = $_POST['phone']; - $ppp['localip'] = $_POST['localip']; - $ppp['gateway'] = $_POST['gateway']; + $ppp['phone'] = $_POST['phone']; + if (!empty($_POST['localip'])) + $ppp['localip'] = $_POST['localip']; + else + unset($ppp['localip']); + if (!empty($_POST['gateway'])) + $ppp['gateway'] = $_POST['gateway']; + else + unset($ppp['gateway']); if (!empty($_POST['connect-timeout'])) $ppp['connect-timeout'] = $_POST['connect-timeout']; else unset($ppp['connect-timeout']); break; case "pppoe": - $ppp['interfaces'] = implode(',', $_POST['interfaces']); - $ppp['provider'] = $_POST['provider']; + $ppp['ports'] = implode(',', $_POST['interfaces']); + if (!empty($_POST['provider'])) + $ppp['provider'] = $_POST['provider']; + else + unset($ppp['provider']); break; case "pptp": - $ppp['interfaces'] = implode(',', $_POST['interfaces']); + $ppp['ports'] = implode(',', $_POST['interfaces']); $ppp['localip'] = $_POST['localip']; $ppp['subnet'] = $_POST['subnet']; $ppp['gateway'] = $_POST['gateway']; break; } + if (!empty($_POST['descr'])) + $ppp['descr'] = $_POST['descr']; + else + unset($ppp['descr']); + $ppp['ondemand'] = $_POST['ondemand'] ? true : false; + if (isset($ppp['ondemand'])) + $ppp['idletimeout'] = $_POST['idletimeout']; + else + unset($ppp['idletimeout']); + $ppp['vjcomp'] = $_POST['vjcomp'] ? true : false; + $ppp['tcpmssfix'] = $_POST['tcpmssfix'] ? true : false; + if (isset($_POST['bandwidth'])) + $ppp['bandwidth'] = $_POST['bandwidth']; + else + unset($ppp['bandwidth']); + $iflist = get_configured_interface_list(); + /* foreach ($iflist as $if) { if ($config['interfaces'][$if]['if'] == basename($a_ppps[$id]['port'])) $config['interfaces'][$if]['if'] = basename($ppp['port']); } - + */ if (isset($id) && $a_ppps[$id]) $a_ppps[$id] = $ppp; else @@ -305,7 +334,6 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" document.getElementById("interface").style.display = 'none'; document.getElementById("serialport").style.display = 'none'; document.getElementById("ipfields").style.display = 'none'; - document.getElementById("subnet").style.display = 'none'; break; } case "ppp": { @@ -322,7 +350,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" document.getElementById("select").style.display = 'none'; document.getElementById("ppp").style.display = 'none'; document.getElementById("pptp").style.display = 'none'; - document.getElementById("interface").style.display = 'none'; + document.getElementById("interface").style.display = ''; document.getElementById("serialport").style.display = 'none'; document.getElementById("ipfields").style.display = 'none'; break; @@ -394,7 +422,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" - +)">
@@ -405,7 +433,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" Link Type - $opt) { echo "