From fb2c5c38819176e39f32981f543c54859ac02d34 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Fri, 3 Jan 2025 12:06:03 +0100 Subject: [PATCH] examples/gnrc_networking: optional RPL and router Introduce a Makefile variable for enabling RPL and/or routing functionality. --- examples/gnrc_networking/Makefile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/examples/gnrc_networking/Makefile b/examples/gnrc_networking/Makefile index 5e7c2e2c33e5..f90e41a6f84b 100644 --- a/examples/gnrc_networking/Makefile +++ b/examples/gnrc_networking/Makefile @@ -7,14 +7,22 @@ BOARD ?= native # This has to be the absolute path to the RIOT base directory: RIOTBASE ?= $(CURDIR)/../.. +# By default this application will run as a host, i.e., not forward any +# packets. Setting this variable to 1 will change this behavior and let the +# node act as a router. +ROUTER ?= 0 # Include packages that pull up and auto-init the link layer. # NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present USEMODULE += netdev_default USEMODULE += auto_init_gnrc_netif # Activate ICMPv6 error messages USEMODULE += gnrc_icmpv6_error -# Specify the mandatory networking module for a IPv6 host node +# Specify the mandatory networking module for a IPv6 in router or host node +ifeq (1,$(ROUTER)) +USEMODULE += gnrc_ipv6_router_default +else USEMODULE += gnrc_ipv6_default +endif # Additional networking modules that can be dropped if not needed USEMODULE += gnrc_icmpv6_echo USEMODULE += shell_cmd_gnrc_udp @@ -24,7 +32,16 @@ USEMODULE += shell_cmds_default USEMODULE += ps USEMODULE += netstats_l2 USEMODULE += netstats_ipv6 + +# Optionally include the RPL routing protocol (particular useful if not all +# nodes are within radio transmission range to the border router) +USE_RPL ?= 0 + +ifeq (1,$(USE_RPL)) +USEMODULE += gnrc_rpl +USEMODULE += auto_init_gnrc_rpl USEMODULE += netstats_rpl +endif # Optionally include DNS support. This includes resolution of names at an # upstream DNS server and the handling of RDNSS options in Router Advertisements