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

How best to implement IPv6? #20

Open
mon opened this issue Apr 23, 2024 · 2 comments
Open

How best to implement IPv6? #20

mon opened this issue Apr 23, 2024 · 2 comments

Comments

@mon
Copy link
Contributor

mon commented Apr 23, 2024

I've been wanting to poke around with IPv6 multicast for a while, and I've collected some thoughts that might turn into an implementation at some point...

The first thing is that dual-stack sockets aren't really feasible, because OpenBSD disables them for security reasons. The second is that the multicast address is of course different when in the IPv6 space (unless you use the "IPv4 mapped into the IPv6 space" address, but I'm not sure if that's allowed on OpenBSD).

So either we accept all address types and have 2 sockets internally, or just bump the work down to the user and have a MulticastSocketV4 and MulticastSocketV6. I think this is probably best, I've never seen any use for both V4 and V6 at the same time.

Then, the question is whether to have a generic MulticastSocket<T> where T is either Ipv4Addr or Ipv6Addr, or actually split the implementation... somehow. Macros? Just repeat the code and have some helper functions?

I'm not really sure of the best way to do it and would appreciate any input! On a technical level, it seems like both the unix and windows APIs can happily work with ipv6.

@bltavares
Copy link
Owner

I'm personally not much familiar with the IPv6 multicast world. I've designed this library mostly to cover the usecase of IPv4 Broadcast across all interfaces, for things such as MDNS and p2p applications to find each other.

As IPv6 Multicast does not have a broadcast address anymore, I'm unsure what is the usecase for it.

Could you share more about usecases of ipv6 multicast so I can learn more about, and reason around it, please?

@mon
Copy link
Contributor Author

mon commented Apr 29, 2024

I'm also quite unfamiliar with IPv6 multicast, so I hope it's not "blind leading the blind"...

Basically, my main use of this library is connecting to a CAN->Ethernet bridge like this one. It emits and receives packets exclusively over UDP multicast. No broadcast at all! So you basically just add yourself to its multicast group and start receiving packets (and my reason for using this library: from potentially many devices attached to multiple adapters).

IPv4 link local works, kind of, but it's a bit painful. I really like the idea of IPv6 link local, because then you can have a local network setup where a bunch of separate devices can talk to each other without needing static IPs or for someone to act as a DHCP server.

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

2 participants