From owner-freebsd-net@FreeBSD.ORG Sun Apr 15 23:21:27 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAC231065675 for ; Sun, 15 Apr 2012 23:21:27 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7A3AE8FC17 for ; Sun, 15 Apr 2012 23:21:27 +0000 (UTC) Received: by pbcwz17 with SMTP id wz17so5948512pbc.13 for ; Sun, 15 Apr 2012 16:21:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=nA5+eFeyGOJjUBC+ZZSbRHi4n3r1Z4gTE8j22WRLgm0=; b=dUt1oHUmWD6da00G20xWP+MQD5mhKLOkc3CdAS4XWar9TMbOyHUexvHNFlP/jURXPh r/6PVMRMCpGd1DJKRV5otfqXdqd1HBtH2T5KKJKIOfQBLwhbw6XGRglFIualqlt+E1Wx jhmNsiEKoeEBmUXN1g0z9DdJbU9qiqGtzIHBay2/CAFgg2bST7XSGFlTswyWJJEWPBc4 fDD/X5jo+C3in2Lfsm9vT4PzSjN0rDkg6UWNo1JpE2gFo0xnBmuMyKYh2X5oXs/TTJw8 z46iVcLXCSn0PsaZJga7jlNLRIkLtWdgWOGL6BzNoMz9aPDXusldzfaP/qqFlCaJdovY KhaQ== MIME-Version: 1.0 Received: by 10.68.222.134 with SMTP id qm6mr23633864pbc.14.1334532086854; Sun, 15 Apr 2012 16:21:26 -0700 (PDT) Sender: andy@fud.org.nz Received: by 10.68.33.230 with HTTP; Sun, 15 Apr 2012 16:21:26 -0700 (PDT) In-Reply-To: References: <20120413064142.10640@gmx.net> Date: Mon, 16 Apr 2012 11:21:26 +1200 X-Google-Sender-Auth: hHocUq7QaMCcc5oR-w3m05eTWr8 Message-ID: From: Andrew Thompson To: Hajimu UMEMOTO Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQmUbR0HJjqksMthX6jvP+q4HwJ/sVkxy1WedqiF83PCAPcLbqVFSIXgC2mqC2EYATwid/CV Cc: freebsd-net@freebsd.org, Rainer Bredehorn Subject: Re: getifaddrs & ipv6 scope X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Apr 2012 23:21:27 -0000 On 14 April 2012 06:03, Hajimu UMEMOTO wrote: > Hi, > >>>>>> On Fri, 13 Apr 2012 20:01:39 +1200 >>>>>> Andrew Thompson said: > > thompsa> On 13 April 2012 18:41, Rainer Bredehorn wrot= e: >> Hi! >> >>> I have noticed that getifaddrs() does not have sin6_scope_id set to >>> the interface id for link local addresses on AF_INET6 types. Running >>> the following program gives different results on Linux >> >> ifconfig shows the scopeid according to the interface: >> >> inet6 fe80::208:9bff:fe13:784e%fxp1 prefixlen 64 scopeid 0x2 >> >> Are you talking about the scope value of an multicast address or >> the scopeid for link local addresses? > > thompsa> I am talking about the scopeid for link local addresses which (a= s far > thompsa> as I understand) is the interface index. > > The issue you mentioned comes from an implementation decision of the > KAME IPv6 stack. > The attached patch should address it. =A0However, it may break the > applications which expect that getifaddrs() returns a link-local > address with KAME's embeded scopeid representation. =A0I'm not sure > there are such applications, for now. This is now working how I expected it. From my original test app, dev: bge0 address: scope 2 dev: lo0 address: <::1> scope 0 dev: lo0 address: scope 5 dev: tun5 address: scope 6 dev: tun3 address: scope 7 dev: tun0 address: scope 8 regards, Andrew