Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the DNS resolution in examples by default #21116

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

OlegHahm
Copy link
Member

@OlegHahm OlegHahm commented Jan 2, 2025

Contribution description

The example applications gnrc_networking and paho-mqtt are quite useful for testing and/or demonstrating RIOT's networking capabilities. For convenience the use of hostnames instead of IP addresses is preferable. So far, DNS resolution has been disabled by default. IMO it would be much nicer - particularly for newbies, if DNS resolution would work out of the box.

The downside: approx. 3k more ROM and about 160 Bytes more RAM usage (on ARM-Cortex). So, I expect this PR to fail on some constrained platforms. However, I think for an example application this is still bearable.

Testing procedure

Test with native

  1. Setup an upstream device for the tap bridge (for instance via dist/tools/tapsetup/tapsetup -c 1 -u eth0).
  2. Build and run paho-mqtt example via make -C example/paho-mqtt clean all term.
  3. Check if you can connect to the Mosquitto test broker via con test.mosquitto.org

Test on 6lowpan hardware

  1. Setup a border router with DNS resolver configured.
  2. Build and run paho-mqtt example for a board, for instance via BOARD=nrf52840dk make -C example/paho-mqtt clean all flash term.
  3. Check if you can connect to the Mosquitto test broker via con test.mosquitto.org

Issues/PRs references

Another PR which configures a DNS resolver on the 6lbr example by default is about to come.

@github-actions github-actions bot added the Area: examples Area: Example Applications label Jan 2, 2025
@OlegHahm OlegHahm force-pushed the pr/feature/enable_dns_in_examples_by_default branch from dcd6bec to 9f15342 Compare January 2, 2025 12:32
@mguetschow mguetschow added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 2, 2025
@mguetschow mguetschow requested review from miri64 and benpicco January 2, 2025 14:00
@riot-ci
Copy link

riot-ci commented Jan 2, 2025

Murdock results

✔️ PASSED

9f15342 paho-mqtt: enable DNS client

Success Failures Total Runtime
58 0 58 01m:46s

Artifacts

Comment on lines 20 to 22
# Optionally include remoteDNS 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's now longer optionally if it is the default? I mean, not wrong but sounds misleading. I also believe you should add a pointer that disabling it is safe and yields smaller builds.

# 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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might also want to enable the dns_cache module - otherwise you'll make a new DNS request each time you resolve an address.

Might be worth adding a dns_default pseudo-module that includes all that, so a user only has to enable a single module for full DNS support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: examples Area: Example Applications CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants