From e668ac4f65de7ef239be25bfb86bb3e9f4e9a9a9 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Thu, 2 Jan 2025 13:28:07 +0100 Subject: [PATCH 1/2] examples/gnrc_border_router: set DNS resolver For convenience, it would be nice to have DNS resolution enabled by default in the examples. Hence, this patch configures a default DNS resolver on the 6lbr example and propagates its via RDNSS option in RAs to the nodes. --- examples/gnrc_border_router/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/gnrc_border_router/Makefile b/examples/gnrc_border_router/Makefile index c52d31ce92bf..0089fcf08bf1 100644 --- a/examples/gnrc_border_router/Makefile +++ b/examples/gnrc_border_router/Makefile @@ -39,8 +39,9 @@ USEMODULE += ps # Optionally include DNS support. This includes resolution of names at an # upstream DNS server and the handling of RDNSS options in Router Advertisements # to auto-configure that upstream DNS server. -#USEMODULE += sock_dns # include DNS client -#USEMODULE += gnrc_ipv6_nib_dns # include RDNSS option handling +USEMODULE += sock_dns # include DNS client +USEMODULE += gnrc_ipv6_nib_dns # include RDNSS option handling +USEMODULE += auto_init_sock_dns # configure default DNS resolver # When using a regular network uplink we should use DHCPv6 ifneq (,$(filter cdc-ecm wifi ethernet,$(UPLINK))$(REUSE_TAP)) From 115b8d95ef4d2e4b777b8bfa961fc6ad902be969 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Tue, 28 Jan 2025 19:39:05 +0100 Subject: [PATCH 2/2] examples/gnrc_border_router: add DNS option Introduces two Makefile switches for enabling DNS resolution and caching. --- examples/gnrc_border_router/Makefile | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/examples/gnrc_border_router/Makefile b/examples/gnrc_border_router/Makefile index 0089fcf08bf1..8a4b9bdb33df 100644 --- a/examples/gnrc_border_router/Makefile +++ b/examples/gnrc_border_router/Makefile @@ -10,6 +10,14 @@ RIOTBASE ?= $(CURDIR)/../.. # Default to using ethos for providing the uplink when not on native UPLINK ?= ethos +# If enabled will configure a default DNS resolver and propagate it via the +# RDNSS option to the hosts +ENABLE_DNS ?= 1 +# If the above setting is active this setting will also enable DNS caching, +# consequently dedicating some more memory space in order to reduce DNS +# requests +ENABLE_DNS_CACHING ?= 1 + # Check if the selected Uplink is valid ifeq (,$(filter ethos slip cdc-ecm wifi ethernet,$(UPLINK))) $(error Supported uplinks are `ethos`, `slip`, `cdc-ecm`, `ethernet` and `wifi`) @@ -39,9 +47,14 @@ USEMODULE += ps # Optionally include DNS support. This includes resolution of names at an # upstream DNS server and the handling of RDNSS options in Router Advertisements # to auto-configure that upstream DNS server. -USEMODULE += sock_dns # include DNS client -USEMODULE += gnrc_ipv6_nib_dns # include RDNSS option handling -USEMODULE += auto_init_sock_dns # configure default DNS resolver +ifneq (0,$(ENABLE_DNS)) + USEMODULE += sock_dns # include DNS client + USEMODULE += gnrc_ipv6_nib_dns # include RDNSS option handling + USEMODULE += auto_init_sock_dns # configure default DNS resolver + ifneq (0,$(ENABLE_DNS_CACHING)) + USEMODULE += dns_cache # cache DNS responses + endif +endif # When using a regular network uplink we should use DHCPv6 ifneq (,$(filter cdc-ecm wifi ethernet,$(UPLINK))$(REUSE_TAP))