crash in dhcp_recv function in dhcp.c
Posted: Thu Nov 09, 2017 5:00 pm
I have an Ethernet and Wifi board out on some sites.
At one place it would crash everytime Ethernet got at IP, on others it was ok.
This started to pop up with one of the lastest ESP-IDF versions, presumably because of changes to the ethernet and tcpip_adapter code.
I assign a static address to Ethernet and turn off DHCP.
Nailed this down to an issue in dhcp recv:
At the start of the function:
And at the end:
The would cause a StoreProhibited error as dhcp was NULL.
The fix is simple:
/Jesper
At one place it would crash everytime Ethernet got at IP, on others it was ok.
This started to pop up with one of the lastest ESP-IDF versions, presumably because of changes to the ethernet and tcpip_adapter code.
I assign a static address to Ethernet and turn off DHCP.
Nailed this down to an issue in dhcp recv:
At the start of the function:
Code: Select all
/* Caught DHCP message from netif that does not have DHCP enabled? -> not interested */
if((dhcp == NULL) || (dhcp->pcb_allocated == 0)) {
goto free_pbuf_and_return;
}
Code: Select all
free_pbuf_and_return:
dhcp->msg_in = NULL;
pbuf_free(p);
Code: Select all
dhcp->msg_in = NULL
The fix is simple:
Code: Select all
free_pbuf_and_return:
if (dhcp)
dhcp->msg_in = NULL;
pbuf_free(p);
/Jesper