Stop checking 'epoch' in get_recorded_lease() and just set it as
authorkrw <krw@openbsd.org>
Sat, 27 Feb 2021 17:44:58 +0000 (17:44 +0000)
committerkrw <krw@openbsd.org>
Sat, 27 Feb 2021 17:44:58 +0000 (17:44 +0000)
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
sbin/dhclient/dhclient.c

index 11442e0..051b3bb 100644 (file)
@@ -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);
        }
 
index 232584b..9d5252f 100644 (file)
@@ -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 <henning@openbsd.org>
@@ -2572,9 +2572,6 @@ get_recorded_lease(struct interface_info *ifi)
                break;
        }
 
-       if (lp != NULL && lp->epoch == 0)
-               lp->epoch = cur_time;
-
        return lp;
 }