pkg/lwip: Start DHCP early for all Ethernet netifs
Netifs without link status support will keep sending discover messages with increasing time between. Netifs that support link status will wait for the link to be up, and then start sending. Netifs that support link status but send no link status events will continue to not work (unless link status is up from the first check when setting it up).
This commit is contained in:
parent
9cad382dc8
commit
6b89f4f34b
@ -15,12 +15,10 @@
|
||||
|
||||
#include "kernel_defines.h"
|
||||
|
||||
#if IS_USED(MODULE_LWIP_DHCP_AUTO)
|
||||
#include "lwip/dhcp.h"
|
||||
#endif
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/netif/netdev.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/netifapi.h"
|
||||
#include "netif/lowpan6.h"
|
||||
|
||||
#ifdef MODULE_NETDEV_TAP
|
||||
@ -279,12 +277,17 @@ void lwip_bootstrap(void)
|
||||
#endif
|
||||
/* also allow for external interface definition */
|
||||
tcpip_init(NULL, NULL);
|
||||
#if IS_USED(MODULE_LWIP_DHCP_AUTO) && IS_USED(MODULE_NETDEV_TAP)
|
||||
/* XXX: Hack to get DHCP with IPv4 with `netdev_tap`, as it does
|
||||
* not emit a `NETDEV_EVENT_LINK_UP` event. Remove, once it does
|
||||
* at an appropriate point.
|
||||
* (see https://github.com/RIOT-OS/RIOT/pull/14150) */
|
||||
dhcp_start(netif);
|
||||
#if IS_USED(MODULE_LWIP_DHCP_AUTO)
|
||||
{
|
||||
/* Start DHCP on all supported netifs. Interfaces that support
|
||||
* link status events will reset DHCP retries when link comes up. */
|
||||
struct netif *n = NULL;
|
||||
NETIF_FOREACH(n) {
|
||||
if (netif_is_flag_set(n, NETIF_FLAG_ETHERNET)) {
|
||||
netifapi_dhcp_start(netif);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -17,9 +17,6 @@
|
||||
#include <sys/uio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if MODULE_LWIP_DHCP_AUTO
|
||||
#include "lwip/dhcp.h"
|
||||
#endif
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/ethip6.h"
|
||||
#include "lwip/netif.h"
|
||||
@ -297,10 +294,8 @@ static void _event_cb(netdev_t *dev, netdev_event_t event)
|
||||
break;
|
||||
}
|
||||
case NETDEV_EVENT_LINK_UP: {
|
||||
/* Will wake up DHCP state machine */
|
||||
netifapi_netif_set_link_up(netif);
|
||||
#ifdef MODULE_LWIP_DHCP_AUTO
|
||||
netifapi_dhcp_start(netif);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case NETDEV_EVENT_LINK_DOWN: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user