Re: Socket6::gethostbyname2 not implemented on this architecture

"Brian J. Murrell" <[email protected]>
Newsgroups gmane.comp.security.shorewall
Message-ID <[email protected]>
On Thu, 2022-02-03 at 23:38 +0100, Benny Pedersen wrote:
> On 2022-02-03 22:31, Brian J. Murrell wrote:
> 
> > Is it really possible that Socket6::gethostbyname2 is not implemented
> > on a modern and recent distro such as Fedora?
> 
> yes

Well, it seems that the gethostbyname*() interfaces are actually
obsolete and as such we should not be surprised to see them start to
disappear.

https://linux.die.net/man/3/gethostbyname2:

   The gethostbyname*() and gethostbyaddr*() functions are obsolete.
   Applications should use getaddrinfo(3) and getnameinfo(3) instead.

The glibc manpage for gethostbyname2 says the same thing:

$ man gethostbyname2
...
DESCRIPTION
       The gethostbyname*(), gethostbyaddr*(), herror(), and hstrerror() functions are obsolete.  Applications should use getaddrinfo(3), getnameinfo(3), and  gai_str‐
       error(3) instead.

> reported to fedore maintainer ?, its not a shorewall bug

Well, it is, in that shorewall is using obsoleted interfaces.  The perl
package maintainer at RedHat offered up the following patch which works
here:

--- /usr/share/perl5/vendor_perl/Shorewall/IPAddrs.pm.orig	2021-11-05 11:03:22.000000000 +0000
+++ /usr/share/perl5/vendor_perl/Shorewall/IPAddrs.pm	2022-02-06 13:28:43.045058966 +0000
@@ -509,7 +509,7 @@ sub validate_6address( $$ ) {
     unless ( valid_6address $addr ) {
 	fatal_error "Invalid IPv6 Address ($addr)" unless $allow_name;
 	require Socket6;
-	fatal_error "Unknown Host ($addr)" unless (@addrs = Socket6::gethostbyname2( $addr, Socket6::AF_INET6()));
+	fatal_error "Unknown Host ($addr)" unless (@addrs = Socket6::getaddrinfo( $addr, 0, Socket6::AF_INET6()));
 
 	if ( defined wantarray ) {
 	    shift @addrs for (1..4);
@@ -527,7 +527,7 @@ sub resolve_6dnsname( $ ) {
     my @addrs;
     
     require Socket6;
-    fatal_error "Unknown Host ($net)" unless (@addrs = Socket6::gethostbyname2( $net, Socket6::AF_INET6()));
+    fatal_error "Unknown Host ($net)" unless (@addrs = Socket6::getaddrinfo( $net, 0, Socket6::AF_INET6()));
 
     shift @addrs for (1..4);
     for ( @addrs ) {

Cheers,
b.




_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.