← Commit list

ea2b71be6

Christian Lindeberg
Christian Lindeberg
2016-03-01
SUCCESS Duration: 193s

Subject

udhcpd: keep expired leases at startup

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

networking/udhcp/files.c+5 -1
@@ -195,7 +195,11 @@ void FAST_FUNC read_leases(const char *file)
uint32_t static_nip;
if (expires <= 0)
- continue;
+ /* We keep expired leases: add_lease() will add
+ * a lease with 0 seconds remaining.
+ * Fewer IP address changes this way for mass reboot scenario.
+ */
+ expires = 0;
/* Check if there is a different static lease for this IP or MAC */
static_nip = get_static_nip_by_mac(server_config.static_leases, lease.lease_mac);
networking/udhcp/leases.c+3 -1
@@ -17,7 +17,9 @@ static struct dyn_lease *oldest_expired_lease(void)
/* Unexpired leases have g_leases[i].expires >= current time
* and therefore can't ever match */
for (i = 0; i < server_config.max_leases; i++) {
- if (g_leases[i].expires < oldest_time) {
+ if (g_leases[i].expires == 0 /* empty entry */
+ || g_leases[i].expires < oldest_time
+ ) {
oldest_time = g_leases[i].expires;
oldest_lease = &g_leases[i];
}