1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/lwip: start DHCP for a netif with lwip_dhcp

The NETDEV_EVENT_LINK_UP is used to start DHCP for a network interface
This commit is contained in:
Gunar Schorcht 2019-12-18 07:16:20 +01:00
parent c839bb809a
commit ff506ccf07
3 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -17,6 +17,9 @@
#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"
@ -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;
}