-
Notifications
You must be signed in to change notification settings - Fork 2k
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
gcoap_dns: initial import of a DNS over CoAP (DoC) client #16705
Conversation
b3150a7
to
e8ae2d6
Compare
fbc59c5
to
1a09ec0
Compare
ddc08da
to
484306f
Compare
35b3c13
to
d71474e
Compare
d71474e
to
f25f272
Compare
Rebased since #16702 got merged. No longer waiting for other PRs (for the moment ;-)) |
f25f272
to
292cc4c
Compare
20caff0
to
a14dea1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good over-all, see comments (for many of which anything more than "because." can be a good answer).
I didn't check the credentials part too carefully, but it looks plausible enough. (It can probably be simplified if the credman API becomes easier to use; iterating through an array to find an empty slot is what I'd expect credman to do).
I didn't do a detailed check on the tests, but they look good from cursory reading, and do pass on native.
I'm running a few more practical tests, and expect to be done with them by the time the rest of the comments is through.
I also did some testing now, both on native and microbit-v2 via 6lowpan.
after applying roughly diff --git a/examples/gcoap/Makefile b/examples/gcoap/Makefile
index bcb3c4731e..648dbd4ca9 100644
--- a/examples/gcoap/Makefile
+++ b/examples/gcoap/Makefile
@@ -40,0 +41,2 @@ USEMODULE += ps
+USEMODULE += gcoap_dns
+
diff --git a/examples/gcoap/client.c b/examples/gcoap/client.c
index d22c62eac0..b483acfb58 100644
--- a/examples/gcoap/client.c
+++ b/examples/gcoap/client.c
@@ -30,0 +31 @@
+#include "net/gcoap/dns.h"
@@ -148,0 +150,2 @@ static bool _parse_endpoint(sock_udp_ep_t *remote,
+ gcoap_dns_server_uri_set("coap://[2a02:b18:c13b:8010::907]/dns");
+
@@ -151,2 +154,3 @@ static bool _parse_endpoint(sock_udp_ep_t *remote,
- puts("gcoap_cli: unable to parse destination address");
- return false;
+ if (gcoap_dns_query(addr_str, &remote->addr, AF_INET6) < 0 ) {
+ return false;
+ } and running aiodnsprox locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is only one unresolved comment left, in #16705 (comment), but that's really more about a to-be-opened unrelated issue, so it can stay unresolved.
I consider this ready. Thanks for adding this, please finalize.
Squashed. |
07fec5e
to
c0592b6
Compare
c0592b6
to
d7dd28a
Compare
Mphff again needing to account for Python 3.5 (or outdated python libs) oddities:
|
d7dd28a
to
1703f89
Compare
With Python 3.10, using |
(also confirmed with python 3.7, older versions I am too lazy to test :P) |
The Python change looks good (why was there a
|
1703f89
to
c9b7870
Compare
That older scapy version seems to be in-consistent in itself... I pass a string as rdata, but it complains that it is not a string when handed to |
Pre-encoded the |
c9b7870
to
152765d
Compare
Can reproduce the remaining test error. Will check. |
152765d
to
88dd1e5
Compare
Oops, that actually spotted an off-by-one error in the test application. Fixed with the latest force push. Curious that that only was an issue on ESP32... probably because its |
Thanks for the review! |
Contribution description
This provides a DNS-over-CoAPS (DoC) client prototype implementation using
gcoap
. The protocol design itself is heavily inspired by DoH, but has some additional features (such as FETCH support) that I got after a short brainstorming session with @chrysn. The main use case is encrypted DNS communication, so onlycoaps://
resources are allowed as a target for now. Long-term plans to add OSCORE support exist as well.This PR serves merely to show an implementation prototype of said protocol. For discussions on protocol design, please refer to the repository for the DoC draft.
TODO:
Testing procedure
Just run
for any board you like.
If you want to test CoAPS behavior or more complex setups (e.g. with proxies), install https://github.com/anr-bmbf-pivot/aiodnsprox/
Run e.g.
sudo dist/tools/tapsetup/tapsetup sudo ip addr add 2001:db8::1 dev tapbr0 sudo ip route add 2001:db8::/64 via "<native link-local>" dev tapbr0 ./aiodns-proxy -c 2001:db8::1 -U 8.8.8.8 --dtls-credentials client_identity secretPSK
and in a different shell
(for non-native/non-Ethernet boards you also will need a border router)
One should also be able to run the tests without CoAPS support by setting
COAPS=0
in the environment variables at compile time.Issues/PRs references
Depends on PRs
#16669, #16695(merged),#16702, #16709, #16712(merged).