From 96911fb7ea2671f5d19d0ff277134a65281c9d0a Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 22 Jan 2021 09:29:21 +0100 Subject: [PATCH] lwip: Fix DHCP Server to remove clients record if request not acked When client's request refused by sending NAK, its record still resided in the linked list of pooled addresses. It is okay from the spec perspective (RFC2131.p16: Server MAY mark the offered address unavailable), but would consume some memory if the client didn't retry. Closes https://github.com/espressif/esp-idf/issues/6410 --- components/lwip/apps/dhcpserver/dhcpserver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lwip/apps/dhcpserver/dhcpserver.c b/components/lwip/apps/dhcpserver/dhcpserver.c index a50b3ccc78..f23966688f 100644 --- a/components/lwip/apps/dhcpserver/dhcpserver.c +++ b/components/lwip/apps/dhcpserver/dhcpserver.c @@ -916,7 +916,7 @@ POOL_CHECK: s16_t ret = parse_options(&m->options[4], len);; - if (ret == DHCPS_STATE_RELEASE) { + if (ret == DHCPS_STATE_RELEASE || ret == DHCPS_STATE_NAK) { if (pnode != NULL) { node_remove_from_list(&plist, pnode); free(pnode);