Skip to content

Commit 89e17c1

Browse files
Improvements in network boot (#2916)
***NO_CI***
1 parent 453bf3d commit 89e17c1

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/PAL/Lwip/lwIP_Sockets.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ HRESULT LWIP_SOCKETS_Driver::UpdateAdapterConfiguration(
13111311
else
13121312
{
13131313
// stop DHCP
1314-
dhcp_stop(networkInterface);
1314+
dhcp_release_and_stop(networkInterface);
13151315

13161316
// need to convert these first
13171317
ip_addr_t ipAddress, mask, gateway;
@@ -1333,15 +1333,9 @@ HRESULT LWIP_SOCKETS_Driver::UpdateAdapterConfiguration(
13331333

13341334
if (enableDHCP)
13351335
{
1336-
// developer note: on legacy source there was a hack of trying to renew before release and
1337-
// also setting the release flag in managed call when the intent was to renew only
1338-
// nowadays lwIP seems to be doing what is told, so no need for these hacks anymore
1339-
// also it's NOT possible to renew & release on the same pass, so adding an extra else-if for that
1340-
// just in case it's request from the managed code
1341-
13421336
if (0 != (updateFlags & NetworkInterface_UpdateOperation_DhcpRelease))
13431337
{
1344-
dhcp_release(networkInterface);
1338+
dhcp_release_and_stop(networkInterface);
13451339
}
13461340
else if (0 != (updateFlags & NetworkInterface_UpdateOperation_DhcpRenew))
13471341
{

targets/ChibiOS/_lwIP/nf_lwipthread.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ void lwipDefaultLinkDownCB(void *p)
275275
#if LWIP_DHCP
276276
if (addressMode == NET_ADDRESS_DHCP)
277277
{
278-
dhcp_stop(ifc);
278+
dhcp_release_and_stop(ifc);
279279
}
280280
#endif
281281

@@ -500,7 +500,9 @@ static void do_reconfigure(void *p)
500500
case NET_ADDRESS_DHCP:
501501
{
502502
if (netif_is_up(&thisif))
503-
dhcp_stop(&thisif);
503+
{
504+
dhcp_release_and_stop(&thisif);
505+
}
504506
break;
505507
}
506508
#endif
@@ -532,8 +534,7 @@ static void do_reconfigure(void *p)
532534
#if LWIP_DHCP
533535
case NET_ADDRESS_DHCP:
534536
{
535-
if (netif_is_up(&thisif))
536-
dhcp_start(&thisif);
537+
dhcp_start(&thisif);
537538
break;
538539
}
539540
#endif

0 commit comments

Comments
 (0)