summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/etc/inc/util.inc10
-rw-r--r--src/usr/local/www/services_dhcp_edit.php2
2 files changed, 8 insertions, 4 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;
}
diff --git a/src/usr/local/www/services_dhcp_edit.php b/src/usr/local/www/services_dhcp_edit.php
index ecdd015..880ce41 100644
--- a/src/usr/local/www/services_dhcp_edit.php
+++ b/src/usr/local/www/services_dhcp_edit.php
@@ -404,7 +404,7 @@ if ($_POST) {
// Get our MAC address
$ip = $_SERVER['REMOTE_ADDR'];
-$mymac = arp_get_mac_by_ip($ip);
+$mymac = arp_get_mac_by_ip($ip, false);
$iflist = get_configured_interface_with_descr();
$ifname = '';
OpenPOWER on IntegriCloud