Page 1 of 1

[SOLVED] DHCP server clears IP address of a random station when a 10th station joins

Posted: Mon Sep 07, 2020 12:12 am
by Charger
tcpip_adapter_get_sta_list() returns correct IP address data for the first nine stations. But when a 10th station joins, it turns one of the previous stations into 0.0.0.0. Here is an example:

{"5433cb394950":"192.168.5.2"},{"1004e6b4182c":"192.168.5.8"},{"1019fe306938":"192.168.5.3"},{"101370f86fd0":"192.168.5.5"},{"1081242f49d6":"192.168.5.6"},{"10b8bb0c7937":"192.168.5.10"},{"10a949f54b98":"192.168.5.9"},{"1040348e94cf":"192.168.5.4"},{"10f8fbb606bb":"192.168.5.7"}

{"5433cb394950":"192.168.5.2"},{"1004e6b4182c":"192.168.5.8"},{"1019fe306938":"192.168.5.3"},{"101370f86fd0":"192.168.5.5"},{"1081242f49d6":"192.168.5.6"},{"10b8bb0c7937":"192.168.5.10"},{"10a949f54b98":"192.168.5.9"},{"1040348e94cf":"0.0.0.0"},{"10f8fbb606bb":"192.168.5.7"},{"5433cbb2c86a":"192.168.5.11"}

This is not hitting the ESP_WIFI_MAX_CONN_NUM (10), which I understand is a hard limit. That's OK, as we need exactly 10 client devices.

Poisoning the memset() in tcpip_adapter_get_sta_list() reveals that dhcp_search_ip_on_mac() is returning the address ... it's just already 0.0.0.0 at that point. I can't find where the list of addresses is stored, so presumably that's in the closed source libnet80211.

Has anyone seen this issue or know what might be causing it?

Edit: This was caused by CONFIG_LWIP_DHCPS_MAX_STATION_NUM being previously set to 9. Increasing it to 10 solves the problem. The default is 8, so it wouldn't be surprising it people regularly hit this after eight devices.