From 25c1ebd5cb2a358477e81c30b5e73719a94e1107 Mon Sep 17 00:00:00 2001 From: N0YB Date: Fri, 7 Dec 2012 22:26:28 -0800 Subject: ARP Table Static Entries from Individual DHCP Static Mappings Assign individual DHCP static mappings as ARP table static entries. Useful / necessary for sending WoL magic packets from external services / sources, and for any other purpose that needs a static ARP table entry. --- etc/inc/interfaces.inc | 7 +++++++ usr/local/www/services_dhcp.php | 10 ++++++++-- usr/local/www/services_dhcp_edit.php | 10 ++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 28dc04d..e9e2c95 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -4609,6 +4609,13 @@ function interfaces_staticarp_configure($if) { } else { mwexec("/sbin/ifconfig " . escapeshellarg($ifcfg['if']) . " -staticarp " ); mwexec("/usr/sbin/arp -d -i " . escapeshellarg($ifcfg['if']) . " -a > /dev/null 2>&1 "); + if (is_array($config['dhcpd'][$if]['staticmap'])) { + foreach ($config['dhcpd'][$if]['staticmap'] as $arpent) { + if (isset($arpent['arp_table_static_entry'])) { + mwexec("/usr/sbin/arp -s " . escapeshellarg($arpent['ipaddr']) . " " . escapeshellarg($arpent['mac'])); + } + } + } } return 0; diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index a240aad..522531e 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -1113,7 +1113,8 @@ include("head.inc"); - + + @@ -1130,6 +1131,11 @@ include("head.inc"); "" or $mapent['ipaddr'] <> ""): ?> + @@ -1155,7 +1161,7 @@ include("head.inc"); - +
+ + ARP Table Static Entry + +
diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php index 23c942f..d64848e 100755 --- a/usr/local/www/services_dhcp_edit.php +++ b/usr/local/www/services_dhcp_edit.php @@ -90,12 +90,14 @@ if (isset($id) && $a_maps[$id]) { $pconfig['filename'] = $a_maps[$id]['filename']; $pconfig['rootpath'] = $a_maps[$id]['rootpath']; $pconfig['descr'] = $a_maps[$id]['descr']; + $pconfig['arp_table_static_entry'] = isset($a_maps[$id]['arp_table_static_entry']); } else { $pconfig['mac'] = $_GET['mac']; $pconfig['hostname'] = $_GET['hostname']; $pconfig['filename'] = $_GET['filename']; $pconfig['rootpath'] = $_GET['rootpath']; $pconfig['descr'] = $_GET['descr']; + $pconfig['arp_table_static_entry'] = $_GET['arp_table_static_entry']; } if ($_POST) { @@ -168,6 +170,7 @@ if ($_POST) { $mapent['ipaddr'] = $_POST['ipaddr']; $mapent['hostname'] = $_POST['hostname']; $mapent['descr'] = $_POST['descr']; + $mapent['arp_table_static_entry'] = ($_POST['arp_table_static_entry']) ? true : false; $mapent['filename'] = $_POST['filename']; $mapent['rootpath'] = $_POST['rootpath']; @@ -257,6 +260,13 @@ include("head.inc"); "for your reference (not parsed).");?> + + + +
+ > +
  "> " onclick="history.back()"> -- cgit v1.1