Some background: I have 1 interface with 2 end-point. One is IPv6 and the other one is IPv4
For the IPv4 end-point, I like to boot up and configure it with the static IP of 0.0.0.0 This allows me to receive broadcasts for a second or two without any possibility of interfering with any device that is already on the network. After those few seconds are up, I read my network settings from a file and I re-configure my IPv4 end-point.
Depending on the settings in the file, I may have to set a valid static IP or I may have to turn on DHCP.
My first gripe is that +TCP does not seem to allow me to turn DHCP on/off on demand. Please correct me if I’m wrong, but I have had to always enable DHCP and then use xApplicationDHCPHook / xApplicationDHCPHook_Multi to decide if it should be allowed or denied. Anyway that solution works, so moving on…
In version 3 of the TCP stack I used FreeRTOS_SetEndPointConfiguration() to set my static IP address or a default IP that would never actually get used if my config file called for DHCP. Side-note: If DHCP fails, I always fall back to IPv4LL, so the default IP passed on to FreeRTOS_SetEndPointConfiguration() never actually gets used.
Now in version 4.0.0 FreeRTOS_SetEndPointConfiguration() still exists but it only populates pxEndPont->ipv4_settings.ulIPAddress and when I want to use a static IP it never works.
I have to explicitly populate pxEndPont->ipv4_defaults.ulIPAddress or call FreeRTOS_FillEndPoint() otherwise, my xApplicationDHCPHook_Multi() callback get’s called with a default IP of 0.0.0.0
It feels like I’m missing something and I’m not 100% sure on what the intention was between ipv4_settings and ipv4_defaults.
It doesn’t feel right that I have to manually assign pxEndPont->ipv4_defaults.ulIPAddress
Should I transition to using FreeRTOS_FillEndPoint() and stop using FreeRTOS_SetEndPointConfiguration?
Would somebody care to shed some light and educate me on the proper way to change network settings runtime? Maybe there are docs out there that I did not find…
Thanks in advance!