From owner-freebsd-stable@FreeBSD.ORG Wed Jan 9 13:14:36 2013 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5C932EB4; Wed, 9 Jan 2013 13:14:36 +0000 (UTC) (envelope-from michiel@boland.org) Received: from smtp-vbr15.xs4all.nl (smtp-vbr15.xs4all.nl [194.109.24.35]) by mx1.freebsd.org (Postfix) with ESMTP id E68D5E4B; Wed, 9 Jan 2013 13:14:35 +0000 (UTC) Received: from charlemagne.boland.org (37-251-74-118.FTTH.ispfabriek.nl [37.251.74.118]) (authenticated bits=0) by smtp-vbr15.xs4all.nl (8.13.8/8.13.8) with ESMTP id r09DEIXx059705 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 9 Jan 2013 14:14:27 +0100 (CET) (envelope-from michiel@boland.org) Message-ID: <50ED6D2A.5080908@boland.org> Date: Wed, 09 Jan 2013 14:14:18 +0100 From: Michiel Boland User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Hiroki Sato Subject: Re: sendmail vs ipv6 broken after upgrade to 9.1 References: <20130108151837.GF35868@acme.spoerlein.net> <50EC5922.5030600@boland.org> <20130108184051.GI35868@acme.spoerlein.net> <20130109.073354.730245417155474512.hrs@allbsd.org> In-Reply-To: <20130109.073354.730245417155474512.hrs@allbsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by XS4ALL Virus Scanner Cc: stable@freebsd.org, uqs@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jan 2013 13:14:36 -0000 On 01/08/2013 23:33, Hiroki Sato wrote: > Ulrich Spörlein wrote > in <20130108184051.GI35868@acme.spoerlein.net>: > > uq> After setting this, it now looks like this: > uq> root@acme: ~# ip6addrctl > uq> Prefix Prec Label Use > uq> ::1/128 50 0 0 > uq> ::/0 40 1 0 > uq> 2002::/16 30 2 0 > uq> ::/96 20 3 0 > uq> ::ffff:0.0.0.0/96 10 4 0 > uq> > uq> And even sendmail is happily finding the sockets to bind to. Thanks for the hint! > > I think this just hides the problem. If gshapiro@'s explanation is > correct, no ::ffff:0.0.0.0/96 address should be returned if the name > resolution works fine... > > -- Hiroki > getipnodebyname(xx, AF_INET6, AI_DEFAULT|AI_ALL) does this:- If a host has both IPv6 and IPv4 addresses, both are returned. The IPv4 address is presented as a mapped address. The order in which the addresses are returns depends on the address selection policy (_hpreorder in lib/libc/net/name6.c) #include #include #include #include static void resolve(const char *); int main(int argc, char *argv[]) { int i; for (i = 1; i < argc; i++) { resolve(argv[i]); } return 0; } static void resolve(const char *hostname) { struct hostent *h; char **a; int i; int e = 0; h = getipnodebyname(hostname, AF_INET6, AI_DEFAULT|AI_ALL, &e); if (!h) { return; } printf("h_name: %s\n", h->h_name); for (a = h->h_aliases; *a; a++) { printf(" alias: %s\n", *a); } printf("h_addrtype: %d\n", h->h_addrtype); printf("h_length: %d\n", h->h_length); for (a = h->h_addr_list; *a; a++) { printf("h_length: %d\n", h->h_length); printf(" address: 0x"); for (i = 0; i < h->h_length; i++) { printf("%02x", (unsigned char)(*a)[i]); } printf("\n"); } } prefer_ipv4: $ ./a.out youtube.com h_name: youtube.com h_addrtype: 28 h_length: 16 h_length: 16 address: 0x00000000000000000000ffffadc241be h_length: 16 address: 0x00000000000000000000ffffadc2415b h_length: 16 address: 0x00000000000000000000ffffadc2415d h_length: 16 address: 0x00000000000000000000ffffadc24188 h_length: 16 address: 0x2a00145040130c00000000000000005b prefer_ipv6: $ ./a.out youtube.com h_name: youtube.com h_addrtype: 28 h_length: 16 h_length: 16 address: 0x2a00145040130c00000000000000005b h_length: 16 address: 0x00000000000000000000ffffadc2415b h_length: 16 address: 0x00000000000000000000ffffadc2415d h_length: 16 address: 0x00000000000000000000ffffadc24188 h_length: 16 address: 0x00000000000000000000ffffadc241be