]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
When declining a DHCP lease and we have an IPv4LL one, don't re announce our IPv4LL...
authorRoy Marples <roy@marples.name>
Fri, 14 Nov 2008 09:39:09 +0000 (09:39 +0000)
committerRoy Marples <roy@marples.name>
Fri, 14 Nov 2008 09:39:09 +0000 (09:39 +0000)
arp.c
dhcp.c
dhcpcd.c
ipv4ll.c

diff --git a/arp.c b/arp.c
index 35941df94f7678d7a8e2092a8840f3b8f7b432a9..43ce95c1156cd4515ceb85d8a71fb54950b26714 100644 (file)
--- a/arp.c
+++ b/arp.c
@@ -87,7 +87,6 @@ handle_arp_failure(struct interface *iface)
                send_decline(iface);
        close_sockets(iface);
        delete_timeout(NULL, iface);
-
        if (iface->state->lease.frominfo)
                start_interface(iface);
        else
diff --git a/dhcp.c b/dhcp.c
index 9f84a3ff655bff205d8da6c75a9da56c32afe9f5..7c8d7aa1f1698b22ce2dff150d0dc710d5133b17 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -774,7 +774,7 @@ make_message(struct dhcp_message **message,
        if ((type == DHCP_INFORM ||
             type == DHCP_RELEASE ||
             type == DHCP_REQUEST) &&
-           !IN_LINKLOCAL(ntohl(iface->addr.s_addr)))
+            !IN_LINKLOCAL(ntohl(iface->addr.s_addr)))
        {
                dhcp->ciaddr = iface->addr.s_addr;
                /* Just incase we haven't actually configured the address yet */
index 3cc27f0ae547b53f4fd01b3833ebaa9365353e7d..06e051af86984b049e7f3c8602b77ece093a58e6 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -801,7 +801,7 @@ start_interface(void *arg)
                if (ifo->options & DHCPCD_REQUEST)
                        ifo->request_address.s_addr = 0;
        } else
-           iface->state->offer = read_lease(iface);
+               iface->state->offer = read_lease(iface);
 /*     if (iface->state->offer) {
                if (IN_LINKLOCAL(htonl(iface->state->offer->yiaddr))) {
                        free(iface->state->offer);
@@ -811,10 +811,16 @@ start_interface(void *arg)
        if (iface->state->offer) {
                get_lease(&iface->state->lease, iface->state->offer);
                iface->state->lease.frominfo = 1;
-               /* Offset lease times and check expiry */
-               if (stat(iface->leasefile, &st) == 0 &&
-                   get_option_uint32(&l, iface->state->offer, DHO_LEASETIME) == 0)
+               if (IN_LINKLOCAL(htonl(iface->state->offer->yiaddr))) {
+                       if (iface->state->offer->yiaddr == iface->addr.s_addr) {
+                               free(iface->state->offer);
+                               iface->state->offer = NULL;
+                       }
+               } else if (stat(iface->leasefile, &st) == 0 &&
+                          get_option_uint32(&l, iface->state->offer,
+                                            DHO_LEASETIME) == 0)
                {
+                       /* Offset lease times and check expiry */
                        gettimeofday(&now, NULL);
                        if ((time_t)l < now.tv_sec - st.st_mtime) {
                                free(iface->state->offer);
index fcd690e2f8c0fd3c2630963f3fa777348c7f54e7..810b26208977f68ca41a3bdfe919f12b09cd4a1f 100644 (file)
--- a/ipv4ll.c
+++ b/ipv4ll.c
@@ -87,7 +87,7 @@ start_ipv4ll(void *arg)
                }
        }
 
-       /* We maybe rebooting of an IPv4LL address. */
+       /* We maybe rebooting an IPv4LL address. */
        if (!iface->state->offer ||
            !IN_LINKLOCAL(htonl(iface->state->offer->yiaddr)))
        {