diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2014-12-10 02:34:04 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2014-12-10 02:34:04 +0000 |
commit | 6c884b1aea9f49bb410c6f668305ba22d26d27de (patch) | |
tree | 4357fc9abd444aa7b82eb3a0229ca04c83d03b1c /sbin/dhclient/dhclient.c | |
parent | 598757624e1af81825ada1401cc3df0d5bb1a43f (diff) |
Reusing the same field for different things in different contexts may
be clever, but it is definitely confusing. Use a flag IFI_VALID_LLADDR
to indicate that the ifi->hw_address field is valid, rather than
assuming ifi->linkstat does that. Add startup_time to record client
startup rather than using first_sending and hoping nobody else needs
it until link is complete.
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r-- | sbin/dhclient/dhclient.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 6cf52bb7f83..c218a2493d7 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.345 2014/12/10 01:05:13 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.346 2014/12/10 02:34:03 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -327,7 +327,7 @@ routehandler(void) goto die; } - if (ifi->linkstat) { + if (ifi->flags & IFI_VALID_LLADDR) { memcpy(&hw, &ifi->hw_address, sizeof(hw)); get_hw_address(); if (memcmp(&hw, &ifi->hw_address, sizeof(hw))) { @@ -599,6 +599,7 @@ main(int argc, char *argv[]) endpwent(); setproctitle("%s", ifi->name); + time(&client->startup_time); if (ifi->linkstat) { client->state = S_REBOOTING; @@ -634,10 +635,7 @@ state_preboot(void) time(&cur_time); - if (client->first_sending == 0) - client->first_sending = cur_time; - - interval = (int)(cur_time - client->first_sending); + interval = (int)(cur_time - client->startup_time); ifi->linkstat = interface_status(ifi->name); |