diff options
author | lukehamburg <luke.hamburg@gmail.com> | 2017-02-09 00:59:23 -0500 |
---|---|---|
committer | lukehamburg <luke.hamburg@gmail.com> | 2017-02-09 00:59:23 -0500 |
commit | c516cb287a78f7b05459e7fcba410f443d8eb8af (patch) | |
tree | 1fa3467f294c08f2ca52dcff4545e77b0cab642d /src/etc/inc/util.inc | |
parent | 6c2f093000b05285546e81dd1a578fc9b573b72b (diff) | |
download | pfsense-c516cb287a78f7b05459e7fcba410f443d8eb8af.zip pfsense-c516cb287a78f7b05459e7fcba410f443d8eb8af.tar.gz |
4th attempt!
- Reworked based on recent comments from @rbgarga
Diffstat (limited to 'src/etc/inc/util.inc')
-rw-r--r-- | src/etc/inc/util.inc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index f5bb4ef..f2bce2c 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -1812,16 +1812,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; } |