diff --git a/pkg/lwip/contrib/lwip.c b/pkg/lwip/contrib/lwip.c index f8e11e06d9..867186ca87 100644 --- a/pkg/lwip/contrib/lwip.c +++ b/pkg/lwip/contrib/lwip.c @@ -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 } diff --git a/pkg/lwip/contrib/netdev/lwip_netdev.c b/pkg/lwip/contrib/netdev/lwip_netdev.c index dedc2a9319..04daea7596 100644 --- a/pkg/lwip/contrib/netdev/lwip_netdev.c +++ b/pkg/lwip/contrib/netdev/lwip_netdev.c @@ -17,9 +17,6 @@ #include #include -#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: {