- usage of gethostbyname() in getaddr()
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all!
When reviewing the patch "FQDN for routes should expand to all IPs" today, I spotted that there is a function called getaddr() (renamed to getaddr_all() in the mentioned patch). This function again makes use of the old gethostbyname() function. This is not compatible with IPv6 addresses.
I would strongly recommend a move to getaddrinfo() instead. This is based on an article [1] written by Ulrich Drepper, who is a glibc maintainer. Any thoughts about that? It might even be more functions needing to be ported as well. The mentioned article lists most important functions which should be ported to newer APIs.
Any comments on this issue would be appreciated. Another issue is of course how this will influence other platforms than Linux.
kind regards,
David Sommerseth
[1] <http://people.redhat.com/drepper/userapi-ipv6.html>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkt783AACgkQDC186MBRfrrIxgCgnpCvbJMWzxutz4You8Qj8Qki DFcAoJp5eGTHkee7Lz6AU+gKl5BOXiNv
=5ITZ
-----END PGP SIGNATURE-----
Hi,
Quoted 5 lines · David Sommerseth
When reviewing the patch "FQDN for routes should expand to all IPs" today, I spotted that there is a function called
getaddr()(renamed togetaddr_all()in the mentioned patch). This function again makes use of the oldgethostbyname()function. This is not compatible with IPv6 addresses.
This is actually "existing code", and not something changed by the patch (just to point that out to readers that have not reviewed the patch).
Quoted 8 lines
I would strongly recommend a move to
getaddrinfo()instead. This is based on an article [1] written by Ulrich Drepper, who is a glibc maintainer. Any thoughts about that? It might even be more functions needing to be ported as well. The mentioned article lists most important functions which should be ported to newer APIs.Any comments on this issue would be appreciated. Another issue is of course how this will influence other platforms than Linux.
Well, let me answer the second thing first (because I've spent a while thinking about this and whether I want to make the IPv6 payload stuff #ifdef'ed from the start).
On the Unix side of things, I'm fairly sure that any platform recent enough to have tun/tap support (which isn't all of them, just *BSD, Solaris, Linux and MacOS) also has getaddrinfo() and IPv6.
I don't know a thing about Windows programming, though.
OpenSSH tackles this by providing their own getaddrinfo() function (from OpenBSD) if the system has no such function, or if it is broken, and "configure" seems to do a good job in deciding what to do.
Now, on the question of whether we want / should use it. Right now, the "upstream" code only uses gethostbyname() because it wouldn't know what to do with an IPv6 record anyway, if any such record were to be returned - the code is used for connection handling (IPv4 only) and for setting routes to FQDN (again, IPv4 only).
In the long term, this whole area of the code will see some changes :-)
- when merging jjo's tree, we should already see use of getaddrinfo() for connection handling, and if people see the need for it, I might need to implement setting of IPv6 routes to FQDN targets.
So... if you'd ask me what I would to today, the answer would be "leave the code as it is, merge jjo's code, and then revisit what he already had to change for IPv6 connection handling". If gethostbyname() is still there, come back and make this lookup function v4- and v6-capable, and implement FQDN routes for IPv6 :-)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 30 lines · Gert Doering
Hi,
Quoted 5 lines · David Sommerseth
When reviewing the patch "FQDN for routes should expand to all IPs" today, I spotted that there is a function called
getaddr()(renamed togetaddr_all()in the mentioned patch). This function again makes use of the oldgethostbyname()function. This is not compatible with IPv6 addresses.This is actually "existing code", and not something changed by the patch (just to point that out to readers that have not reviewed the patch).
Quoted 8 lines
I would strongly recommend a move to
getaddrinfo()instead. This is based on an article [1] written by Ulrich Drepper, who is a glibc maintainer. Any thoughts about that? It might even be more functions needing to be ported as well. The mentioned article lists most important functions which should be ported to newer APIs.Any comments on this issue would be appreciated. Another issue is of course how this will influence other platforms than Linux.
Well, let me answer the second thing first (because I've spent a while thinking about this and whether I want to make the IPv6 payload stuff #ifdef'ed from the start).
On the Unix side of things, I'm fairly sure that any platform recent enough to have tun/tap support (which isn't all of them, just *BSD, Solaris, Linux and MacOS) also has
getaddrinfo()and IPv6.
Quoted 5 lines
I don't know a thing about Windows programming, though.
OpenSSH tackles this by providing their own
getaddrinfo()function (from OpenBSD) if the system has no such function, or if it is broken, and "configure" seems to do a good job in deciding what to do.
Sounds clever. I believe PuTTY got IPv6 support, which might give a clue for a Windows implementation. But I'm not a Windows coder, so I won't be able to contribute too much in this area. Windows coders, please share your thoughts here!
Quoted 12 lines
Now, on the question of whether we want / should use it. Right now, the "upstream" code only uses
gethostbyname()because it wouldn't know what to do with an IPv6 record anyway, if any such record were to be returned - the code is used for connection handling (IPv4 only) and for setting routes to FQDN (again, IPv4 only).In the long term, this whole area of the code will see some changes :-)
- when merging jjo's tree, we should already see use ofgetaddrinfo()for connection handling, and if people see the need for it, I might need to implement setting of IPv6 routes to FQDN targets.
Quoted 5 lines
So... if you'd ask me what I would to today, the answer would be "leave the code as it is, merge jjo's code, and then revisit what he already had to change for IPv6 connection handling". If
gethostbyname()is still there, come back and make this lookup function v4- and v6-capable, and implement FQDN routes for IPv6 :-)
Sounds very sensible. I am of the same opinion, it's anyway something we need to be aware of, as we're now working more and more in implementing IPv6 support.
Thank you, Gert, for taking the time answering this. And I did give you a copy, just because I know your background with the IPv6 patches :)
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkt8HNYACgkQDC186MBRfrodhACaA3s/veqT1x70wYlEEfhNm4Ea YZoAn0Ns/QLo57S9X/QrwwQ/RZBO5W07
=+kCC
-----END PGP SIGNATURE-----
Quoted 11 lines · David Sommerseth
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Hi all!
When reviewing the patch "FQDN for routes should expand to all IPs" today, I spotted that there is a function called
getaddr()(renamed togetaddr_all()in the mentioned patch). This function again makes use of the oldgethostbyname()function. This is not compatible with IPv6 addresses.
Quoted 8 lines
I would strongly recommend a move to
getaddrinfo()instead. This is based on an article [1] written by Ulrich Drepper, who is a glibc maintainer. Any thoughts about that? It might even be more functions needing to be ported as well. The mentioned article lists most important functions which should be ported to newer APIs.Any comments on this issue would be appreciated. Another issue is of course how this will influence other platforms than Linux.
Plenty adhere to this.
In my ipv6 transport patch I only use getaddrinfo()/getnameinfo(), not only for the 'nixes, but also for the win32 build (x-compiled under Linux with mingw32xxx and tested under wine by me and by other fellow in the field [1] ).
[1] http://github.com/jjo/openvpn-ipv6/downloads
naked openvpn.exe built w/ipv6 transport support
Quoted 27 lines
kind regards,
David Sommerseth
[1] <http://people.redhat.com/drepper/userapi-ipv6.html>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/iEYEARECAAYFAkt783AACgkQDC186MBRfrrIxgCgnpCvbJMWzxutz4You8Qj8Qki DFcAoJp5eGTHkee7Lz6AU+gKl5BOXiNv
=5ITZ
-----END PGP SIGNATURE-----------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Signature · 1 line
--JuanJo ; echo [email protected]... | sed 's/[SPAM]//g'
Quoted 5 lines
When reviewing the patch "FQDN for routes should expand to all IPs" today, I spotted that there is a function called
getaddr()(renamed togetaddr_all()in the mentioned patch). This function again makes use of the oldgethostbyname()function. This is not compatible with IPv6 addresses.
I'm glad other people replied in this thread: I know next to nothing about those functions (which is why my patch just uses as much as possible the pre-existing code and didn't move from gethostbyname to something else).
Stefan "Not a network programmer by a long shot, just a user who
needed a specific feature"