Sockets, AF_INET6 and getnameinfo problem


(Marcin 'Qrczak' Kowalczyk) #1

Sat, 1 Jun 2002 16:10:14 +0900, Yukihiro Matsumoto matz@ruby-lang.org pisze:

I suspect getnameinfo(3) on Linux does not work well for IPv6.

It’s glibc-2.2.5.

Could you report your compile time information (output from
extconf.rb or Makefile contents), if you compile Ruby by yourself.

You mean this part of ext/socket/Makefile?

CFLAGS = -fPIC -g -O2 -fPIC -DHAVE_GETADDRINFO -DHAVE_SOCKADDR_STORAGE
CPPFLAGS = -I$(topdir) -I$(hdrdir) -DHAVE_NETINET_TCP_H
-DHAVE_NETINET_UDP_H -DHAVE_ST_MSG_CONTROL -DHAVE_GETADDRINFO
-DHAVE_GETNAMEINFO -DHAVE_SYS_UN_H -DHAVE_SYS_UIO_H -DHAVE_SOCKET
-DHAVE_GETHOSTNAME -Dss_family=__ss_family -Dss_len=__ss_len
DLDFLAGS = -L/home/users/qrczak/cvs/ruby -L${exec_prefix}/lib
LDSHARED = gcc -shared

It seems that IPV6 is not detected. Indeed if I hack extconf to say
’if enable_config(“ipv6”, true)’ instead of ‘…false’, then everything
works! ./configure --enable-ipv6 doesn’t work. And it should work by
default, without ./configure options.

BTW, two other small errors:

— ext/socket/socket.c.orig Fri May 31 23:13:24 2002
+++ ext/socket/socket.c Sat Jun 1 13:24:08 2002
@@ -585,7 +585,7 @@
portp = 0;
}
else if (FIXNUM_P(port)) {

  • snprintf(pbuf, sizeof(pbuf), “%ld”, FIX2INT(port));
  • snprintf(pbuf, sizeof(pbuf), “%d”, FIX2INT(port));
    portp = pbuf;
    }
    else {
    @@ -673,7 +673,7 @@
    error = getnameinfo(sockaddr, SA_LEN(sockaddr), hbuf, sizeof(hbuf),
    pbuf, sizeof(pbuf), NI_NUMERICHOST | NI_NUMERICSERV);
    if (error) {
  • rb_raise(rb_eSocket, “getnameinfo %s”, gai_strerror(error));
  • rb_raise(rb_eSocket, “getnameinfo: %s”, gai_strerror(error));
    }
    addr2 = rb_tainted_str_new2(hbuf);
    if (do_not_reverse_lookup) {
···


__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
__/
^^
QRCZAK


(Yukihiro Matsumoto) #2

Hi,

It seems that IPV6 is not detected. Indeed if I hack extconf to say
’if enable_config(“ipv6”, true)’ instead of ‘…false’, then everything
works! ./configure --enable-ipv6 doesn’t work. And it should work by
default, without ./configure options.

Thank you. I will check IPv6 in extconf.rb by default.

BTW, two other small errors:

I will merge them. Thank you again.

						matz.
···

In message “Re: Sockets, AF_INET6 and getnameinfo problem” on 02/06/01, Marcin ‘Qrczak’ Kowalczyk qrczak@knm.org.pl writes: