diff options
-rw-r--r-- | etc/inc/interfaces.inc | 19 | ||||
-rwxr-xr-x | usr/local/www/interfaces_assign.php | 4 |
2 files changed, 22 insertions, 1 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 6ce101c..ab917fd 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2489,6 +2489,10 @@ function interface_configure($interface = "wan", $reloadall = false) { link_interface_to_vips($interface, "update"); + $grouptmp = link_interface_to_group($interface); + if (!empty($grouptmp)) + interface_group_add_member($realif, $grouptmp); + if ($interface == "lan") /* make new hosts file */ system_hosts_generate(); @@ -2627,6 +2631,10 @@ function interface_group_setup(&$groupname /* The parameter is an array */) { return; } + +function interface_group_add_member($interface, $groupname) { + mwexec("/sbin/ifconfig {$interface} group {$groupname}", true); +} /* COMPAT Function */ function convert_friendly_interface_to_real_interface_name($interface) { @@ -3026,6 +3034,17 @@ function link_interface_to_bridge($int) { } } +function link_interface_to_group($int) { + global $config; + + if (is_array($config['ifgroups']['ifgroupentry'])) { + foreach ($config['ifgroups']['ifgroupentry'] as $group) { + if (in_array($int, explode(" ", $groupname['members']))) + return "{$group['ifname']}"; + } + } +} + function link_interface_to_gre($interface) { global $config; diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php index 421286c..41f0fd2 100755 --- a/usr/local/www/interfaces_assign.php +++ b/usr/local/www/interfaces_assign.php @@ -241,7 +241,9 @@ if ($_POST['apply']) { if ($_GET['act'] == "del") { $id = $_GET['id']; - if (link_interface_to_bridge($id)) + if (link_interface_to_group($id)) + $input_errors[] = gettext("The interface is part of a group. Please remove it from the group to continue"); + else if (link_interface_to_bridge($id)) $input_errors[] = gettext("The interface is part of a bridge. Please remove it from the bridge to continue"); else if (link_interface_to_gre($id)) $input_errors[] = gettext("The interface is part of a gre tunnel. Please delete the tunnel to continue"); |