gnrc_ipv6_nib: Add capability to handle and send RDNSS option#8646
gnrc_ipv6_nib: Add capability to handle and send RDNSS option#8646smlng merged 7 commits intoRIOT-OS:masterfrom
Conversation
bf067c5 to
44529ea
Compare
|
Ping @bergzand @kaspar030 @smlng this would allow us to finally include DNS into |
| USEMODULE += sock_util | ||
| endif | ||
|
|
||
| ifneq (,$(filter sock_util,$(USEMODULE))) |
There was a problem hiding this comment.
seems unrelated, at least for this PR its usage is unclear
There was a problem hiding this comment.
The commit is describing the change sufficiently enough IMHO: 3b79b2c
There was a problem hiding this comment.
But to explain it more in-depth: sock_util requires POSIX, but this wasn't declared when it was introduced. This PR uses sock_util via sock_dns and thus the module is not compilable if the user does not explicitly include posix.
| return pkt; | ||
| } | ||
|
|
||
| gnrc_pktsnip_t *gnrc_ndp_opt_rdnss_build(uint32_t ltime, ipv6_addr_t *addrs, |
There was a problem hiding this comment.
this function is only used with GNRC_IPV6_NIB_CONF_DNS, IMHO the internal #if is not needed, but compiler might complain about unused function if DNS is not used?!
There was a problem hiding this comment.
This is a public function. The unused function warning does not apply here.
There was a problem hiding this comment.
I tried without the '#if` guard and it works so no need for this ugly construct. Hence, you can remove the preprocessor if and omit the else path for unused params.
There was a problem hiding this comment.
But then it will be compiled in, when we don't use DNS...
There was a problem hiding this comment.
(aka the code size will be affected)
There was a problem hiding this comment.
Ok. It isn't. Will remove.
There was a problem hiding this comment.
yep, just wanted to report the same:
this PR
55104 508 14972 70584 113b8 /RIOT/tests/gnrc_sock_dns/bin/samr21-xpro/tests_gnrc_sock_dns.elf
47108 144 7252 54504 d4e8 /RIOT/tests/gnrc_ipv6_nib/bin/samr21-xpro/tests_gnrc_ipv6_nib.elf
without pre-if
55104 508 14972 70584 113b8 /RIOT/tests/gnrc_sock_dns/bin/samr21-xpro/tests_gnrc_sock_dns.elf
47108 144 7252 54504 d4e8 /RIOT/tests/gnrc_ipv6_nib/bin/samr21-xpro/tests_gnrc_ipv6_nib.elf
| #define DNS_MIN_REPLY_LEN (unsigned)(sizeof(sock_dns_hdr_t ) + 7) | ||
|
|
||
| /* global DNS server UDP endpoint */ | ||
| sock_udp_ep_t sock_dns_server; |
There was a problem hiding this comment.
is one global DNS server sufficient?
There was a problem hiding this comment.
I hoped that this could be const for some use-cases, but I'm OK with moving it here for now.
There was a problem hiding this comment.
is one global DNS server sufficient?
For now it should be. Your local LAN usually also is happy with just one ;-).
| } | ||
| else { | ||
| evtimer_del(&_nib_evtimer, &_rdnss_timeout.event); | ||
| memset(&sock_dns_server, 0, sizeof(sock_dns_server)); |
There was a problem hiding this comment.
shouldn't this use _handle_rdnss_timeout too?
There was a problem hiding this comment.
I'm not so sure, if replacing one function with another calling that function makes a difference, but if you insist...
kaspar030
left a comment
There was a problem hiding this comment.
ACK for the changes to sock_dns.
| #define DNS_MIN_REPLY_LEN (unsigned)(sizeof(sock_dns_hdr_t ) + 7) | ||
|
|
||
| /* global DNS server UDP endpoint */ | ||
| sock_udp_ep_t sock_dns_server; |
There was a problem hiding this comment.
I hoped that this could be const for some use-cases, but I'm OK with moving it here for now.
|
Adressed comments. |
|
@smlng agree? |
8bfc522 to
b365d4a
Compare
|
Rebased |
|
please squash |
| #if GNRC_IPV6_NIB_CONF_DNS | ||
| static void _handle_rdnss_timeout(sock_udp_ep_t *dns_server) | ||
| { | ||
| memset(&dns_server, 0, sizeof(sock_udp_ep_t)); |
There was a problem hiding this comment.
dns_server is a pointer already, hence should be memset(dns_server, 0, sizeof(sock_udp_ep_t));? at least on macOS I get compile error:
/RIOT/sys/net/gnrc/network_layer/ipv6/nib/nib.c:1255:5: error: '__builtin___memset_chk' will always overflow destination buffer [-Werror,-Wbuiltin-memcpy-chk-size]
memset(&dns_server, 0, sizeof(sock_udp_ep_t));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:76:3: note: expanded from macro 'memset'
__builtin___memset_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
There was a problem hiding this comment.
Oops (but what did you use to compile that finds this type confusion)
There was a problem hiding this comment.
We really should start having a clang config for the CI ;-).
| */ | ||
| static void _handle_mtuo(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, | ||
| const ndp_opt_mtu_t *mtuo); | ||
| static uint32_t _handle_rdnsso(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6, |
There was a problem hiding this comment.
needs to be guarded with #if GNRC_IPV6_NIB_CONF_DNS, got error:
/RIOT/sys/net/gnrc/network_layer/ipv6/nib/nib.c:405:17: error: unused function '_handle_rdnsso' [-Werror,-Wunused-function]
static uint32_t _handle_rdnsso(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
^
1 error generated.
otherwise
| return pkt; | ||
| } | ||
|
|
||
| gnrc_pktsnip_t *gnrc_ndp_opt_rdnss_build(uint32_t ltime, ipv6_addr_t *addrs, |
There was a problem hiding this comment.
I tried without the '#if` guard and it works so no need for this ugly construct. Hence, you can remove the preprocessor if and omit the else path for unused params.
| } | ||
| } | ||
| } | ||
| #if SOCK_HAS_IPV6 |
There was a problem hiding this comment.
does this make sense, I would assume if GNRC_IPV6_NIB_CONF_DNS is true, we have IPv6 support?
There was a problem hiding this comment.
IPv6-support for sock is independent of GNRC's inclusion of GNRC. So it makes sense.
There was a problem hiding this comment.
from sys/Makefile.include:
ifneq (,$(filter gnrc_sock,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/gnrc/sock/include
ifneq (,$(filter gnrc_ipv6,$(USEMODULE)))
CFLAGS += -DSOCK_HAS_IPV6
endif
endif
Hence, I would (recursively) resolve/deduce GNRC_IPV6_NIB_CONF_DNS -> GNRC_IPV6 -> SOCK_HAS_IPV6.
There was a problem hiding this comment.
I'd rather prefer to keep the dependency explicit as it is instead of implicit, which addressing this change would make it.
|
Adressed comments. |
|
May I squash? |
|
Ping? |
smlng
left a comment
There was a problem hiding this comment.
Tested ACK, works with tests/gnrc_sock_dns on native according to readme. Note: one problem I had was that the firewall on Fedora is active by default and blocks DNS, after explicitly allowing DNS on tap0 it work as expected.
|
please squash, and trigger CI when ready. |
|
|
f050cb6 to
fa9315a
Compare
|
I would rather go for rebase, I just ACKed #9498 so we can move both forward. IMHO its better to have the dependency update separate, okay? |
|
Okay! |
fa9315a to
b0fb99d
Compare
|
Rebased! :-) |
b0fb99d to
95c1992
Compare
|
Fixed and squashed error reported by Travis. |
|
@smlng Ok to merge? |
|
🎉 |
|
@danpetry @bergzand now that this is merged, this might help you with your respective works (if the RAdvD is configured correctly [@smlng maybe something to consider to put in the example config @RIOT-Makers?] and the applications you write use |
Contribution description
With the RDNSS option
sock_dnscan be auto-configured by the administrative router (either the border router or the upstream router configuring the border router).Also some fixes/convenience enhancements to
sock_dnsandsock_utilpiggy-backed.Issues/PRs references
None