From 0ffe5a09f40622ea845f96feab3e040e71972b4c Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 13 Aug 2020 18:43:31 +0200 Subject: [PATCH] examples/gnrc_border_router: automatically start ZEP dispatcher --- .../gnrc_border_router/Makefile.board.dep | 1 + .../gnrc_border_router/Makefile.native.conf | 20 ++++++++++++------- examples/gnrc_border_router/README.md | 13 ++++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/examples/gnrc_border_router/Makefile.board.dep b/examples/gnrc_border_router/Makefile.board.dep index 32fc82bde2..ada0bf3938 100644 --- a/examples/gnrc_border_router/Makefile.board.dep +++ b/examples/gnrc_border_router/Makefile.board.dep @@ -14,4 +14,5 @@ ifeq (,$(filter native,$(BOARD))) endif else USEMODULE += socket_zep + USEMODULE += socket_zep_hello endif diff --git a/examples/gnrc_border_router/Makefile.native.conf b/examples/gnrc_border_router/Makefile.native.conf index 89b8528d25..013bc5d88d 100644 --- a/examples/gnrc_border_router/Makefile.native.conf +++ b/examples/gnrc_border_router/Makefile.native.conf @@ -9,11 +9,17 @@ 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)) -# -z [::1]:$PORT for each ZEP device -TERMFLAGS += $(patsubst %,-z [::1]:%, $(shell seq $(ZEP_PORT_BASE) $(ZEP_PORT_MAX))) - -ifneq (1,$(USE_DHCPV6)) - # We don't need to start ethos so just start the UHCPD daemon in the - # background - TERMDEPS += uhcpd-daemon +ifeq (1,$(USE_DHCPV6)) + FLAGS_EXTRAS += --use-dhcpv6 endif + +# enable the ZEP dispatcher +FLAGS_EXTRAS += -z $(ZEP_PORT_BASE) + +# Configure terminal parameters +TERMDEPS += host-tools +TERMPROG_FLAGS = $(FLAGS_EXTRAS) $(ELFFILE) $(IPV6_PREFIX) +TERMPROG ?= sudo $(RIOTTOOLS)/zep_dispatch/start_network.sh $(TERMPROG_FLAGS) + +# -z [::1]:$PORT for each ZEP device +TERMFLAGS ?= $(patsubst %,-z [::1]:%, $(shell seq $(ZEP_PORT_BASE) $(ZEP_PORT_MAX))) diff --git a/examples/gnrc_border_router/README.md b/examples/gnrc_border_router/README.md index 9403554865..4e82c22d6f 100644 --- a/examples/gnrc_border_router/README.md +++ b/examples/gnrc_border_router/README.md @@ -24,6 +24,8 @@ This example comes with support for three uplink types pre-configured: For `native` the host-facing [`netdev_tap`](https://doc.riot-os.org/netdev__tap_8h.html) device is configured, providing connectivity via a TAP interface to the RIOT instance. +On the node-facing side [`socket_zep`](https://doc.riot-os.org/group__drivers__socket__zep.html) +is used to simulate a IEEE 802.15.4 network. To select an uplink, set the UPLINK environment variable. For instance, use `UPLINK=slip` for a SLIP uplink. @@ -143,6 +145,17 @@ On this example, such address can be pinged from 6lo motes: Thus far, IPv6 communication with between your PC and your motes is enabled. +### Simulated network with native + +On native a IEEE 802.15.4 network is simulated by encapsulating 802.15.4 frames +inside UDP packets. For this the `socket_zep` modules is used both on the border +router and on the virtual mote. + +The UDP packets are sent to a dispatcher which forwards them to all other nodes. +By default a simple dispatcher is provided that will forward every packet to +every node (perfect broadcast), but it can be replaced by the user with alternative +dispatchers to simulate more advanced topologies. + # gnrc_border_router with manual config You can use `ethos` as a standalone driver, if you want to setup the BR manually.