summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sbin/dhclient/clparse.c8
-rw-r--r--sbin/dhclient/conflex.c3
-rw-r--r--sbin/dhclient/dhclient.c6
-rw-r--r--sbin/dhclient/dhcpd.h3
-rw-r--r--sbin/dhclient/dhctoken.h3
5 files changed, 18 insertions, 5 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c
index 4e6a3d369b2..c21287b3ef0 100644
--- a/sbin/dhclient/clparse.c
+++ b/sbin/dhclient/clparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clparse.c,v 1.148 2017/10/23 13:31:35 krw Exp $ */
+/* $OpenBSD: clparse.c,v 1.149 2017/11/06 13:27:19 krw Exp $ */
/* Parser for dhclient config and lease files. */
@@ -583,6 +583,12 @@ parse_client_lease_declaration(FILE *cfile, struct client_lease *lease,
case TOK_BOOTP:
/* 'bootp' is just a comment. See BOOTP_LEASE(). */
break;
+ case TOK_EPOCH:
+ if (parse_decimal(cfile, (unsigned char *)&lease->epoch, 't')
+ == 0)
+ return;
+ lease->epoch = betoh64(lease->epoch);
+ break;
case TOK_EXPIRE:
if (parse_date(cfile, &lease->expiry) == 0)
return;
diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c
index f70ad544290..2d97346e4aa 100644
--- a/sbin/dhclient/conflex.c
+++ b/sbin/dhclient/conflex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conflex.c,v 1.47 2017/10/23 13:31:35 krw Exp $ */
+/* $OpenBSD: conflex.c,v 1.48 2017/11/06 13:27:19 krw Exp $ */
/* Lexical scanner for dhclient config file. */
@@ -357,6 +357,7 @@ static const struct keywords {
{ "backoff-cutoff", TOK_BACKOFF_CUTOFF },
{ "bootp", TOK_BOOTP },
{ "default", TOK_DEFAULT },
+ { "epoch", TOK_EPOCH },
{ "expire", TOK_EXPIRE },
{ "filename", TOK_FILENAME },
{ "fixed-address", TOK_FIXED_ADDR },
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 34df3a3d764..13e33c5dd52 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.519 2017/11/04 14:48:10 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.520 2017/11/06 13:27:19 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -1271,6 +1271,8 @@ packet_to_lease(struct interface_info *ifi, struct option_data *options)
memcpy(lease->filename, packet->file, DHCP_FILE_LEN);
lease->filename[DHCP_FILE_LEN] = '\0';
}
+
+ time(&lease->epoch);
return lease;
decline:
@@ -2248,6 +2250,8 @@ apply_defaults(struct client_lease *lease)
if (newlease == NULL)
fatalx("unable to clone lease");
+ newlease->epoch = lease->epoch;
+
if (config->filename != NULL) {
free(newlease->filename);
newlease->filename = strdup(config->filename);
diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h
index 2142e95a2ea..4a6fa4bb5d7 100644
--- a/sbin/dhclient/dhcpd.h
+++ b/sbin/dhclient/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.234 2017/10/27 15:10:16 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.235 2017/11/06 13:27:19 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -57,6 +57,7 @@ struct reject_elem {
struct client_lease {
TAILQ_ENTRY(client_lease) next;
char *interface;
+ time_t epoch;
time_t expiry, renewal, rebind;
struct in_addr address;
struct in_addr next_server;
diff --git a/sbin/dhclient/dhctoken.h b/sbin/dhclient/dhctoken.h
index 260f88a18b5..cdf39ebbbcb 100644
--- a/sbin/dhclient/dhctoken.h
+++ b/sbin/dhclient/dhctoken.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhctoken.h,v 1.13 2017/10/05 14:19:16 krw Exp $ */
+/* $OpenBSD: dhctoken.h,v 1.14 2017/11/06 13:27:19 krw Exp $ */
/* Tokens for config file lexer and parser. */
@@ -73,6 +73,7 @@
#define TOK_LINK_TIMEOUT 294
#define TOK_IGNORE 295
#define TOK_SSID 296
+#define TOK_EPOCH 297
#define is_identifier(x) ((x) >= TOK_FIRST_TOKEN && \
(x) != TOK_STRING && \