mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
examples/gnrc_border_router: add option to re-use existing TAP interface
This commit is contained in:
parent
e802203b19
commit
5260c18ae6
15
dist/tools/zep_dispatch/start_network.sh
vendored
15
dist/tools/zep_dispatch/start_network.sh
vendored
@ -25,7 +25,9 @@ remove_tap() {
|
||||
|
||||
cleanup() {
|
||||
echo "Cleaning up..."
|
||||
remove_tap
|
||||
if [ "${CREATE_TAP}" -eq 1 ]; then
|
||||
remove_tap
|
||||
fi
|
||||
if [ -n "${UHCPD_PID}" ]; then
|
||||
kill "${UHCPD_PID}"
|
||||
fi
|
||||
@ -64,6 +66,13 @@ start_zep_dispatch() {
|
||||
ZEP_DISPATCH_PID=$!
|
||||
}
|
||||
|
||||
if [ "$1" = "-c" ] || [ "$1" = "--create-tap" ]; then
|
||||
CREATE_TAP=1
|
||||
shift 1
|
||||
else
|
||||
CREATE_TAP=0
|
||||
fi
|
||||
|
||||
if [ "$1" = "-d" ] || [ "$1" = "--use-dhcpv6" ]; then
|
||||
USE_DHCPV6=1
|
||||
shift 1
|
||||
@ -101,7 +110,9 @@ for TAP in "$@"; do :; done
|
||||
|
||||
trap "cleanup" INT QUIT TERM EXIT
|
||||
|
||||
create_tap
|
||||
if [ ${CREATE_TAP} -eq 1 ]; then
|
||||
create_tap
|
||||
fi
|
||||
|
||||
if [ ${USE_ZEP_DISPATCH} -eq 1 ]; then
|
||||
start_zep_dispatch
|
||||
|
@ -43,7 +43,7 @@ USEMODULE += ps
|
||||
#USEMODULE += gnrc_ipv6_nib_dns # include RDNSS option handling
|
||||
|
||||
# When using a regular network uplink we should use DHCPv6
|
||||
ifneq (,$(filter cdc-ecm wifi ethernet,$(UPLINK)))
|
||||
ifneq (,$(filter cdc-ecm wifi ethernet,$(UPLINK)) $(REUSE_TAP))
|
||||
PREFIX_CONF ?= dhcpv6
|
||||
else
|
||||
PREFIX_CONF ?= uhcp
|
||||
|
@ -9,10 +9,14 @@ 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 (dhcpv6,$(PREFIX_CONF))
|
||||
FLAGS_EXTRAS += --use-dhcpv6
|
||||
else ifeq (auto_subnets,$(PREFIX_CONF))
|
||||
FLAGS_EXTRAS += --use-radvd
|
||||
# create a new TAP interface if not re-using an existing one
|
||||
ifneq (1, $(REUSE_TAP))
|
||||
FLAGS_EXTRAS += --create-tap
|
||||
ifeq (dhcpv6,$(PREFIX_CONF))
|
||||
FLAGS_EXTRAS += --use-dhcpv6
|
||||
else ifeq (auto_subnets,$(PREFIX_CONF))
|
||||
FLAGS_EXTRAS += --use-radvd
|
||||
endif
|
||||
endif
|
||||
|
||||
# enable the ZEP dispatcher
|
||||
|
@ -44,6 +44,21 @@ credentials. You can alternatively edit the `Makefile`.
|
||||
Currently, `wifi` requires an esp8266 or esp32 for the border router and will default
|
||||
to using `esp_now` for the downstream interface.
|
||||
|
||||
### Connection sharing with host
|
||||
|
||||
If the host (Linux) computer has an IPv6 uplink that can be shard with the RIOT border
|
||||
router to provide it with an uplink.
|
||||
|
||||
This requires the host network to be bridged with the TAP network by connecting it to
|
||||
the TAP bridge:
|
||||
|
||||
sudo dist/tools/tapsetup/tapsetup -u eno1
|
||||
|
||||
where `eno1` is the host's uplink interface.
|
||||
|
||||
Then specify `REUSE_TAP=1` when building / running the border router application.
|
||||
This works with both `native` and the `ethos` uplink.
|
||||
|
||||
## Requirements
|
||||
This functionality works only on Linux machines.
|
||||
macOS support will be added in the future (lack of native `tap` interface).
|
||||
|
Loading…
Reference in New Issue
Block a user