Skip to content

How to change network interface parameters after calling mg_tcpip_init? #2606

Discussion options

You must be logged in to vote

The stack would reconfigure when link goes down and up. So, if you change IP or go static <-> DHCP, you should force that. You should also close all open connections.
The fallback case... Our DHCP client will keep on trying as long as it is configured for DHCP and link is up (ifp->state == MG_TCPIP_STATE_UP). You could probably get away with reconfiguring and setting ifp->state = MG_TCPIP_STATE_READY. However, I suggest you reset the interface forcing a link down.
Regarding how to force a link down/up...

mongoose/src/net_builtin.c

Lines 849 to 861 in c8d45c9

// Handle physical interface up/down status
if (expired_1000ms && ifp->driver->up) {
bool up = ifp->driver->up(i…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@pseudotronics
Comment options

@scaprile
Comment options

Answer selected by scaprile
@pseudotronics
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants