Get the correct value as subnet for 'virtual' interfaces. This unbreaks the Routing pages validation on this types of interfaces.

This commit is contained in:
Ermal Lui 2010-02-02 22:40:14 +00:00
parent 8604523be3
commit 58085ef4e5

View File

@ -2645,7 +2645,10 @@ function find_interface_subnet($interface, $flush = false)
return;
if (!isset($interface_sn_arr_cache[$interface]) or $flush) {
$interface_sn_arr_cache[$interface] = `/sbin/ifconfig {$interface} | /usr/bin/grep -w "inet" | /usr/bin/cut -d" " -f 4 | /usr/bin/head -1`;
if (preg_match("/^tun|^ppp|^pptp|^pppoe|^ovpn|^gif|^gre|^lagg|^bridge|*vlan/i", $interface))
$interface_sn_arr_cache[$interface] = `/sbin/ifconfig {$interface} | /usr/bin/grep -w "inet" | /usr/bin/cut -d" " -f 6 | /usr/bin/head -1`;
else
$interface_sn_arr_cache[$interface] = `/sbin/ifconfig {$interface} | /usr/bin/grep -w "inet" | /usr/bin/cut -d" " -f 4 | /usr/bin/head -1`;
$interface_sn_arr_cache[$interface] = strlen(str_replace("0", "", base_convert(str_replace("\n", "", $interface_sn_arr_cache[$interface]),16, 2)));
}