summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2010-02-12 16:41:01 +0000
committerErmal Luçi <eri@pfsense.org>2010-02-12 16:41:01 +0000
commit3f70e61864304d7884871cfcb09c8962caf6ea03 (patch)
treecd6fadcc8fc6c3f458dde020b519313748d7b0a8 /etc
parent184d50b5646e7aeaca6d754e588c3e93ebf4c9f7 (diff)
downloadpfsense-3f70e61864304d7884871cfcb09c8962caf6ea03.zip
pfsense-3f70e61864304d7884871cfcb09c8962caf6ea03.tar.gz
Ticket #255. Return only ip address not aliases. Also improve speed by using pfSense php module call.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/interfaces.inc21
1 files changed, 7 insertions, 14 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 5fc6ddd..b734086 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -2644,8 +2644,8 @@ function find_interface_ip($interface, $flush = false)
/* Setup IP cache */
if (!isset($interface_ip_arr_cache[$interface]) or $flush) {
- $interface_ip_arr_cache[$interface] = `/sbin/ifconfig {$interface} | /usr/bin/grep -w "inet" | /usr/bin/cut -d" " -f 2| /usr/bin/head -1`;
- $interface_ip_arr_cache[$interface] = str_replace("\n", "", $interface_ip_arr_cache[$interface]);
+ $ifinfo = pfSense_get_interface_addresses($interface);
+ $interface_ip_arr_cache[$interface] = $ifinfo['ipaddr'];
}
return $interface_ip_arr_cache[$interface];
@@ -2660,11 +2660,8 @@ function find_interface_subnet($interface, $flush = false)
return;
if (!isset($interface_sn_arr_cache[$interface]) or $flush) {
- if (preg_match("/^tun|^ppp|^pptp|^pppoe|^ovpn|^gif|^gre/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)));
+ $ifinfo = pfSense_get_interface_addresses($interface);
+ $interface_sn_arr_cache[$interface] = $ifinfo['subnet'];
}
return $interface_sn_arr_cache[$interface];
@@ -2872,13 +2869,9 @@ function get_interface_mtu($interface) {
}
function get_interface_mac($interface) {
- $mac = array();
- exec("/sbin/ifconfig {$interface} | /usr/bin/awk '/ether/ {print $2}'", $mac);
- if(is_macaddr($mac[0])) {
- return trim($mac[0]);
- } else {
- return "";
- }
+ $macinfo = pfSense_get_interface_addresses($interface);
+
+ return $macinfo["macaddr"];
}
/****f* pfsense-utils/generate_random_mac_address
OpenPOWER on IntegriCloud