It would appear that dhcp tries as soon as I call FreeRTOS_IPInit() whether or not the Wifi interface is ready.
There really is no good way for the application to either query dhcp status or be warned if the process failed. Any suggestions?
It would seem to me that we need to either extend vIPNetworkUpCalls or xApplicationDHCPHook to include this information, or allow delaying dhcp until ready.
I don’t really like the silent failures that can happen with a ulrand failure, like line 593 in FreeRTOS_DHCP.c
I think that perhaps these DHCP requests are added to the list, but not removed if there is a network issue? Then when the network becomes available a number of requests get sent out.
I think that you should call FreeRTOS_NetworkDown() only once?
The idea was that FreeRTOS_NetworkDown() will be called every 3 seconds ( see ipINITIALISATION_RETRY_DELAY ). You don’t have to do this.
What does your xNetworkInterfaceInitialise() return? It should only return pdPASS when the network is up, when there is a Link Status, or when WiFi is connected.
/* Walk through the options until the dhcpOPTION_END_BYTE byte
is found, taking care not to walk off the end of the options. */
pucByte = &(pxDHCPMessage->ucFirstOptionByte);
pucLastByte = &(pucUDPPayload[ lBytes - dhcpMAX_OPTION_LENGTH_OF_INTEREST ]);
What is the purpose of
#define dhcpMAX_OPTION_LENGTH_OF_INTEREST ( 2L )
? In this case, it prevents the options walker from hitting the end and grabbing the last option. So in this case, setting this to 0 is the only way the dns settings can be retrieved.