Skip to content
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 support for IPv6 #10

Open
troglobit opened this issue Aug 1, 2018 · 13 comments
Open

Add support for IPv6 #10

troglobit opened this issue Aug 1, 2018 · 13 comments
Milestone

Comments

@troglobit
Copy link
Owner

... should be fairly simple actually. Replace all the relevant parts of the code with struct sockaddr_storage

@troglobit troglobit added this to the v1.0 milestone Aug 12, 2018
@Muddasir-Shakil
Copy link

Hello,
is there any support for IPv6? Thank you .

@troglobit
Copy link
Owner Author

Hi! No that's why we keep this issue open :-)

IPv6 is targeted at v1.0, as hinted by the milestone on the right-hand side of this report.

@fzs
Copy link
Contributor

fzs commented Aug 9, 2022

I notice that currently only one (IPv4) address is supported per interface. The interface list is indexed by interface name, which allows for only one entry per interface,
When adding IPv6 support, you will get multiple ifaddr elements with the same interface name (like when having multiple IPv4 addresses on one interface).
Is the limitation to one address by design?
Would you consider an interface with an IPv4 and an IPv6 address as two separate entries in the iface list, each with their own mdns_daemen_t instance?

@troglobit
Copy link
Owner Author

No, it's not by design. I've noticed this too, but not had time to look into it myself. Not sure yet what's the best approach, I'm open to ideas, even half baked RFC type pull requests are sometimes easier to discuss concepts around and prototype with.

@fzs
Copy link
Contributor

fzs commented Aug 11, 2022

Then I would probably for now ignore multiple IPv4 addresses on an interface, and check for interface name and address family, so that one iface per interface is created for IPv4 and IPv6 each.

@troglobit
Copy link
Owner Author

Sounds like a reasonable approach in the short-term, yes.

@fzs
Copy link
Contributor

fzs commented Aug 11, 2022

Well, my reasoning is that it needs separate iface instances for IPv4 and IPv6, because they are different address families. Having separate mdns_daemon_t instances should make the code easier.
Since the daemon listens for multicast packages, it will receive the packet no matter what logical IPv4 net the sender is in on that interface's network. So the only question is which address to announce for a service and which address is used as the source address when sending an answer. (Not as easy for mquery.) I see that avahi decided to only use one address for a multi-homed interface, so I reckon this could be a good first approach, when adding IPv6 support.

@Muddasir-Shakil
Copy link

Muddasir-Shakil commented Aug 11, 2022

hi @fzs
thanks for taking this over. I added ipv6 support to the one of the fork of mdnsd. You can find my work here mdnsdipv6. The goal was to support ipv6 in open62541 (OPC UA stack) for mdns discovery. I hope this also helps. The integration of ipv6 is done here.

@troglobit
Copy link
Owner Author

@fzs yeah I've been looking at the options myself, and really wanted to improve on things in this regard. Small incremental steps in the direction of where we want to go is better than a huge overhaul. If you want to take the lead on that it would be great!

@Muddasir-Shakil awesome, thank you for the input!

@fzs
Copy link
Contributor

fzs commented Aug 12, 2022

@Muddasir-Shakil , I did see your PR. I was a bit puzzled because we had to do quite a bit more changes to add IPv6 support than what I saw in your commits. I'm currently going over the code an adding in our changes, keeping yours in mind.

@fzs
Copy link
Contributor

fzs commented Aug 17, 2022

I am rethinking this. I would like to be able to send A and AAAA responses both over IPv4 and IPv6. So an interface that has an IPv4 and a IPv6 address should be able to be announced in one IPv4 mDNS response.
Therefore a mdnsd instance would need to know both addresses.

I would currently still start with ignoring multiple addresses of the same address family, but add an struct in6_addr member to the mdnsd struct. I am not sure yet how to set both addresses when an interface has both assigned. I still think it makes sense to have separate mdnsd instances for the two address families in order to make socket handling easier. Just that each instance knows both the IPv4 and IPv6 address as an attribute so that they can both be added to responses.

@troglobit
Copy link
Owner Author

Hmm, yeah that sounds like a good idea ... I think. What does avahi do?

@fzs fzs mentioned this issue Aug 18, 2022
@fzs
Copy link
Contributor

fzs commented Aug 18, 2022

Uh, good question. I traced mDNS traffic from my iPhone and iPad, and saw that they will send A and AAAA records in mDNS responses over IPv4 (and IPv6).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants