|
From: | Marco Jakobs |
Subject: | [lwip-users] Change IP parameters during runtime |
Date: | Fri, 28 Sep 2012 17:25:20 +0200 |
Hi, just a fast question: After each change of the IP address of the Ethernet interface I'm restarting my whole machine with LwIP to ensure that everything is going well concerning open ports in listening state and so on (like the "good" old Windows 98 machines). As this is annoying more and more, I just tried a bit around and found out, that calling lines like this IP4_ADDR( &( xAppCfg.xETHCfg.xETHIP ), kreg[100]>>8, kreg[100], kreg[101]>>8, kreg[101] ); IP4_ADDR(ð_ip,kreg[100]>>8, kreg[100], kreg[101]>>8, kreg[101] ); // Eigene IP Ethernet-Interface aufbewahren IP4_ADDR( &( xAppCfg.xETHCfg.xETHNetmask ), kreg[102]>>8, kreg[102], kreg[103]>>8, kreg[103] ); IP4_ADDR( &( xAppCfg.xETHCfg.xETHGateway ), kreg[104]>>8, kreg[104], kreg[105]>>8, kreg[105] ); netif_set_addr( &xEMAC_if, &( xAppCfg.xETHCfg.xETHIP ), &( xAppCfg.xETHCfg.xETHNetmask ), &( xAppCfg.xETHCfg.xETHGateway )); will really change the parameters "on the fly". It seems to work – but I want to be sure that this is an "allowed" and correct way. I don't want to have some stuff stuck in memory or something like this because it's not a clean way to do it like this. Therefore I'll ask the experts here :-) More detailed questions: - If this is OK, what happens with actually open TCP connections (in best case the same as if I break this connection by switching of the counterpart device – they will time out after a while)? - Do I need to call the netif_set_addr() in the same task where LwIP is running, or is it allowed to call it also from another task (it will be ensured that nothing else will call netif_set_addr from my side at the same time) Thanks for any comments! Marco |
[Prev in Thread] | Current Thread | [Next in Thread] |