Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 456848

Summary: dev-libs/openssl-1.0.x[ipv6] fails on non-GNU platforms due to gethostbyname2() usage
Product: Gentoo/Alt Reporter: Sean McGovern <gseanmcg>
Component: OtherAssignee: Gentoo non-Linux Team <alt>
Status: RESOLVED OBSOLETE    
Severity: normal CC: base-system, bertrand
Priority: Normal    
Version: unspecified   
Hardware: Other   
OS: Other   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: i686-w64-mingw32 - emerge --info
i686-w64-mingw32 - build.log

Description Sean McGovern 2013-02-11 20:39:48 UTC
The patch for IPv6 functionality in the openssl ebuild adds a call to gethostbyname2() for IPv6 address resolution.

gethostbyname2() is a GNU extension.

Reproducible: Always
Comment 1 Bertrand Jacquin 2014-06-14 16:38:07 UTC
Created attachment 378886 [details]
i686-w64-mingw32 - emerge --info
Comment 2 Bertrand Jacquin 2014-06-14 16:38:30 UTC
Created attachment 378888 [details]
i686-w64-mingw32 - build.log
Comment 3 Bertrand Jacquin 2014-06-14 16:39:12 UTC
Same result on x86_64-w64-mingw32 than attachment #378886 [details]
Comment 4 Bertrand Jacquin 2014-06-14 16:42:06 UTC
man 2 gethostbyname say :

NOTES
(..)
   GNU extensions
       Glibc2 also has a gethostbyname2() that works like gethostbyname(), but
       permits to specify the address family to which the address must belong.
(..)

See Also: http://rt.openssl.org/Ticket/Display.html?id=2051
Login: guest/guest
Comment 5 hanetzer 2017-05-18 01:54:31 UTC
still broken on x86_64-w64-mingw32 for dev-libs/openssl-1.0.2k
Comment 6 Fabian Groffen gentoo-dev 2017-05-18 07:07:13 UTC
Do you have getipnodebyname available?  In Prefix we carry the following patch, but perhaps it can go without the extra ifdef (linux and darwin seem to have getipnodebyname too):

--- apps/s_socket.c
+++ apps/s_socket.c
@@ -718,8 +718,13 @@
         if (domain == AF_INET)
            ret = gethostbyname(name);
 # if OPENSSL_USE_IPV6
+#  if defined (__SVR4) && defined (__sun)
+   else
+       ret = getipnodebyname(name, AF_INET6, AI_DEFAULT, NULL);
+#  else
    else
        ret = gethostbyname2(name, AF_INET6);
+#  endif
 # endif 
         if (ret == NULL)
             return (NULL);


(https://gitweb.gentoo.org/repo/proj/prefix.git/plain/dev-libs/openssl/files/openssl-1.0.2-gethostbyname2-solaris.patch)
Comment 7 hanetzer 2017-05-18 09:48:39 UTC
To be frank I have no idea how I'd check if I had that or not. would you say that just dropping that as a patch into the user patches dir should work?
Comment 8 hanetzer 2017-05-18 09:58:54 UTC
(In reply to Fabian Groffen from comment #6)
> Do you have getipnodebyname available?  In Prefix we carry the following
> patch, but perhaps it can go without the extra ifdef (linux and darwin seem
> to have getipnodebyname too):
> 
> --- apps/s_socket.c
> +++ apps/s_socket.c
> @@ -718,8 +718,13 @@
>          if (domain == AF_INET)
>             ret = gethostbyname(name);
>  # if OPENSSL_USE_IPV6
> +#  if defined (__SVR4) && defined (__sun)
> +   else
> +       ret = getipnodebyname(name, AF_INET6, AI_DEFAULT, NULL);
> +#  else
>     else
>         ret = gethostbyname2(name, AF_INET6);
> +#  endif
>  # endif 
>          if (ret == NULL)
>              return (NULL);
> 
> 
> (https://gitweb.gentoo.org/repo/proj/prefix.git/plain/dev-libs/openssl/files/
> openssl-1.0.2-gethostbyname2-solaris.patch)

A quick recursive grep seems to show this is not available under the mingw64-runtime
Comment 9 Fabian Groffen gentoo-dev 2017-05-18 12:28:19 UTC
Presumably, 1.1.x contains proper ipv6 support.
Akamai has a patch that uses getaddrinfo (like it should)
The problem is mostly for mingw if I understand correctly.
Can we disable ipv6 support for that platform for 1.0.x?
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-14 13:50:39 UTC
1.0.x is long-masked and will be removed soon enough.