mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
examples/gnrc_border_router: allow more than two ways to obtain a prefix
This commit is contained in:
parent
32be74291c
commit
53601df430
@ -44,17 +44,24 @@ USEMODULE += ps
|
||||
|
||||
# When using a regular network uplink we should use DHCPv6
|
||||
ifneq (,$(filter cdc-ecm wifi ethernet,$(UPLINK)))
|
||||
USE_DHCPV6 ?= 1
|
||||
PREFIX_CONF ?= dhcpv6
|
||||
else
|
||||
USE_DHCPV6 ?= 0
|
||||
PREFIX_CONF ?= uhcp
|
||||
endif
|
||||
|
||||
ifeq (1,$(USE_DHCPV6))
|
||||
# Check if the selected method for prefix configuration is valid
|
||||
ifeq (,$(filter dhcpv6 uhcp auto_subnets,$(PREFIX_CONF)))
|
||||
$(error Supported methods for prefix configuration are `dhcpv6`, `uhcp` and `auto_subnets`)
|
||||
endif
|
||||
|
||||
ifeq (dhcpv6,$(PREFIX_CONF))
|
||||
# include DHCPv6 client for 6LoWPAN border router
|
||||
USEMODULE += gnrc_dhcpv6_client_6lbr
|
||||
else
|
||||
else ifeq (uhcp,$(PREFIX_CONF))
|
||||
# include UHCP client
|
||||
USEMODULE += gnrc_uhcpc
|
||||
else ifeq (auto_subnets,$(PREFIX_CONF))
|
||||
USEMODULE += gnrc_ipv6_auto_subnets_simple
|
||||
endif
|
||||
|
||||
# Comment this out to disable code in RIOT that does safety checking
|
||||
@ -67,7 +74,7 @@ QUIET ?= 1
|
||||
|
||||
# Ethos/native TAP interface and UHCP prefix can be configured from make command
|
||||
TAP ?= tap0
|
||||
ifeq (1,$(USE_DHCPV6))
|
||||
ifneq (,$(filter dhcpv6 auto_subnets,$(PREFIX_CONF)))
|
||||
# with DHCPv6 the 64-bit delegated prefixes are generated from a shorter
|
||||
# configured prefix.
|
||||
IPV6_PREFIX ?= 2001:db8::/32
|
||||
@ -110,7 +117,7 @@ include $(RIOTBASE)/Makefile.include
|
||||
|
||||
# Compile-time configuration for DHCPv6 client (needs to come after
|
||||
# Makefile.include as this might come from Kconfig)
|
||||
ifeq (1,$(USE_DHCPV6))
|
||||
ifeq (dhcpv6,$(PREFIX_CONF))
|
||||
ifndef CONFIG_GNRC_DHCPV6_CLIENT_6LBR_STATIC_ROUTE
|
||||
ifeq (1,$(STATIC_ROUTES))
|
||||
CFLAGS += -DCONFIG_GNRC_DHCPV6_CLIENT_6LBR_STATIC_ROUTE=1
|
||||
@ -129,7 +136,7 @@ host-tools:
|
||||
|
||||
# define native specific targets to only run UHCP daemon when required
|
||||
ifneq (,$(filter native,$(BOARD)))
|
||||
ifneq (1,$(USE_DHCPV6))
|
||||
ifeq (uhcp,$(PREFIX_CONF))
|
||||
.PHONY: uhcpd-daemon
|
||||
|
||||
uhcpd-daemon: host-tools
|
||||
|
@ -2,11 +2,11 @@
|
||||
USEMODULE += auto_init_usbus
|
||||
USEMODULE += usbus_cdc_ecm
|
||||
|
||||
ifeq (1,$(USE_DHCPV6))
|
||||
ifeq (dhcpv6, $(PREFIX_CONF))
|
||||
FLAGS_EXTRAS += --use-dhcpv6
|
||||
endif
|
||||
|
||||
# Configure terminal parameters for UHCP
|
||||
TERMDEPS += host-tools
|
||||
TERMPROG ?= sudo sh $(RIOTTOOLS)/usb-cdc-ecm/start_network.sh
|
||||
TERMFLAGS ?= $(FLAGS_EXTRAS) $(IPV6_PREFIX) $(PORT)
|
||||
TERMFLAGS ?= $(FLAGS_EXTRAS) $(IPV6_PREFIX) $(PORT)
|
||||
|
@ -2,7 +2,7 @@ CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)
|
||||
|
||||
STATIC_ROUTES ?= 1
|
||||
|
||||
ifeq (1,$(USE_DHCPV6))
|
||||
ifeq (dhcpv6, $(PREFIX_CONF))
|
||||
FLAGS_EXTRAS=--use-dhcpv6
|
||||
endif
|
||||
|
||||
|
@ -9,7 +9,7 @@ CFLAGS += -DASYNC_READ_NUMOF=$(shell expr $(ZEP_DEVICES) + 1)
|
||||
# Set CFLAGS if not being set via Kconfig
|
||||
CFLAGS += $(if $(CONFIG_KCONFIG_MODULE_DHCPV6),,-DCONFIG_DHCPV6_CLIENT_PFX_LEASE_MAX=$(ZEP_DEVICES))
|
||||
|
||||
ifeq (1,$(USE_DHCPV6))
|
||||
ifeq (dhcpv6,$(PREFIX_CONF))
|
||||
FLAGS_EXTRAS += --use-dhcpv6
|
||||
endif
|
||||
|
||||
|
@ -4,7 +4,7 @@ CFLAGS += -DSLIPDEV_PARAM_BAUDRATE=$(SLIP_BAUDRATE)
|
||||
|
||||
STATIC_ROUTES ?= 1
|
||||
|
||||
ifeq (1,$(USE_DHCPV6))
|
||||
ifeq (dhcpv6, $(PREFIX_CONF))
|
||||
FLAGS_EXTRAS=-d
|
||||
endif
|
||||
|
||||
|
@ -36,7 +36,7 @@ router, stdio is multiplexed over the same line.
|
||||
|
||||
The `wifi` uplink will connect to an existing WiFi (IEEE 802.11) network.
|
||||
The network must provide a DHCPv6 server that supports prefix delegation (IA_PD) when
|
||||
`USE_DHCPV6=1` is set (default).
|
||||
`PREFIX_CONF=dhcpv6` is set (default).
|
||||
|
||||
Use `WIFI_SSID="SSID" WIFI_PASS="password"` in your `make` command to set your WiFi's
|
||||
credentials. You can alternatively edit the `Makefile`.
|
||||
@ -85,10 +85,10 @@ make clean all flash
|
||||
```
|
||||
|
||||
If you want to use DHCPv6 instead of UHCP compile with the environment variable
|
||||
`USE_DHCPV6` set to 1
|
||||
`PREFIX_CONF` set to dhcpv6
|
||||
|
||||
```bash
|
||||
USE_DHCPV6=1 make clean all flash
|
||||
PREFIX_CONF=dhcpv6 make clean all flash
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
Loading…
Reference in New Issue
Block a user