diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-01-25 22:46:07 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-01-25 22:46:07 +0000 |
commit | 161040eb43e7a4d5c44bc784ce3b8c7c49e261c2 (patch) | |
tree | 66f41ca4128ec0a981ecf4519127f109eb8b8ca8 /etc | |
parent | 0d55818db1c7202f3c7d1878ad495cefee9d0386 (diff) | |
download | pfsense-161040eb43e7a4d5c44bc784ce3b8c7c49e261c2.zip pfsense-161040eb43e7a4d5c44bc784ce3b8c7c49e261c2.tar.gz |
* Add get_number_of_vlan_interfaces()
* Delete old VLAN interfaces and recreate automatically
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/interfaces.inc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 1e70425..09ea123 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -55,6 +55,11 @@ function interfaces_vlan_configure() { /* devices with long frame support */ $vlan_long_supp = explode(" ", "bfe dc fxp gem hme le rl sis sk ste tl tx xl"); + /* sweep through and axe old interfaces */ + $vlan_count = get_number_of_vlan_interfaces(); + for($x=0; $x<$vlan_count; $x++) + exec("/sbin/ifconfig vlan{$x} delete down"); + $i = 0; foreach ($config['vlans']['vlan'] as $vlan) { @@ -1516,6 +1521,20 @@ function get_number_of_bridged_interfaces() { return "{$bridges_total}"; } +function get_number_of_vlan_interfaces() { + $vlans_total = 0; + $vlans = split("\n", `/sbin/ifconfig -a | /usr/bin/grep vlan | grep flags`); + foreach($vlans as $bridge) { + $match_array = ""; + preg_match_all("/vlan(.*):/",$bridge,$match_array); + if($match_array[1][0] <> "") { + if($match_array[1][0] > $vlans_total) + $vlans_total = $match_array[1][0]; + } + } + return "{$vlans_total}"; +} + function get_next_available_bridge_interface() { $bridges_total = get_number_of_bridged_interfaces(); $interfaces = `/sbin/ifconfig -l`; |