[OpenWrt-Devel] [PATCH] relayd: improve host detection on interface change

Alejandro Enrique alejandro.enrique at fon.com
Tue Feb 10 08:43:03 EST 2015

This patch improve host detection and refresh when it moves from and
interface to another by pinging for it on all managed interfaces.

Previous to this patch host expiration was done by pinging for it on
the last interface it was known to be. If it does not reply after a
number of retries it will be expired and its entries
deleted. Nevertheless, if the host has moved to another managed
interface it will not be detected until there is some ARP packet sent
by the host.

This detection can be improved by pinging for the host on all managed
interfaces instead of just the one where it is supposed to be
connected, as it will reply to the ARP ping on the new interface it is
connected to and a host refresh will be triggered.

Signed-off-by: Alejandro Enrique <alejandro.enrique at fon.com>
 .../patches/003-arping_on_all_interfaces.patch     |   21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 package/network/services/relayd/patches/003-arping_on_all_interfaces.patch

diff --git a/package/network/services/relayd/patches/003-arping_on_all_interfaces.patch b/package/network/services/relayd/patches/003-arping_on_all_interfaces.patch
new file mode 100644
index 0000000..9321585
--- /dev/null
+++ b/package/network/services/relayd/patches/003-arping_on_all_interfaces.patch
@@ -0,0 +1,21 @@
+--- a/main.c
++++ b/main.c
+@@ -252,6 +252,7 @@ static void send_arp_reply(struct relayd
+ static void host_entry_timeout(struct uloop_timeout *timeout)
+ {
+ 	struct relayd_host *host = container_of(timeout, struct relayd_host, timeout);
++	struct relayd_interface *rif;
+ 	/*
+ 	 * When a host is behind a managed interface, we must not expire its host
+@@ -261,7 +262,9 @@ static void host_entry_timeout(struct ul
+ 	 * giving up on it.
+ 	 */
+ 	if (host->rif->managed && host->cleanup_pending < host_ping_tries) {
+-		send_arp_request(host->rif, host->ipaddr);
++		list_for_each_entry(rif, &interfaces, list) {
++			send_arp_request(rif, host->ipaddr);
++		}
+ 		host->cleanup_pending++;
+ 		uloop_timeout_set(&host->timeout, 1000);
+ 		return;
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list