Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 2014 15:20:48 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 192014] New: getaddrinfo(3) broken in jail on loopback
Message-ID:  <bug-192014-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192014

            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@FreeBSD.org
          Reporter: oleg@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@tonal ~]% ifconfig
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
   
options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
    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
    options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
    inet 127.0.1.4 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@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@tonal ~]% ./gai
rc:4


Simple commented out loopback ignoring:

[lonerr@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)
                 continue;
             sin = (struct sockaddr_in *)(ifa->ifa_addr);
+            /*
             if (IN_LOOPBACK(htonl(sin->sin_addr.s_addr)))
                 continue;
+            */
             seen_inet = 1;
             break;
 #ifdef INET6


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

[lonerr@tonal ~]% ./gai
rc:0

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-192014-8>