From 2b7f747f5258d998150703fadaf49c913201fa3a Mon Sep 17 00:00:00 2001 From: krw Date: Sat, 27 Feb 2021 17:44:58 +0000 Subject: [PATCH] Stop checking 'epoch' in get_recorded_lease() and just set it as required in read_lease_db(). It's already set in packet_to_lease() and thus both paths to TAILQ_INSERT(lease_db) ensure there is a non-zero epoch in all lease_db entries. --- sbin/dhclient/clparse.c | 4 +++- sbin/dhclient/dhclient.c | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index 11442e0e6ec..051b3bb7a73 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clparse.c,v 1.202 2021/02/21 18:16:59 krw Exp $ */ +/* $OpenBSD: clparse.c,v 1.203 2021/02/27 17:44:58 krw Exp $ */ /* Parser for dhclient config and lease files. */ @@ -234,6 +234,8 @@ read_lease_db(struct client_lease_tq *lease_db) free_client_lease(lp); } + if (lease->epoch == 0) + time(&lease->epoch); TAILQ_INSERT_TAIL(lease_db, lease, next); } diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 232584bb5b4..9d5252fd04b 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.704 2021/02/27 13:59:00 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.705 2021/02/27 17:44:58 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -2572,9 +2572,6 @@ get_recorded_lease(struct interface_info *ifi) break; } - if (lp != NULL && lp->epoch == 0) - lp->epoch = cur_time; - return lp; } -- 2.20.1