diff --git a/Makefile.dep b/Makefile.dep index a89a5d2547..c2f6b5bd7f 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -568,6 +568,10 @@ ifneq (,$(filter lwip_contrib,$(USEMODULE))) USEMODULE += xtimer endif +ifneq (,$(filter lwip_dhcp_auto,$(USEMODULE))) + USEMODULE += lwip_dhcp +endif + ifneq (,$(filter sema,$(USEMODULE))) USEMODULE += xtimer endif diff --git a/pkg/lwip/Makefile.include b/pkg/lwip/Makefile.include index a51c7b94df..3cd5a28a02 100644 --- a/pkg/lwip/Makefile.include +++ b/pkg/lwip/Makefile.include @@ -4,6 +4,7 @@ INCLUDES += -I$(RIOTBASE)/pkg/lwip/include \ PSEUDOMODULES += lwip_arp PSEUDOMODULES += lwip_autoip PSEUDOMODULES += lwip_dhcp +PSEUDOMODULES += lwip_dhcp_auto PSEUDOMODULES += lwip_ethernet PSEUDOMODULES += lwip_igmp PSEUDOMODULES += lwip_ipv6_autoconfig diff --git a/pkg/lwip/contrib/netdev/lwip_netdev.c b/pkg/lwip/contrib/netdev/lwip_netdev.c index dbc3b59e5b..dab163495f 100644 --- a/pkg/lwip/contrib/netdev/lwip_netdev.c +++ b/pkg/lwip/contrib/netdev/lwip_netdev.c @@ -17,6 +17,9 @@ #include #include +#if MODULE_LWIP_DHCP_AUTO +#include "lwip/dhcp.h" +#endif #include "lwip/err.h" #include "lwip/ethip6.h" #include "lwip/netif.h" @@ -280,8 +283,14 @@ static void _event_cb(netdev_t *dev, netdev_event_t event) DEBUG("lwip_netdev: error inputing packet\n"); return; } + break; } - break; +#ifdef MODULE_LWIP_DHCP_AUTO + case NETDEV_EVENT_LINK_UP: { + dhcp_start(netif); + break; + } +#endif default: break; }