From: Roy Marples Date: Fri, 14 Nov 2008 09:39:09 +0000 (+0000) Subject: When declining a DHCP lease and we have an IPv4LL one, don't re announce our IPv4LL... X-Git-Tag: v5.0.0~186 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10bcbb5d6b5b100f8e91a17658fbf5d0a65d95c1;p=thirdparty%2Fdhcpcd.git When declining a DHCP lease and we have an IPv4LL one, don't re announce our IPv4LL lease. --- diff --git a/arp.c b/arp.c index 35941df9..43ce95c1 100644 --- 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 9f84a3ff..7c8d7aa1 100644 --- 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 */ diff --git a/dhcpcd.c b/dhcpcd.c index 3cc27f0a..06e051af 100644 --- 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); diff --git a/ipv4ll.c b/ipv4ll.c index fcd690e2..810b2620 100644 --- 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))) {