smoltcp
smoltcp copied to clipboard
Adds one-shot mDNS resolution
RFC 6762 Section 5.1 specifies a one-shot multicast DNS query. This query has minimal differences from a standard DNS query, mostly just using a multicast address and a different port (5353 vs 53).
A fully standards compliant mDNS implementation would use UDP source port 5353 as well to issue queries, however we MUST NOT use that port and continue using an ephemeral port until features such as service discovery are implemented.
This change also allows specifying what kind of DNS query we wish to perform.
https://www.rfc-editor.org/rfc/rfc6762#section-5.1
@thvdveld Is this the sort of change you review as well? It's relevant in a 6lowpan context.
I'm not very familiar with DNS, so I don't feel comfortable reviewing this. But I'll take a look at it tomorrow!
Also, a change slipped into master that messed with 6LoWPAN fragmentation, the fix is in #681.
oh good! I'm glad you told me that because I literally just started a git bisect trying to figure out what broke :)
Looks good to me overall. Could you add a Cargo feature for MDNS, so that binaries not using it don't get increased code size?
I don't think this will have much meaningful code size, but I created a feature. I think future mDNS service discovery functionality should also go under that feature set.
I left the mdns enum inside the PendingQuery
struct intentionally. with "socket-mdns" disabled, it should be trivially optimized out and it keeps the cfg flow less confusing below. Happy to make the removal from the PendingQuery struct explicit if you'd prefer though.