]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix IPv4LL defending and add a bit more logging.
authorRoy Marples <roy@marples.name>
Wed, 12 May 2010 16:20:55 +0000 (16:20 +0000)
committerRoy Marples <roy@marples.name>
Wed, 12 May 2010 16:20:55 +0000 (16:20 +0000)
arp.c
ipv4ll.c

diff --git a/arp.c b/arp.c
index e6a2928e5268d98226abfc10446f0e469e17d061..89d63fe861bbf59048ad7efead4ec244f3b354bc 100644 (file)
--- a/arp.c
+++ b/arp.c
@@ -78,10 +78,18 @@ send_arp(const struct interface *iface, int op, in_addr_t sip, in_addr_t tip)
 static void
 handle_arp_failure(struct interface *iface)
 {
-       if (iface->state->offer->cookie != htonl(MAGIC_COOKIE)) {
+
+       /* If we failed without a magic cookie then we need to try
+        * and defend our IPv4LL address. */
+       if ((iface->state->offer != NULL &&
+               iface->state->offer->cookie != htonl(MAGIC_COOKIE)) ||
+           (iface->state->new != NULL &&
+               iface->state->new->cookie != htonl(MAGIC_COOKIE)))
+       {
                handle_ipv4ll_failure(iface);
                return;
        }
+
        unlink(iface->leasefile);
        if (!iface->state->lease.frominfo)
                send_decline(iface);
index 7a8e585d9e4c825959d262550aabccde4fe16a81..3d365b36c7de6a7d5d3f646691ab3158c482c1c0 100644 (file)
--- a/ipv4ll.c
+++ b/ipv4ll.c
@@ -125,12 +125,17 @@ handle_ipv4ll_failure(void *arg)
        struct interface *iface = arg;
        time_t up;
 
-       if (iface->state->fail.s_addr == iface->state->lease.addr.s_addr) {
+       if (iface->state->fail.s_addr == iface->addr.s_addr) {
                up = uptime();
                if (iface->state->defend + DEFEND_INTERVAL > up) {
+                       syslog(LOG_DEBUG,
+                           "%s: IPv4LL %d second defence failed",
+                           iface->name, DEFEND_INTERVAL);
                        drop_config(iface, "EXPIRE");
                        iface->state->conflicts = -1;
                } else {
+                       syslog(LOG_DEBUG, "%s: defended IPv4LL address",
+                           iface->name);
                        iface->state->defend = up;
                        return;
                }