smoltcp icon indicating copy to clipboard operation
smoltcp copied to clipboard

Adds one-shot mDNS resolution

Open benbrittain opened this issue 1 year ago • 4 comments

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

benbrittain avatar Aug 22 '22 14:08 benbrittain

@thvdveld Is this the sort of change you review as well? It's relevant in a 6lowpan context.

benbrittain avatar Sep 22 '22 14:09 benbrittain

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.

thvdveld avatar Sep 22 '22 15:09 thvdveld

oh good! I'm glad you told me that because I literally just started a git bisect trying to figure out what broke :)

benbrittain avatar Sep 22 '22 15:09 benbrittain

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?

Dirbaio avatar Sep 25 '22 21:09 Dirbaio

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.

benbrittain avatar Sep 26 '22 14:09 benbrittain

Build succeeded:

bors[bot] avatar Sep 26 '22 15:09 bors[bot]