aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/udhcp/files.c6
-rw-r--r--networking/udhcp/leases.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index 1c8808c0f..5b90e26d2 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -195,7 +195,11 @@ void FAST_FUNC read_leases(const char *file)
195 uint32_t static_nip; 195 uint32_t static_nip;
196 196
197 if (expires <= 0) 197 if (expires <= 0)
198 continue; 198 /* We keep expired leases: add_lease() will add
199 * a lease with 0 seconds remaining.
200 * Fewer IP address changes this way for mass reboot scenario.
201 */
202 expires = 0;
199 203
200 /* Check if there is a different static lease for this IP or MAC */ 204 /* Check if there is a different static lease for this IP or MAC */
201 static_nip = get_static_nip_by_mac(server_config.static_leases, lease.lease_mac); 205 static_nip = get_static_nip_by_mac(server_config.static_leases, lease.lease_mac);
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c
index 844bb60b1..411b74962 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -17,7 +17,9 @@ static struct dyn_lease *oldest_expired_lease(void)
17 /* Unexpired leases have g_leases[i].expires >= current time 17 /* Unexpired leases have g_leases[i].expires >= current time
18 * and therefore can't ever match */ 18 * and therefore can't ever match */
19 for (i = 0; i < server_config.max_leases; i++) { 19 for (i = 0; i < server_config.max_leases; i++) {
20 if (g_leases[i].expires < oldest_time) { 20 if (g_leases[i].expires == 0 /* empty entry */
21 || g_leases[i].expires < oldest_time
22 ) {
21 oldest_time = g_leases[i].expires; 23 oldest_time = g_leases[i].expires;
22 oldest_lease = &g_leases[i]; 24 oldest_lease = &g_leases[i];
23 } 25 }