From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16730 invoked by alias); 29 Jul 2012 08:30:54 -0000 Received: (qmail 16717 invoked by uid 22791); 29 Jul 2012 08:30:52 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 29 Jul 2012 08:30:38 +0000 From: "psimerda at redhat dot com" To: glibc-bugs@sources.redhat.com Subject: [Bug network/12377] getaddrinfo() should disregard link-local IPv6 addresses for AI_ADDRCONFIG purposes Date: Sun, 29 Jul 2012 08:30:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: network X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: psimerda at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: drepper.fsp at gmail dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2012-07/txt/msg00251.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=3D12377 --- Comment #13 from Pavel =C5=A0imerda 2012-0= 7-29 08:30:36 UTC --- I have done some new tests (still with glibc-2.15-51.fc17.x86_64): AF_UNSPEC + AI_ADDRCONFIG: In this case AI_ADDRCONFIG doesn't seem to work = at all (read doesn't remove *any* addresses). It is useless. It's against the manp= age and RFCThis is the default (plus the also useless AI_V4MAPPED as in bug 14415). AF_INET + AI_ADDRCONFIG: In this case AI_ADDRCONFIG does exactly what's wri= tten down in the RFC 3493 (and almost what is in the manpage). That means it bre= aks 'localhost', 'localhost4' and '127.0.0.1' and it would break any other addr= ess assigned to the loopback interface. I haven't tested IPv6 link-local addres= ses. AF_INET6 + AI_ADDRCONFIG: Same as above. Breaks 'localhost', 'localhost6' a= nd '::1'. With some new addition, it also breaks link-local addresses (e.g. fe80::21f:3cff:fe1b:9e5e%wlan0) and would also break names pointing to them if getaddrinfo was implemented in nsswitch (bug 14413). AF_INET6 + AI_ADDRCONFIG + AI_V4MAPPED (+ AI_ALL): Same behavior as above, broken localhost for both IPv6 and mapped IPv4. =46rom http://tools.ietf.org/html/rfc3493#section-6.1 If the AI_ADDRCONFIG flag is specified, IPv4 addresses shall be returned = only if an IPv4 address is configured on the local system, and IPv6 addresses shall be returned only if an IPv6 address is configured on the local system. This is a stupid way and cannot work. Even the authors new it, that's why there's something added at the and of the paragraph. The loopback address is not considered for this case as valid as a config= ured address. But this assumes you never need to use the usual addresses on the loopback (which is wrong) and that you never add more addresses to the loopback e.g. for testing (which is also wrong). And it also assumes you never have non-global addresses on other interfaces (which is also wrong, you have IPv6 link-local and you could have IPv4 link-local). This option is probably meant to guess whether we can sendto() data to this address (for connect() it is not necessary as connect() immediately returns failure for nonroutable addresses). But I can't think of *any* reason to use this hack when it's so easy to ask the system if the address is actu= ally routable. $ ip route get 2001:db8:1:1::1 $ You see, this address is *not* routable. But even if you try to fool it: # ip route add default via fe80::23:45ff:fe67:8901 dev eth0 $ ip route get 2001:db8:1:1::1 2001:db8:1:1::1 from :: via fe80::23:45ff:fe67:8901 dev eth0 src fe80::12:34ff:fe56:7890 metric 0 cache You can still easily detect the problem as the dst address is global and src address is link-local. So there's actually no guessing needed when the information is right at your hand. --=20 Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=3Demail ------- You are receiving this mail because: ------- You are on the CC list for the bug.