If I call the FreeRTOS_SetIPAddress()/Gateway/Netmask functions does it automatically propagate or do I need to do something to restart the network interface?
I think the function is intended for use to set a static IP address only during initialisation.
As you might already know, the functions
FreeRTOS_SetGatewayAddress will change the IP address, Netmask and the Gateway Address respectively. Instead of these three separate functions, you can also use
FreeRTOS_SetAddressConfiguration to set the DNS Server Address in addition to the above parameters.
Now, coming to your question, the values changed by these functions are used by the device from the point it was called. I DO NOT recommend it as doing this might cause some unforeseen issues. However, if you must, I don’t think that this would require the network interface to be restarted. Why do I say that? Well, because generally the network interface will filter packets based on the MAC address it is assigned and you cannot change that through the above APIs unless the PHY filters out packet based on IP address as well in which case you might need to restart the interface.
Do note however, that this function is not thread safe and should be used with
I may have to just experiment to see if we can support changing the IP Address at runtime. Our current setup requires the user to set the Static IP before starting the networking and then not change things without a reset.
If you have a DHCP server on the network, FreeRTOS+TCP can obtain an IP-address from the DHCP server and you need not worry about assigning IP addresses to the devices.
One additional thing to check against your desired behavior is having established (TCP) socket connections with the current IP address (pair) being used when changing the IP address/netmask. I think the socket connection is kept open (not having the sources in at hand now) regardless of a new IP address/netmask being set, which might cause conflicts (netmask) with the still open socket connection.