[Bug 192014] New: getaddrinfo(3) broken in jail on loopback

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Jul 21 15:20:49 UTC 2014


            Bug ID: 192014
           Summary: getaddrinfo(3) broken in jail on loopback
           Product: Base System
           Version: 9.3-RELEASE
          Hardware: amd64
                OS: Any
            Status: Needs Triage
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: oleg at mamontov.net

It seems like https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190824
broke getaddrinfo in jail with configured only lo0.

Real life jail example:

[lonerr at tonal ~]% ifconfig
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether d4:3d:7e:ec:e1:49
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    inet netmask 0xffffffff
pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33152

After upgrade to 9.3 fetchmail failed to start:

fetchmail: 6.3.26 querying google (protocol IMAP) at Mon Jul 21 19:18:03 2014:
poll started
fetchmail: getaddrinfo("imap.gmail.com","imaps") error: Non-recoverable failure
in name resolution

Simple test program:

[lonerr at tonal ~]% cat gai.c
#include <netdb.h>
#include <stdio.h>
#include <sys/socket.h>

int main() {
    struct addrinfo hints, *res;
    int rc;

    memset(&hints, 0, sizeof(hints));
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_family = AF_UNSPEC;
    hints.ai_flags |= AI_ADDRCONFIG;

    printf("rc:%d\n",getaddrinfo("www.freebsd.org", NULL, &hints, &res));

Run test program on 9.3-RELEASE-p0 with libc.so.7 from base ditribution:

[lonerr at tonal ~]% ./gai

Simple commented out loopback ignoring:

[lonerr at tonal ~]% svn di
Index: lib/libc/net/getaddrinfo.c
--- lib/libc/net/getaddrinfo.c    (revision 268939)
+++ lib/libc/net/getaddrinfo.c    (working copy)
@@ -1557,8 +1557,10 @@
             if (seen_inet)
             sin = (struct sockaddr_in *)(ifa->ifa_addr);
+            /*
             if (IN_LOOPBACK(htonl(sin->sin_addr.s_addr)))
+            */
             seen_inet = 1;
 #ifdef INET6

Run again after rebuild/reinstall libc.so.7:

[lonerr at tonal ~]% ./gai

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list