summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-11-14 09:39:09 +0000
committerRoy Marples <roy@marples.name>2008-11-14 09:39:09 +0000
commit10bcbb5d6b5b100f8e91a17658fbf5d0a65d95c1 (patch)
treed619b1d000e5b148c5485269e1c702629ebb1cfb /dhcpcd.c
parent6b9750ea051be312f7cb4721a34d306446934c7a (diff)
downloaddhcpcd-10bcbb5d6b5b100f8e91a17658fbf5d0a65d95c1.tar.xz
When declining a DHCP lease and we have an IPv4LL one, don't re announce our IPv4LL lease.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c14
1 files changed, 10 insertions, 4 deletions
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);