diff options
Diffstat (limited to 'sbin/dhclient')
-rw-r--r-- | sbin/dhclient/dhclient.c | 10 | ||||
-rw-r--r-- | sbin/dhclient/dhcpd.h | 10 | ||||
-rw-r--r-- | sbin/dhclient/dispatch.c | 3 |
3 files changed, 12 insertions, 11 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); diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 50eb887592e..200ad224f24 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.145 2014/12/05 15:47:05 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.146 2014/12/10 02:34:03 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer <henning@openbsd.org> @@ -163,6 +163,7 @@ struct client_state { u_int32_t xid; u_int16_t secs; time_t first_sending; + time_t startup_time; time_t interval; struct dhcp_packet packet; struct dhcp_packet bootrequest_packet; @@ -184,9 +185,10 @@ struct interface_info { int linkstat; int rdomain; int flags; -#define IFI_NEW_LLADDR 0x00000001 -#define IFI_HUP 0x00000002 -#define IFI_NOMEDIA 0x00000004 +#define IFI_VALID_LLADDR 0x00000001 +#define IFI_NEW_LLADDR 0x00000002 +#define IFI_NOMEDIA 0x00000004 +#define IFI_HUP 0x00000008 }; struct dhcp_timeout { diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index 0f4fbfd4d25..0544b18c02d 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.98 2014/11/27 23:04:12 krw Exp $ */ +/* $OpenBSD: dispatch.c,v 1.99 2014/12/10 02:34:03 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -84,6 +84,7 @@ get_hw_address(void) memcpy(ifi->hw_address.ether_addr_octet, LLADDR(sdl), ETHER_ADDR_LEN); + ifi->flags |= IFI_VALID_LLADDR; } if (!found) |