From: Roy Marples Date: Thu, 1 May 2008 19:50:33 +0000 (+0000) Subject: Fix default options and old IPV4LL leases. X-Git-Tag: v4.0.2~440 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f629e6d2782fec635d0e7fa943504980fb4ea3e;p=thirdparty%2Fdhcpcd.git Fix default options and old IPV4LL leases. --- diff --git a/client.c b/client.c index c7694e58..d5b49e6a 100644 --- 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; } diff --git a/dhcpcd.c b/dhcpcd.c index 1863db14..3565aa4e 100644 --- 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