commit 0ec2fdf0ad985ff390c6230f375e88cde5a4d61b
Author: Ermal Luçi <eri@pfsense.org>
Date:   Mon Mar 16 23:48:03 2009 +0000

    * Introduce interface groups. For now they are availble only on Firewall:Rules section maybe it would be usable to have tham on nat too.
    * Some fixes and cleanup.

diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 95f7824d15..8f7932d539 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -408,11 +408,11 @@ function generate_optcfg_array()
 		$oic['if'] = 'pptp';
 		$oic['descr'] = 'PPTP';
 		$oic['ip'] = $config['pptpd']['localip'];
-		$oc['sa'] = $config['pptpd']['remoteip'];
-		$oc['sn'] = $g['pptp_subnet'];
-		$oc['virtual'] = true;
+		$oic['sa'] = $config['pptpd']['remoteip'];
+		$oic['sn'] = $g['pptp_subnet'];
+		$oic['virtual'] = true;
 		if($config['pptpd']['pptp_subnet'] <> "")
-			$oc['sn'] = $config['pptpd']['pptp_subnet'];
+			$oic['sn'] = $config['pptpd']['pptp_subnet'];
 		$FilterIflist['pptp'] = $oic;
 	}
 	if ($config['l2tp']['mode'] == "server") {
@@ -420,20 +420,20 @@ function generate_optcfg_array()
                 $oic['if'] = 'l2tp';
                 $oic['descr'] = 'L2TP';
                 $oic['ip'] = $config['l2tp']['localip'];
-                $oc['sa'] = $config['l2tp']['remoteip'];
-                $oc['virtual'] = true;
+                $oic['sa'] = $config['l2tp']['remoteip'];
+                $oic['virtual'] = true;
                 $FilterIflist['l2tp'] = $oic;
         }
 	if ($config['pppoe']['mode'] == "server") {
 		$oic = array();
 		$oic['if'] = 'pppoe';
 		$oic['descr'] = 'PPPoE';
-		$oc['ip'] = $config['pppoe']['localip'];
-		$oc['sa'] = $config['pppoe']['remoteip'];
-		$oc['sn'] = $g['pppoe_subnet'];
-		$oc['virtual'] = true;
+		$oic['ip'] = $config['pppoe']['localip'];
+		$oic['sa'] = $config['pppoe']['remoteip'];
+		$oic['sn'] = $g['pppoe_subnet'];
+		$oic['virtual'] = true;
 		if($config['pppoe']['pppoe_subnet'] <> "")
-			$oc['sn'] = $config['pppoe']['pppoe_subnet'];
+			$oic['sn'] = $config['pppoe']['pppoe_subnet'];
 		$FilterIflist['pppoe'] = $oic;
 	}
 	/* add ipsec interfaces */
@@ -442,19 +442,27 @@ function generate_optcfg_array()
 		$oic['if'] = 'enc0';
 		$oic['descr'] = 'IPsec';
 		$oic['type'] = "none";
-		$oc['virtual'] = true;
+		$oic['virtual'] = true;
 		$FilterIflist['enc0'] = $oic;
 	}
 	/* add openvpn interfaces */
 	if ($config['openvpn']['openvpn-server'] || $config['openvpn']['openvpn-client']) {
-		$ovpnifs = array();
 		$oic = array();
 		$oic['if'] = "openvpn";
 		$oic['descr'] = 'OpenVPN';
 		$oic['type'] = "none";
-		$oc['virtual'] = true;
+		$oic['virtual'] = true;
 		$FilterIflist['openvpn'] = $oic;
 	}
+	/* add interface groups */
+	if (is_array($config['ifgroups']['ifgroupentry']))
+		foreach($config['ifgroups']['ifgroupentry'] as $ifgen) {
+			$oc = array();
+			$oc['if'] = $ifgen['ifname'];
+			$oc['descr'] = $ifgen['ifname'];
+			$oc['virtual'] = true;
+			$FilterIflist[$ifgen['ifname']] = $oc;
+		}
 }
 
 function filter_flush_nat_table() 
diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc
index a27c83b800..423679e1e1 100644
--- a/etc/inc/xmlparse.inc
+++ b/etc/inc/xmlparse.inc
@@ -40,8 +40,9 @@ function listtags() {
 		"columnitem depends_on_package disk dnsserver dnsupdate domainoverrides ".
 		"dyndns earlyshellcmd element encryption-algorithm-option field ".
 		"fieldname hash-algorithm-option gateway_item gateway_group gif gre ".
-		"group hosts member igmpentry interface_array item key lagg lbaction lbpool l7rules ".
-		"lbprotocol member menu tab mobilekey monitor_type mount ntpserver onetoone ".
+		"group hosts member ifgroupentry igmpentry interface_array item key lagg " .
+		"lbaction lbpool l7rules lbprotocol ".
+		"member menu tab mobilekey monitor_type mount ntpserver onetoone ".
 		"openvpn-server openvpn-client openvpn-csc " .
 		"option ppp package passthrumac phase1 phase2 priv proxyarpnet queue ".
 		"pages pipe route row rrddatafile rule schedule service servernat servers ".
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php
index 9dca1901a8..1a859a6c47 100755
--- a/usr/local/www/firewall_rules.php
+++ b/usr/local/www/firewall_rules.php
@@ -79,6 +79,12 @@ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']
 if  ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
    	$iflist["openvpn"] = "OpenVPN";
 
+/* add group interfaces */
+if (is_array($config['ifgroups']['ifgroupentry']))
+	foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
+		if (have_ruleint_access($ifgen['ifname']))
+			$iflist[$ifgen['ifname']] = $ifgen['ifname'];
+
 if (!$if || !isset($iflist[$if])) {
 	if ("any" == $if)
                 $if = "FloatingRules";
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php
index ecbb87eccc..ffd7062c35 100755
--- a/usr/local/www/firewall_rules_edit.php
+++ b/usr/local/www/firewall_rules_edit.php
@@ -548,6 +548,12 @@ include("head.inc");
 					if  ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
        					$interfaces["openvpn"] = "OpenVPN";
 
+					/* add group interfaces */
+					if (is_array($config['ifgroups']['ifgroupentry']))
+						foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
+							if (have_ruleint_access($ifgen['ifname']))
+								$interfaces[$ifgen['ifname']] = $ifgen['ifname'];
+
 					foreach ($interfaces as $iface => $ifacename): ?>
 						<option value="<?=$iface;?>" <?php if ($pconfig['interface'] <> "" && stristr($pconfig['interface'], $iface)) echo "selected"; ?>><?=gettext($ifacename);?></option>
 <?php 				endforeach; ?>
diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php
index 2a2b81c146..00f58aa620 100755
--- a/usr/local/www/interfaces_assign.php
+++ b/usr/local/www/interfaces_assign.php
@@ -316,12 +316,13 @@ if(file_exists("/var/run/interface_mismatch_reboot_needed"))
 <?php
 	$tab_array = array();
 	$tab_array[0] = array("Interface assignments", true, "interfaces_assign.php");
-	$tab_array[1] = array("VLANs", false, "interfaces_vlan.php");
-	$tab_array[2] = array("PPP", false, "interfaces_ppp.php");
-        $tab_array[3] = array("GRE", false, "interfaces_gre.php");
-        $tab_array[4] = array("GIF", false, "interfaces_gif.php");
-	$tab_array[5] = array("Bridges", false, "interfaces_bridge.php");
-	$tab_array[6] = array("LAGG", false, "interfaces_lagg.php");
+	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
+	$tab_array[2] = array("VLANs", false, "interfaces_vlan.php");
+	$tab_array[3] = array("PPP", false, "interfaces_ppp.php");
+        $tab_array[4] = array("GRE", false, "interfaces_gre.php");
+        $tab_array[5] = array("GIF", false, "interfaces_gif.php");
+	$tab_array[6] = array("Bridges", false, "interfaces_bridge.php");
+	$tab_array[7] = array("LAGG", false, "interfaces_lagg.php");
 	display_top_tabs($tab_array);
 ?>  
   </td></tr>
diff --git a/usr/local/www/interfaces_bridge.php b/usr/local/www/interfaces_bridge.php
index f5f3734e65..934dbd3a01 100644
--- a/usr/local/www/interfaces_bridge.php
+++ b/usr/local/www/interfaces_bridge.php
@@ -76,12 +76,13 @@ include("head.inc");
 <?php
 	$tab_array = array();
 	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
-	$tab_array[1] = array("VLANs", false, "interfaces_vlan.php");
-	$tab_array[2] = array("PPP", false, "interfaces_ppp.php");
-	$tab_array[3] = array("GRE", false, "interfaces_gre.php");
-	$tab_array[4] = array("GIF", false, "interfaces_gif.php");
-	$tab_array[5] = array("Bridges", true, "interfaces_bridge.php");
-	$tab_array[6] = array("LAGG", false, "interfaces_lagg.php");
+	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
+	$tab_array[2] = array("VLANs", false, "interfaces_vlan.php");
+	$tab_array[3] = array("PPP", false, "interfaces_ppp.php");
+	$tab_array[4] = array("GRE", false, "interfaces_gre.php");
+	$tab_array[5] = array("GIF", false, "interfaces_gif.php");
+	$tab_array[6] = array("Bridges", true, "interfaces_bridge.php");
+	$tab_array[7] = 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 21ef0c18d9..9e01b33472 100644
--- a/usr/local/www/interfaces_gif.php
+++ b/usr/local/www/interfaces_gif.php
@@ -84,12 +84,13 @@ include("head.inc");
 <?php
 	$tab_array = array();
 	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
-	$tab_array[1] = array("VLANs", false, "interfaces_vlan.php");
-	$tab_array[2] = array("PPP", false, "interfaces_ppp.php");
-	$tab_array[3] = array("GRE", false, "interfaces_gre.php");
-	$tab_array[4] = array("GIF", true, "interfaces_gif.php");
-	$tab_array[5] = array("Bridges", false, "interfaces_bridge.php");
-	$tab_array[6] = array("LAGG", false, "interfaces_lagg.php");
+	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
+	$tab_array[2] = array("VLANs", false, "interfaces_vlan.php");
+	$tab_array[3] = array("PPP", false, "interfaces_ppp.php");
+	$tab_array[4] = array("GRE", false, "interfaces_gre.php");
+	$tab_array[5] = array("GIF", true, "interfaces_gif.php");
+	$tab_array[6] = array("Bridges", false, "interfaces_bridge.php");
+	$tab_array[7] = 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 51698ed6cc..85540e5577 100644
--- a/usr/local/www/interfaces_gre.php
+++ b/usr/local/www/interfaces_gre.php
@@ -84,12 +84,13 @@ include("head.inc");
 <?php
 	$tab_array = array();
 	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
-	$tab_array[1] = array("VLANs", false, "interfaces_vlan.php");
-	$tab_array[2] = array("PPP", false, "interfaces_ppp.php");
-	$tab_array[3] = array("GRE", true, "interfaces_gre.php");
-	$tab_array[4] = array("GIF", false, "interfaces_gif.php");
-	$tab_array[5] = array("Bridges", false, "interfaces_bridge.php");
-	$tab_array[6] = array("LAGG", false, "interfaces_lagg.php");
+	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
+	$tab_array[2] = array("VLANs", false, "interfaces_vlan.php");
+	$tab_array[3] = array("PPP", false, "interfaces_ppp.php");
+	$tab_array[4] = array("GRE", true, "interfaces_gre.php");
+	$tab_array[5] = array("GIF", false, "interfaces_gif.php");
+	$tab_array[6] = array("Bridges", false, "interfaces_bridge.php");
+	$tab_array[7] = 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
new file mode 100755
index 0000000000..09d0b9937f
--- /dev/null
+++ b/usr/local/www/interfaces_groups.php
@@ -0,0 +1,146 @@
+<?php
+/*
+	Copyright (C) 2009 Ermal Luçi
+	Copyright (C) 2004 Scott Ullrich
+	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.
+*/
+
+##|+PRIV
+##|*IDENT=page-interfaces-groups
+##|*NAME=Interfaces: Groups page
+##|*DESCR=Create interface groups
+##|*MATCH=interfaces_groups.php*
+##|-PRIV
+
+
+require("guiconfig.inc");
+
+if (!is_array($config['ifgroups']['ifgroupentry']))
+	$config['ifgroups']['ifgroupentry'] = array();
+
+$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
+
+if ($_GET['act'] == "del") {
+	if ($a_ifgroups[$_GET['id']]) {
+		unset($a_ifgroups[$_GET['id']]);
+		write_config();
+		touch($d_ifgroupsdirty_path);
+		header("Location: interfaces_groups.php");
+		exit;
+	}
+}
+
+$pgtitle = array("Interfaces","Groups");
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+  <tr><td>
+<?php
+        $tab_array = array();
+        $tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
+	$tab_array[1] = array("Interface Groups", true, "interfaces_groups.php");
+        $tab_array[2] = array("VLANs", false, "interfaces_vlan.php");
+        $tab_array[3] = array("PPP", false, "interfaces_ppp.php");
+        $tab_array[4] = array("GRE", false, "interfaces_gre.php");
+        $tab_array[5] = array("GIF", false, "interfaces_gif.php");
+        $tab_array[6] = array("Bridges", false, "interfaces_bridge.php");
+        $tab_array[7] = array("LAGG", false, "interfaces_lagg.php");
+        display_top_tabs($tab_array);
+?>
+  </td></tr>
+<tr>
+    <td>
+        <div id="mainarea">
+        <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+
+<tr>
+  <td width="15%" class="listhdrr">Name</td>
+  <td width="35%" class="listhdrr">Members</td>
+  <td width="25%" class="listhdr">Description</td>
+  <td width="5%" class="list"></td>
+</tr>
+	  <?php if (count ($a_ifgroups)):
+		$i = 0; foreach ($a_ifgroups as $ifgroupentry): ?>
+<tr>
+  <td class="listlr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
+	<?=htmlspecialchars($ifgroupentry['ifname']);?>
+  </td>
+  <td class="listr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
+      <?php
+	$members_arr = array_slice(explode(" ", $ifgroupentry['members']), 0, 10);
+	$iflist = get_configured_interface_with_descr();
+	foreach ($members_arr as $memb)
+		$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
+	$memberses = implode(", ", $memberses_arr);
+	echo $memberses;
+	if(count($members_arr) < 10) {
+		echo " ";
+	} else {
+		echo "...";
+	}
+    ?>
+  </td>
+  <td class="listbg" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
+    <?=htmlspecialchars($ifgroupentry['descr']);?>&nbsp;
+  </td>
+  <td valign="middle" nowrap class="list">
+    <table border="0" cellspacing="0" cellpadding="1">
+      <tr>
+        <td valign="middle"><a href="interfaces_groups_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="edit group"></a></td>
+        <td><a href="interfaces_ifgroups.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this group? All elements that still use it will become invalid (e.g. filter rules)!')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="delete ifgroupentry"></a></td>
+      </tr>
+    </table>
+  </td>
+</tr>
+	  <?php $i++; endforeach; endif;?>
+<tr>
+  <td class="list" colspan="3"></td>
+  <td class="list">
+    <table border="0" cellspacing="0" cellpadding="1">
+      <tr>
+	<td valign="middle" width="17">&nbsp;</td>
+        <td valign="middle"><a href="interfaces_groups_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="add a new group"></a></td>
+        </td>
+      </tr>
+    </table>
+  </td>
+</tr>
+<tr>
+  <td class="tabcont" colspan="3">
+	<p><span class="vexpl"><span class="red"><strong>Note:<br></strong></span>Interface Groups allow you to create rules that apply to multiple interface at once. If you remove members from an interface group the rules do not apply anymore to that interface.</span></p>
+	</td>
+</tr>
+	</table>
+	</div>
+ </td>
+</tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/usr/local/www/interfaces_groups_edit.php b/usr/local/www/interfaces_groups_edit.php
new file mode 100755
index 0000000000..1044beda27
--- /dev/null
+++ b/usr/local/www/interfaces_groups_edit.php
@@ -0,0 +1,274 @@
+<?php
+/*
+	Copyright (C) 2009 Ermal Luçi
+	Copyright (C) 2004 Scott Ullrich
+	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.
+*/
+
+##|+PRIV
+##|*IDENT=page-interfacess-groups
+##|*NAME=Interfaces: Groups: Edit page
+##|*DESCR=Edit Interface groups
+##|*MATCH=interfaces_groups_edit.php*
+##|-PRIV
+
+
+$pgtitle = array("Interfaces","Groups", "Edit");
+
+require("guiconfig.inc");
+
+if (!is_array($config['ifgroups']['ifgroupentry']))
+	$config['ifgroups']['ifgroupentry'] = array();
+
+$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+	$id = $_POST['id'];
+
+if (isset($id) && $a_ifgroups[$id]) {
+	$pconfig['ifname'] = $a_ifgroups[$id]['ifname'];
+	$pconfig['members'] = $a_ifgroups[$id]['members'];
+	$pconfig['descr'] = html_entity_decode($a_ifgroups[$id]['descr']);
+
+}
+
+if ($_POST) {
+
+	unset($input_errors);
+	$pconfig = $_POST;
+
+	foreach ($a_ifgroups as $groupentry)
+		if ($groupentry['ifname'] == $_POST['ifname'])
+			$input_errors[] = "Group name already exists!";
+
+	$ifgroupentry = array();
+	$ifgroupentry['ifname'] = $_POST['ifname'];
+	$members = "";
+	$isfirst = 0;
+	/* item is a normal ifgroupentry type */
+	for($x=0; $x<9999; $x++) {
+		if($_POST["members{$x}"] <> "") {
+			if ($isfirst > 0)
+				$members .= " ";
+			$members .= $_POST["members{$x}"];
+			$isfirst++;
+		}
+	}
+
+	if (!$input_errors) {
+		$ifgroupentry['members'] = $members;
+		$ifgroupentry['descr'] = mb_convert_encoding($_POST['descr'],"HTML-ENTITIES","auto");
+
+		if (isset($id) && $a_ifgroups[$id])
+			$a_ifgroups[$id] = $ifgroupentry;
+		else
+			$a_ifgroups[] = $ifgroupentry;
+
+		write_config();
+
+		header("Location: interfaces_groups.php");
+		exit;
+	} else {
+		$pconfig['descr'] = mb_convert_encoding($_POST['descr'],"HTML-ENTITIES","auto");
+		$pconfig['members'] = $members;
+	}
+}
+
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+<?php
+	include("fbegin.inc");
+?>
+
+<script type="text/javascript">
+// Global Variables
+var rowname = new Array(9999);
+var rowtype = new Array(9999);
+var newrow  = new Array(9999);
+var rowsize = new Array(9999);
+
+for (i = 0; i < 9999; i++) {
+        rowname[i] = '';
+        rowtype[i] = 'select';
+        newrow[i] = '';
+        rowsize[i] = '30';
+}
+
+var field_counter_js = 0;
+var loaded = 0;
+var is_streaming_progress_bar = 0;
+var temp_streaming_text = "";
+
+var addRowTo = (function() {
+    return (function (tableId) {
+        var d, tbody, tr, td, bgc, i, ii, j;
+        d = document;
+        tbody = d.getElementById(tableId).getElementsByTagName("tbody").item(0);
+        tr = d.createElement("tr");
+        for (i = 0; i < field_counter_js; i++) {
+                td = d.createElement("td");
+		<?php
+                        $innerHTML="\"<INPUT type='hidden' value='\" + totalrows +\"' name='\" + rowname[i] + \"_row-\" + totalrows + \"'></input><select size='1' name='\" + rowname[i] + totalrows + \"'>\" +\"";
+
+			$iflist = get_configured_interface_with_descr();
+                        foreach ($iflist as $ifnam => $ifdescr)
+                                $innerHTML .= "<option value={$ifnam}>{$ifdescr}</option>";
+			$innerHTML .= "</select>\";";
+                ?>
+			td.innerHTML=<?=$innerHTML;?>
+                tr.appendChild(td);
+        }
+        td = d.createElement("td");
+        td.rowSpan = "1";
+
+        td.innerHTML = '<input type="image" src="/themes/' + theme + '/images/icons/icon_x.gif" onclick="removeRow(this);return false;" value="Delete">';
+        tr.appendChild(td);
+        tbody.appendChild(tr);
+        totalrows++;
+    });
+})();
+
+function removeRow(el) {
+    var cel;
+    while (el && el.nodeName.toLowerCase() != "tr")
+            el = el.parentNode;
+
+    if (el && el.parentNode) {
+        cel = el.getElementsByTagName("td").item(0);
+        el.parentNode.removeChild(el);
+    }
+}
+
+	rowname[0] = "members";
+	rowtype[0] = "textbox";
+	rowsize[0] = "30";
+
+	rowname[2] = "detail";
+	rowtype[2] = "textbox";
+	rowsize[2] = "50";
+</script>
+<input type='hidden' name='members_type' value='textbox' class="formfld unknown" />
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<div id="inputerrors"></div>
+
+<form action="interfaces_groups_edit.php" method="post" name="iform" id="iform">
+<table width="100%" border="0" cellpadding="6" cellspacing="0">
+  <tr>
+	<td colspan="2" valign="top" class="listtopic">Interface Groups Edit</td>
+  </tr>
+  <tr>
+    <td valign="top" class="vncellreq">Interface</td>
+    <td class="vtable">
+	<input class="formfld unknown" name="ifname" id="ifname" value="<?=$pconfig['ifname'];?>" />
+    </td>
+  </tr>
+  <tr>
+    <td width="22%" valign="top" class="vncell">Description</td>
+    <td width="78%" class="vtable">
+      <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=$pconfig['descr'];?>" />
+      <br />
+      <span class="vexpl">
+        You may enter a description here for your reference (not parsed).
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td width="22%" valign="top" class="vncellreq"><div id="membersnetworkport">Member (s)</div></td>
+    <td width="78%" class="vtable">
+      <table id="maintable">
+        <tbody>
+          <tr>
+            <td><div id="onecolumn">Interface</div></td>
+          </tr>
+
+	<?php
+	$counter = 0;
+	$members = $pconfig['members'];
+	if ($members <> "") {
+		$item = explode(" ", $members);
+		foreach($item as $ww) {
+			$members = $item[$counter];
+			$tracker = $counter;
+	?>
+        <tr>
+	<td class="vtable">
+	        <select name="members<?php echo $tracker; ?>" class="formselect" id="members<?php echo $tracker; ?>">
+			<?php
+				foreach ($iflist as $ifnam => $ifdescr) {
+					echo "<option value={$ifnam}";
+					if ($ifnam == $members)
+						echo " selected";
+					echo ">{$ifdescr}</option>";
+				}
+			?>
+                        </select>
+	</td>
+        <td>
+	<input type="image" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" onclick="removeRow(this); return false;" value="Delete" />
+	      </td>
+          </tr>
+<?php
+		$counter++;
+
+		} // end foreach
+	} // end if
+?>
+        </tbody>
+        <tfoot>
+
+        </tfoot>
+		  </table>
+			<a onclick="javascript:addRowTo('maintable'); return false;" href="#">
+        <img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="add another entry" />
+      </a>
+		</td>
+  </tr>
+  <tr>
+    <td width="22%" valign="top">&nbsp;</td>
+    <td width="78%">
+      <input id="submit" name="submit" type="submit" class="formbtn" value="Save" />
+      <a href="interfaces_groups.php"><input id="cancelbutton" name="cancelbutton" type="button" class="formbtn" value="Cancel" /></a>
+      <?php if (isset($id) && $a_ifgroups[$id]): ?>
+      <input name="id" type="hidden" value="<?=$id;?>" />
+      <?php endif; ?>
+    </td>
+  </tr>
+</table>
+</form>
+
+<script type="text/javascript">
+	field_counter_js = 1;
+	rows = 1;
+	totalrows = <?php echo $counter; ?>;
+	loaded = <?php echo $counter; ?>;
+</script>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/usr/local/www/interfaces_lagg.php b/usr/local/www/interfaces_lagg.php
index 27a21d7e0d..fd46c9c144 100644
--- a/usr/local/www/interfaces_lagg.php
+++ b/usr/local/www/interfaces_lagg.php
@@ -76,12 +76,13 @@ include("head.inc");
 <?php
 	$tab_array = array();
 	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
-	$tab_array[1] = array("VLANs", false, "interfaces_vlan.php");
-	$tab_array[2] = array("PPP", false, "interfaces_ppp.php");
-	$tab_array[3] = array("GRE", false, "interfaces_gre.php");
-	$tab_array[4] = array("GIF", false, "interfaces_gif.php");
-	$tab_array[5] = array("Bridges", false, "interfaces_bridge.php");
-        $tab_array[6] = array("LAGG", true, "interfaces_lagg.php");
+	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
+	$tab_array[2] = array("VLANs", false, "interfaces_vlan.php");
+	$tab_array[3] = array("PPP", false, "interfaces_ppp.php");
+	$tab_array[4] = array("GRE", false, "interfaces_gre.php");
+	$tab_array[5] = array("GIF", false, "interfaces_gif.php");
+	$tab_array[6] = array("Bridges", false, "interfaces_bridge.php");
+        $tab_array[7] = array("LAGG", true, "interfaces_lagg.php");
 	display_top_tabs($tab_array);
 ?>
   </td></tr>
diff --git a/usr/local/www/interfaces_ppp.php b/usr/local/www/interfaces_ppp.php
index 2ad7e1d44a..b25876284c 100644
--- a/usr/local/www/interfaces_ppp.php
+++ b/usr/local/www/interfaces_ppp.php
@@ -98,12 +98,13 @@ include("head.inc");
 <?php
 	$tab_array = array();
 	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
-	$tab_array[1] = array("VLANs", false, "interfaces_vlan.php");
-	$tab_array[2] = array("PPP", true, "interfaces_ppp.php");
-        $tab_array[3] = array("GRE", false, "interfaces_gre.php");
-        $tab_array[4] = array("GIF", false, "interfaces_gif.php");
-	$tab_array[5] = array("Bridges", false, "interfaces_bridge.php");
-	$tab_array[6] = array("LAGG", false, "interfaces_lagg.php");
+	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
+	$tab_array[2] = array("VLANs", false, "interfaces_vlan.php");
+	$tab_array[3] = array("PPP", true, "interfaces_ppp.php");
+        $tab_array[4] = array("GRE", false, "interfaces_gre.php");
+        $tab_array[5] = array("GIF", false, "interfaces_gif.php");
+	$tab_array[6] = array("Bridges", false, "interfaces_bridge.php");
+	$tab_array[7] = 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 b7f7a50115..f8bf3f3c25 100755
--- a/usr/local/www/interfaces_vlan.php
+++ b/usr/local/www/interfaces_vlan.php
@@ -85,12 +85,13 @@ include("head.inc");
 <?php
 	$tab_array = array();
 	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
-	$tab_array[1] = array("VLANs", true, "interfaces_vlan.php");
-	$tab_array[2] = array("PPP", false, "interfaces_ppp.php");
-        $tab_array[3] = array("GRE", false, "interfaces_gre.php");
-        $tab_array[4] = array("GIF", false, "interfaces_gif.php");
-	$tab_array[5] = array("Bridges", false, "interfaces_bridge.php");
-	$tab_array[6] = array("LAGG", false, "interfaces_lagg.php");
+	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
+	$tab_array[2] = array("VLANs", true, "interfaces_vlan.php");
+	$tab_array[3] = array("PPP", false, "interfaces_ppp.php");
+        $tab_array[4] = array("GRE", false, "interfaces_gre.php");
+        $tab_array[5] = array("GIF", false, "interfaces_gif.php");
+	$tab_array[6] = array("Bridges", false, "interfaces_bridge.php");
+	$tab_array[7] = array("LAGG", false, "interfaces_lagg.php");
 	display_top_tabs($tab_array);
 ?>
   </td></tr>
