]> git.meshlink.io Git - catta/blobdiff - avahi-autoipd/main.c
autoipd: don't consider packets with out own MAC as source as conflicting. See #265
[catta] / avahi-autoipd / main.c
index ef529b9337c253ba48d6549f676dd539cf3b42e8..edf2cd119817eae3af7c73a2b0c1f8e3f9603dbf 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
     This file is part of avahi.
 
@@ -1244,9 +1242,14 @@ static int loop(int iface, uint32_t addr) {
                 int conflict = 0;
 
                 if (info.sender_ip_address == addr) {
-                    /* Normal conflict */
-                    conflict = 1;
-                    daemon_log(LOG_INFO, "Received conflicting normal ARP packet.");
+
+                    if (memcmp(hw_address, info.sender_hw_address, ETHER_ADDRLEN)) {
+                        /* Normal conflict */
+                        conflict = 1;
+                        daemon_log(LOG_INFO, "Received conflicting normal ARP packet.");
+                    } else
+                        daemon_log(LOG_DEBUG, "Received ARP packet back on source interface. Ignoring.");
+
                 } else if (state == STATE_WAITING_PROBE || state == STATE_PROBING || state == STATE_WAITING_ANNOUNCE) {
                     /* Probe conflict */
                     conflict = info.target_ip_address == addr && memcmp(hw_address, info.sender_hw_address, ETHER_ADDRLEN);
@@ -1281,7 +1284,7 @@ static int loop(int iface, uint32_t addr) {
                     DEBUG(daemon_log(LOG_DEBUG, "Ignoring irrelevant ARP packet."));
             }
 
-        } else if (event == EVENT_ROUTABLE_ADDR_CONFIGURED) {
+        } else if (event == EVENT_ROUTABLE_ADDR_CONFIGURED && !force_bind) {
 
             daemon_log(LOG_INFO, "A routable address has been configured.");
 
@@ -1306,7 +1309,7 @@ static int loop(int iface, uint32_t addr) {
             elapse_time(&next_wakeup, 0, PROBE_WAIT*1000);
             next_wakeup_valid = 1;
 
-        } else if (event == EVENT_REFRESH_REQUEST && state == STATE_RUNNING && !force_bind) {
+        } else if (event == EVENT_REFRESH_REQUEST && state == STATE_RUNNING) {
 
             /* The user requested a reannouncing of the address by a SIGHUP */
             daemon_log(LOG_INFO, "Reannouncing address.");