Continue again DHCP after DHCP failure instead of giving up or using AUTO IP(LinkLayer IP-address)。
What do I need to do without changing the FreeRTOS_TCPIP protocol stack code。
If the current protocol stack DHCP fails, it will give up or use AUTO IP。
You can try by increasing the ipconfigMAXIMUM_DISCOVER_TX_PERIOD
, this is the maximum time the DHCP state machine waits till it gets a response for the DISCOVER message. Note that the duration at which the DISCOVER message sent is doubled after every attemtpt here until it reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD
:
/* It is time to send another Discover. Increase the time
* period, and if it has not got to the point of giving up - send
* another discovery. */
EP_DHCPData.xDHCPTxPeriod <<= 1;
I know ipconfigMAXIMUM_DISCOVER_TX_PERIOD can be increased, but the DHCP cycle will become too large, so I want to restart DHCP directly.How should I restart DHCP
In that case FreeRTOS_NetworkDown()
might be what you are looking for. It will restart the TCP/IP stack along the DHCP, you can manually call this if the endpoint/network is not up yet with a valid DHCP based IP.
Another option is to add more user control over how the EP_DHCPData.xDHCPTxPeriod
(maybe with a new macro) is updated while retrying, if you prefer that, please feel free to raise a github PR with changes.