Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 456848 - dev-libs/openssl[ipv6] fails on non-GNU platforms due to gethostbyname2() usage
Summary: dev-libs/openssl[ipv6] fails on non-GNU platforms due to gethostbyname2() usage
Status: CONFIRMED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Other (show other bugs)
Hardware: Other Other
: Normal normal with 1 vote (vote)
Assignee: Gentoo non-Linux Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-11 20:39 UTC by Sean McGovern
Modified: 2017-05-18 12:28 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
i686-w64-mingw32 - emerge --info (info.log,17.83 KB, text/x-log)
2014-06-14 16:38 UTC, Bertrand Jacquin
Details
i686-w64-mingw32 - build.log (build.log,501.86 KB, text/x-log)
2014-06-14 16:38 UTC, Bertrand Jacquin
Details

Note You need to log in before you can comment on or make changes to this bug.
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?