From 7dc86c4c16ebc995154356730dfc6bc09d7b7ce6 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Mon, 3 Apr 2017 22:36:10 +0200 Subject: [PATCH] Optimize arp broadcasts via dhcp hooks --- roles/dhcpd/templates/dhcpd.conf.j2 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/roles/dhcpd/templates/dhcpd.conf.j2 b/roles/dhcpd/templates/dhcpd.conf.j2 index d86f69d..362a921 100644 --- a/roles/dhcpd/templates/dhcpd.conf.j2 +++ b/roles/dhcpd/templates/dhcpd.conf.j2 @@ -28,4 +28,18 @@ subnet {{ batman_ipv4 | ipaddr('network') }} netmask {{ batman_ipv4 | ipaddr('ne pool { range {{ dhcpd_first }} {{ dhcpd_last }} ; } + # use static arp entries to reduce broadcast + on commit { + set clip = binary-to-ascii(10, 8, ".", leased-address); + set clhw = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)); + execute("/sbin/arp", "-s", clip, clhw); + } + on release { + set clip = binary-to-ascii(10, 8, ".", leased-address); + execute("/sbin/arp", "-d", clip); + } + on expiry { + set clip = binary-to-ascii(10, 8, ".", leased-address); + execute("/sbin/arp", "-d", clip); + } }