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

IPv6 Link Local Addresses #153

Open
shehzadkhawar opened this issue Jul 22, 2016 · 4 comments
Open

IPv6 Link Local Addresses #153

shehzadkhawar opened this issue Jul 22, 2016 · 4 comments

Comments

@shehzadkhawar
Copy link

shehzadkhawar commented Jul 22, 2016

While testing libmill on to my IPv6 enabled cluster, I noticed the following.

My cluster uses IPv6 Link Local Addresses (fe80:: network prefixes). There is no consideration (correct me if i am wrong) on setting the link-local sin6_scope_id [1] in the libmill. So libmill does only work with global IPv6 addresses and does not work with link local addresses.

Similarly if one sets IPv6 link local address like this, they will get nothing

./test fe80::230:48ff:fefc:eb00 5555
ipaddr raddr = ipremote(, atoi(argv[2]), IPADDR_IPV6, -1);
ERROR: Network is unreachable

./test fe80::230:48ff:fefc:eb00**/64** 5555
ipaddr raddr = ipremote(, atoi(argv[2]), IPADDR_IPV6, -1);
NOTE: ipremote stucks

./test fe80::230:48ff:fefc:eb00**%eth0** 5555
ipaddr raddr = ipremote(, atoi(argv[2]), IPADDR_IPV6, -1);
NOTE: ipremote stucks

In the code there is no such parameter which sets the link local scope. Even if I do that, I don't pass through the ipremote function call.

References:

1- http://man7.org/linux/man-pages/man7/ipv6.7.html
2- see comment section, especially in the middle and at the end http://www.electronicsfaq.com/2012/12/simple-tcp-client-server-sockets.html

@sustrik
Copy link
Owner

sustrik commented Jul 22, 2016

Yes, it sucks. The whole IPv6/string conversion business sucks.

Feel free to propose a solution. IIRC there is an RFC with best practices for this...

@shehzadkhawar
Copy link
Author

Just updated this on my system (ip.c) and it works like a charm in my tests

https://gist.github.com/shehzadkhawar/cebdfc01659030fb7dedb6eb6601c6a4

If you think that is good enough, can you kindly push it, I am unable to do since I have many fragments which I don't want to be pushed here for now

@sustrik
Copy link
Owner

sustrik commented Aug 9, 2016

Can you please send a pull request and state that it's submitted under MIT/X11 license?

@sustrik
Copy link
Owner

sustrik commented Aug 10, 2016

I've re-read RFC 4007, specifically section 11. It turns out it's not that easy. If the node has two interfaces, both can have the same link-local address. To disambiguate zone index should be added (e.g. fe80::1234%1). Picking the first one as in your patch may lead to non-deterministic name resolution. The rfc even suggest disambiguation based on interface names (e.g. fe80::1234%eth0).

inet_pton is not able to parse that kind of address string.

However, at least in theory, getaddrinfo() should be able to parse IP addresses with zone IDs. I haven't tested it though.

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