The lease expire is stored as an absolute time in the future. --- gdhcp/server.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/gdhcp/server.c b/gdhcp/server.c index 3042aba..dcf4ae7 100644 --- a/gdhcp/server.c +++ b/gdhcp/server.c @@ -191,7 +191,7 @@ static struct dhcp_lease *add_lease(GDHCPServer *dhcp_server, uint32_t expire, const uint8_t *chaddr, uint32_t yiaddr) { struct dhcp_lease *lease = NULL; - int ret; + int ret, lifetime; ret = get_lease(dhcp_server, yiaddr, chaddr, &lease); if (ret != 0) @@ -203,9 +203,11 @@ static struct dhcp_lease *add_lease(GDHCPServer *dhcp_server, uint32_t expire, lease->lease_nip = ntohl(yiaddr); if (expire == 0) - lease->expire = time(NULL) + dhcp_server->lease_seconds; + lifetime = dhcp_server->lease_seconds; else - lease->expire = expire; + lifetime = expire; + + lease->expire = time(NULL) + lifetime; dhcp_server->lease_list = g_list_insert_sorted(dhcp_server->lease_list, lease, compare_expire); -- 1.7.10.4 _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman