-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add hostname lookup support #43
base: master
Are you sure you want to change the base?
Conversation
Looks good. |
9ae8294
to
370f270
Compare
I found a couple of things while looking at using this implementation:
|
0d81181
to
97cca21
Compare
Why being so strict here?
Same? |
This is what nss-mdns does:
Because that's not a valid |
Note that I'm fine with removing those checks, that just means they would need to be done by clients. |
Good point. I would add a flag then inside the entries that are incorrect then. No? WDYT? |
I'll give it a try. |
I answered this because I thought I would be able to make sense of it in the morning, but I couldn't ;) Apart from checking that the hostname we're looking up matches one of the entries we received, we're not doing any checks once we've started listening to answers from the network. All of the checks are done ahead of time, when calling |
Yeah, I thought you were going to add a flag on entries to see if they do or do not respect the spec |
I've looked through this, and I don't think it's strictly necessary for this particular feature, but I can implement it as a separate PR. It would protect against dodgy answers from other network devices on the network, but that's already a problem with To implement this, I would need to pass the |
Don't skip over authoritative entries when receiving entries, otherwise we'll never send A or AAAA records.
As per https://www.rfc-editor.org/rfc/rfc952, "[n]o distinction is made between upper and lower case" in hostnames, so check whether the requested name matches the records we receive in a case insensitive way.
Allow foo.local not foo.bar.local, as per draft-cheshire-dnsext-multicastdns.txt This is the two-label limit heuristic, which is also implemented in the default avahi confifuration: https://github.com/lathiat/nss-mdns#etcmdnsallow
As implemented in the default avahi configuration: https://github.com/lathiat/nss-mdns#etcmdnsallow " If the request does not end with .local or .local., it is rejected. Example: example.test is rejected. "
Prints the IPv4, followed by the IPv6 address for the requested hostname, and exits. Closes: videolabs#41
Our network listening code might receive packets that were for a different request than the one we made. Make sure that we only call the callback when valid entries were received, and make it possible for clients to skip over invalid entries.
97cca21
to
b1dbacf
Compare
Was there anything else that would be needed to get this merged? |
Example output from the test tool (replaced the IPv6 address though):
$ ~/.cache/jhbuild/build/microdns/examples/host-lookup diskstation.local diskstation.local resolves to IPv4 address 192.168.1.68 diskstation.local resolves to IPv6 address ffff:fff:ffff:ffff:fff:ffff:fffff:fffff
Please check carefully.