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

Please support IPv6 #3

Closed
kseistrup opened this issue Nov 7, 2019 · 8 comments
Closed

Please support IPv6 #3

kseistrup opened this issue Nov 7, 2019 · 8 comments

Comments

@kseistrup
Copy link

It seems gild connects exclusively over IPv4. Please support IPv6.

@xvxx
Copy link
Owner

xvxx commented Nov 14, 2019

Yes this would be great. Now that Gild is using https://github.com/dvkt/ldpl-socket I will look into adding IPv6 support to that package.

@Lartu
Copy link

Lartu commented Dec 19, 2019

@kseistrup I'm intrigued, why do you need IPv6 support? Are you trying to connect to an IPv6 address or trying to connect from an IPv6 address? Have you faced any errors?

This may sound strange, but I have never come across an IPv6 address (that I know of), so I'd like to know the use cases so we can support them better.

@kseistrup
Copy link
Author

why do you need IPv6 support?

I don't personally need IPv6 support as such, but every piece of networking software in 2019 ought to support IPv6.

If a piece of software (that supports IPv6) gets an IPv4 and an IPv6 address when looking up the IP address of a host, it will generally choose the IPv6 address (on Linux according to /etc/gai.conf), and generally – at least in my experience – nothing needs be done socket-wise.

It seems (from ldpl_socket.cpp) that gild is using gethostbyname() to look up a host address. The gethostbyname(3) on my box says that (1) it will return an IPv4 address, and (2) that the function is obsolete and that getaddrinfo(3) should be used instead: getaddrinfo() will use whichever kind of IP address is available:

The getaddrinfo() function combines the functionality provided by the gethostbyname(3) and getservbyname(3) functions into a single interface, but unlike the latter functions, getaddrinfo() is reentrant and allows programs to eliminate IPv4-versus-IPv6 dependencies.

Sounds like this is an easy fix.

@kseistrup
Copy link
Author

PS:

I have never come across an IPv6 address (that I know of)

If your device doesn't have an IPv6 address, you most likely haven't. But my devices will get both an IPv4 and an IPv6 address from the router and will favour IPv6 connections over IPv4 ditto.

Even if you don't get IPv6 from your ISP, you may at least have IPv6 on your loopback interface:

$ ifconfig lo
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 16206  bytes 1812911 (1.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16206  bytes 1812911 (1.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

where ::1 is the IPv6 equivalent of 127.0.0.1.

@xvxx
Copy link
Owner

xvxx commented Dec 19, 2019

@kseistrup Great, thanks for the tip about getaddrinfo()! I've updated https://github.com/dvkt/ldpl-socket to support both IPv4 and IPv6, and I've pushed a new release of Gild with support. I'm sure there are still some kinks in it so please let me know if anything isn't working. Thank you!

@xvxx xvxx closed this as completed Dec 19, 2019
@kseistrup
Copy link
Author

Sweet! I've just gone to bed, but I'll try the new version tomorrow. Thanks!

@kseistrup
Copy link
Author

Works like a charm! 👏

@Lartu
Copy link

Lartu commented Dec 20, 2019

I didn't know all that about IPv6, @kseistrup, thank you for telling me!

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