improve host detection on interface change
[project/relayd.git] / main.c
diff --git a/main.c b/main.c
index 2e34954..318ba1c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -252,6 +252,7 @@ static void send_arp_reply(struct relayd_interface *rif, const uint8_t spa[4],
 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 uloop_timeout *timeout)
         * 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;
@@ -719,7 +722,7 @@ int main(int argc, char **argv)
        local_route_table = 0;
        uloop_init();
 
-       while ((ch = getopt(argc, argv, "I:i:t:BDdT:G:R:L:")) != -1) {
+       while ((ch = getopt(argc, argv, "I:i:t:p:BDdT:G:R:L:")) != -1) {
                switch(ch) {
                case 'I':
                        managed = true;