summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/services_dhcp_edit.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/local/www/services_dhcp_edit.php')
-rw-r--r--src/usr/local/www/services_dhcp_edit.php16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/usr/local/www/services_dhcp_edit.php b/src/usr/local/www/services_dhcp_edit.php
index 9b5df91..8ec64bb 100644
--- a/src/usr/local/www/services_dhcp_edit.php
+++ b/src/usr/local/www/services_dhcp_edit.php
@@ -386,18 +386,8 @@ if ($_POST) {
// Get our MAC address
$ip = $_SERVER['REMOTE_ADDR'];
-switch (is_ipaddr($ip)) {
- case 4:
- $mymac = exec("/usr/sbin/arp -an | grep '('{$ip}')' | head -n 1 | cut -d' ' -f4");
- $mymac = str_replace("\n", "", $mymac);
- break;
- case 6:
- $mymac = exec("/usr/sbin/ndp -na | /usr/bin/grep '{$ip}' | /usr/bin/head -n 1 | /usr/bin/awk '{ print $2 }'");
- $mymac = str_replace("\n", "", $mymac);
- break;
- default:
- unset($mymac);
-}
+unset($mymac);
+$mymac = arp_get_mac_by_ip($ip);
$iflist = get_configured_interface_with_descr();
$ifname = '';
@@ -426,6 +416,7 @@ $macaddress = new Form_Input(
$pconfig['mac'],
['placeholder' => 'xx:xx:xx:xx:xx:xx']
);
+
$btnmymac = new Form_Button(
'btnmymac',
'Copy My MAC',
@@ -434,6 +425,7 @@ $btnmymac = new Form_Button(
);
$btnmymac->setAttribute('type','button')->removeClass('btn-primary')->addClass('btn-success btn-sm');
+
$group = new Form_Group('MAC Address');
$group->add($macaddress);
if (!empty($mymac)) {
OpenPOWER on IntegriCloud