summaryrefslogtreecommitdiffstats
path: root/src/etc
diff options
context:
space:
mode:
authorlukehamburg <luke.hamburg@gmail.com>2017-02-09 00:59:23 -0500
committerRenato Botelho <renato@netgate.com>2017-02-10 15:57:54 -0200
commitf800218095632062ab2a2e3f4f2d55922fbf606d (patch)
tree63c1ee6a2ed13e408b44a4d1348f0ca103e9708b /src/etc
parentc2f4b75978698f282b8caa93c276acdff870939b (diff)
downloadpfsense-f800218095632062ab2a2e3f4f2d55922fbf606d.zip
pfsense-f800218095632062ab2a2e3f4f2d55922fbf606d.tar.gz
4th attempt!
- Reworked based on recent comments from @rbgarga (cherry picked from commit c516cb287a78f7b05459e7fcba410f443d8eb8af)
Diffstat (limited to 'src/etc')
-rw-r--r--src/etc/inc/util.inc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc
index a205cdb..6e46e4b 100644
--- a/src/etc/inc/util.inc
+++ b/src/etc/inc/util.inc
@@ -1849,16 +1849,20 @@ function alias_expand_urltable($name) {
}
/* obtain MAC address given an IP address by looking at the ARP/NDP table */
-function arp_get_mac_by_ip($ip) {
+function arp_get_mac_by_ip($ip, $do_ping = false) {
unset($macaddr);
$retval = 1;
switch (is_ipaddr($ip)) {
case 4:
- mwexec("/sbin/ping -c 1 -t 1 " . escapeshellarg($ip), true);
+ if ($do_ping === true) {
+ mwexec("/sbin/ping -c 1 -t 1 " . escapeshellarg($ip), true);
+ }
$macaddr = exec("/usr/sbin/arp -n " . escapeshellarg($ip) . " | /usr/bin/awk '{print $4}'", $output, $retval);
break;
case 6:
- mwexec("/sbin/ping6 -c 1 -X 1 " . escapeshellarg($ip), true);
+ if ($do_ping === true) {
+ mwexec("/sbin/ping6 -c 1 -X 1 " . escapeshellarg($ip), true);
+ }
$macaddr = exec("/usr/sbin/ndp -n " . escapeshellarg($ip) . " | /usr/bin/awk '{print $2}'", $output, $retval);
break;
}
OpenPOWER on IntegriCloud