diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-12-18 18:01:47 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-12-18 18:01:47 +0000 |
commit | 36f546e9218fc8e4a5792be0ec1c68c4a26af4ca (patch) | |
tree | 622c08e86ce3b836589e1293872e9359dba096b7 /etc/inc | |
parent | 3cf333228d57c3009989eb455712027429f9c339 (diff) | |
download | pfsense-36f546e9218fc8e4a5792be0ec1c68c4a26af4ca.zip pfsense-36f546e9218fc8e4a5792be0ec1c68c4a26af4ca.tar.gz |
MFC get_interface_list() so that NGX and CARPX does not show up in assign interfaces
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/util.inc | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 2aadad8..14ead40 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -240,11 +240,33 @@ function is_port($port) { * "media" - use ifconfig to check physical connection * status (much slower) */ -function get_interface_list($mode = "active", $keyby = "physical") { +/* + * get_interface_list() - Return a list of all physical interfaces + * along with MAC and status. + * + * $mode = "active" - use ifconfig -lu + * "media" - use ifconfig to check physical connection + * status (much slower) + */ +function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "") { global $config; $upints = array(); /* get a list of virtual interface types */ - $vfaces = explode(" ", trim(shell_exec("/sbin/ifconfig -C"))); + if(!$vfaces) { + $vfaces = array( + 'ppp', + 'sl', + 'gif', + 'faith', + 'lo', + 'ng', + 'vlan', + 'tun', + 'pflog', + 'pfsync', + 'carp' + ); + } switch($mode) { case "active": $upints = explode(" ", trim(shell_exec("/sbin/ifconfig -lu"))); @@ -270,7 +292,8 @@ function get_interface_list($mode = "active", $keyby = "physical") { $friendly = ""; $alink = explode(" ", $link); $ifname = rtrim(trim($alink[0]), '*'); - if (!in_array(substr($ifname, 0, -1), $vfaces)) { + /* trim out all numbers before checking for vfaces */ + if (!in_array(array_shift(preg_split('/\d/', $ifname)), $vfaces)) { $toput = array( "mac" => trim($alink[1]), "up" => in_array($ifname, $upints) |