]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix default options and old IPV4LL leases.
authorRoy Marples <roy@marples.name>
Thu, 1 May 2008 19:50:33 +0000 (19:50 +0000)
committerRoy Marples <roy@marples.name>
Thu, 1 May 2008 19:50:33 +0000 (19:50 +0000)
client.c
dhcpcd.c

index c7694e5863b174fd0112df24e605dafcd4e2ea28..d5b49e6a36e159702d4cd40f0a35dd42bbd74c2b 100644 (file)
--- a/client.c
+++ b/client.c
@@ -385,10 +385,15 @@ get_old_lease(struct if_state *state, const struct options *options)
 
        /* Ok, lets use this */
        if (IN_LINKLOCAL(dhcp->yiaddr)) {
-               free(state->old_dhcp);
-               state->old_dhcp = state->dhcp;
-               state->dhcp = dhcp;
-               return 0;
+               if (options->options & DHCPCD_IPV4LL) {
+                       free(state->old_dhcp);
+                       state->old_dhcp = state->dhcp;
+                       state->dhcp = dhcp;
+                       return 0;
+               }
+               lease->addr.s_addr = 0;
+               free(dhcp);
+               return -1;
        }
 #endif
 
@@ -405,6 +410,7 @@ get_old_lease(struct if_state *state, const struct options *options)
        {
                logger(LOG_ERR, "lease expired %u seconds ago",
                       offset + lease->leasetime);
+               lease->addr.s_addr = 0;
                free(dhcp);
                return -1;
        }
index 1863db149b3b207e0aea56c310d85a0240d6fbf3..3565aa4e99665079b3015517a268618f865a93c2 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -403,8 +403,14 @@ main(int argc, char **argv)
        snprintf(options->classid, CLASS_ID_MAX_LEN, "%s %s",
                 PACKAGE, VERSION);
 
-       options->options |= DHCPCD_GATEWAY | DHCPCD_ARP | DHCPCD_IPV4LL |
-               DHCPCD_DAEMONISE | DHCPCD_CLIENTID;
+       options->options |= DHCPCD_GATEWAY | DHCPCD_DAEMONISE | DHCPCD_CLIENTID;
+#ifdef ENABLE_ARP
+       options->options |= DHCPCD_ARP;
+ #ifdef ENABLE_IPV4LL
+       options->options |= DHCPCD_IPV4LL;
+ #endif
+#endif
+
        options->timeout = DEFAULT_TIMEOUT;
 
 #ifdef CMDLINE_COMPAT