diff --git a/examples/gnrc_border_router/Makefile b/examples/gnrc_border_router/Makefile index 8771de9ae8..bd73d1c6b2 100644 --- a/examples/gnrc_border_router/Makefile +++ b/examples/gnrc_border_router/Makefile @@ -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 diff --git a/examples/gnrc_border_router/Makefile.cdc-ecm.conf b/examples/gnrc_border_router/Makefile.cdc-ecm.conf index 679b931c5f..0f46566bc9 100644 --- a/examples/gnrc_border_router/Makefile.cdc-ecm.conf +++ b/examples/gnrc_border_router/Makefile.cdc-ecm.conf @@ -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) \ No newline at end of file +TERMFLAGS ?= $(FLAGS_EXTRAS) $(IPV6_PREFIX) $(PORT) diff --git a/examples/gnrc_border_router/Makefile.ethos.conf b/examples/gnrc_border_router/Makefile.ethos.conf index 9a7d1484cd..093c3ecd09 100644 --- a/examples/gnrc_border_router/Makefile.ethos.conf +++ b/examples/gnrc_border_router/Makefile.ethos.conf @@ -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 diff --git a/examples/gnrc_border_router/Makefile.native.conf b/examples/gnrc_border_router/Makefile.native.conf index 013bc5d88d..3631a5e485 100644 --- a/examples/gnrc_border_router/Makefile.native.conf +++ b/examples/gnrc_border_router/Makefile.native.conf @@ -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 diff --git a/examples/gnrc_border_router/Makefile.slip.conf b/examples/gnrc_border_router/Makefile.slip.conf index d0c51b92be..349866c042 100644 --- a/examples/gnrc_border_router/Makefile.slip.conf +++ b/examples/gnrc_border_router/Makefile.slip.conf @@ -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 diff --git a/examples/gnrc_border_router/README.md b/examples/gnrc_border_router/README.md index 4e82c22d6f..b91aab893f 100644 --- a/examples/gnrc_border_router/README.md +++ b/examples/gnrc_border_router/README.md @@ -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