[PATCH] udhcpd: keep expired leases at startup
christian.lindeberg at axis.com
Thu Feb 18 11:10:45 UTC 2016
Let udhcpd retain the information about expired leases when restarting
so that the leases are reserved until they possibly become the oldest
This reduces the frequency of IP address changes for example when the
DHCP server and a group of clients, who do not store and request their
previously offered IP address across restarts, are collectively restarted
and the startup order of the clients are not guaranteed.
Signed-off-by: Christian Lindeberg <christian.lindeberg at axis.com>
networking/udhcp/Config.src | 12 ++++++++++++
networking/udhcp/files.c | 4 ++++
2 files changed, 16 insertions(+)
diff --git a/networking/udhcp/Config.src b/networking/udhcp/Config.src
index c34c8d6f08ce63e51b13a035e30f5985009ddd57..5111c207c6f7adf2b449975f4b2119fe1d459cfc 100644
@@ -55,6 +55,18 @@ config FEATURE_UDHCPD_BASE_IP_ON_MAC
for the same client to (almost always) contain the same
+ bool "Keep expired leases at startup"
+ default n
+ depends on UDHCPD
+ If selected, udhcpd will retain the information about expired
+ leases when restarting.
+ This reduces the frequency of IP address changes and makes
+ consecutive DHCPOFFERS for the same client to (almost always)
+ contain the same IP address.
string "Absolute path to lease file"
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index 1c8808c0f1fcc911c54ec093421eb535a820c48d..18d4613df4d29ded6acd83f2188fb806057315af 100644
@@ -195,7 +195,11 @@ void FAST_FUNC read_leases(const char *file)
if (expires <= 0)
+ 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);
More information about the busybox