diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 7cb1524463..f5826a586d 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -560,6 +560,9 @@ function interfaces_configure() { /* bring ip IP aliases */ interfaces_ipalias_configure(); + /* configure interface groups */ + interfaces_group_setup(); + if (!$g['booting']) { /* reconfigure static routes (kernel may have deleted them) */ system_routing_configure(); @@ -1758,6 +1761,33 @@ EOD; return 0; } + +function interfaces_group_setup() { + global $config; + + if (!is_array($config['ifgroups']['ifgroupentry'])) + return; + + foreach ($config['ifgroups']['ifgroupentry'] as $grouppar) + interface_group_setup($groupar); + + return; +} + +function interface_group_setup($groupname /* The parameter is an array */) { + global $config; + + if (!is_array($groupname)) + return; + $members = explode(" ", $groupname['members']); + foreach($members as $ifs) { + $realif = get_real_interface($ifs); + if ($realif) + mwexec("/sbin/ifconfig {$realif} group {$groupname['ifname']}"); + } + + return; +} /* XXX: stub for code that references the old functions(mostly packages) */ function get_real_wan_interface($interface = "wan") { diff --git a/usr/local/www/interfaces_groups.php b/usr/local/www/interfaces_groups.php index 09d0b9937f..3cffab79a6 100755 --- a/usr/local/www/interfaces_groups.php +++ b/usr/local/www/interfaces_groups.php @@ -43,9 +43,14 @@ $a_ifgroups = &$config['ifgroups']['ifgroupentry']; if ($_GET['act'] == "del") { if ($a_ifgroups[$_GET['id']]) { + $members = explode(" ", $a_ifgroups[$_GET[$id]]); + foreach ($members as $ifs) { + $realif = get_real_interface($ifs); + if ($realif) + mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$_GET[$id]]['ifname']); + } unset($a_ifgroups[$_GET['id']]); write_config(); - touch($d_ifgroupsdirty_path); header("Location: interfaces_groups.php"); exit; } @@ -93,7 +98,7 @@ include("head.inc");