From owner-freebsd-net@FreeBSD.ORG Thu May 17 22:13:09 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 55D82106564A for ; Thu, 17 May 2012 22:13:09 +0000 (UTC) (envelope-from prabhakar.lakhera@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 106EA8FC17 for ; Thu, 17 May 2012 22:13:08 +0000 (UTC) Received: by yenl8 with SMTP id l8so2927238yen.13 for ; Thu, 17 May 2012 15:13:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=8DT1gxTBz+/poOujniu9yCkI6dQ1XRRTkMgoVOWmtDU=; b=g0O+SKWT915qFgFYI6tf1swSRKkK+RYjbOZzRuaV3NE/XEWp9DpcmmMLhJVHly2inP qYtwxSWeY2ofLPVbmlFBerHd7Cleld0c8VRZ49r9YKnrDZ93ak+2Tc7orQdKm9QKkQ2C 65e5NWaNXbxKgZRZSdORy18/5ebYKq2KOVyoQzWxLJuciRrYFAIHxapYfF9BfuqwRxS5 8L7021mslcbrqpunpN0h2iBju6A05rq1CfY5fq29XTiDgLxdBiskeEd81eGVshWanUJt ZeFSvxS8bHT1IHzGN2VHCjZuLL1A85Eb5Ug+E9U0pXKm5t6OsSuTJ1mm2Yt3UqYGUcS7 TrVA== MIME-Version: 1.0 Received: by 10.236.153.104 with SMTP id e68mr9908714yhk.36.1337292788222; Thu, 17 May 2012 15:13:08 -0700 (PDT) Received: by 10.101.60.18 with HTTP; Thu, 17 May 2012 15:13:08 -0700 (PDT) In-Reply-To: References: Date: Thu, 17 May 2012 15:13:08 -0700 Message-ID: From: prabhakar lakhera To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: How to set the IPv6 linklocal scope id for an interface? 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: Thu, 17 May 2012 22:13:09 -0000 Removing the hyperlinks (these seem to get appended by gmail: Hi, Is there any way for the administrator to set an interface's scope if for link local scope? I see that in6_domifattach calls=A0scope6_ifattach which sets the interface local scope and link local scope for the interface equal to the ifp index. scope6_ifattach(struct ifnet *ifp) { =A0 =A0 =A0 ..... =A0 =A0 =A0 ..... =A0 =A0 =A0 =A0 /* =A0 =A0 =A0 =A0 =A0* XXX: IPV6_ADDR_SCOPE_xxx macros are not standard. =A0 =A0 =A0 =A0 =A0* Should we rather hardcode here? =A0 =A0 =A0 =A0 =A0*/ =A0 =A0 =A0 =A0 sid->s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] =3D ifp->if_in= dex; =A0 =A0 =A0 =A0 sid->s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] =3D ifp->if_index= ; =A0 =A0 =A0 ..... =A0 =A0 =A0 ..... } I am trying to avoid the following: Here's the problem. I have two interfaces A and B on same link. Both learn RA for the link. One of these is used to add a default route entry in the routing table. Lets say default router entry for A is picked, we have the following default route entry: destination: ::/0 gw: =A0 =A0 =A0 =A0 =A0 =A0 fe80::: route_ifp: =A0 =A0 A I used IPv6 address hosted on interface B to send a packet to destination X and I got back a neighbor redirect from gw destined for B for X. However the redirect is dropped. Below is the code from icmp6_redirect_input that fails a check: 2346 2347 gw6 =3D &(((struct sockaddr_in6 *)rt->rt_gateway)->sin6_addr); 2348 if (bcmp(&src6, gw6, sizeof(struct in6_addr)) !=3D 0)= { 2349 nd6log((LOG_ERR, 2350 "ICMP6 redirect rejected; " 2351 "not equal to gw-for-src=3D%s (must be sa= me): " 2352 "%s\n", 2353 ip6_sprintf(ip6buf, gw6), 2354 icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); 2355 RTFREE_LOCKED(rt); 2356 goto bad; 2357 } src6 is the router's LLA but since it's received on B, it's embedded with B's link scope embedded id. So we end up comparing: =A0 fe80::: with =A0 fe80::: Since ids are different the comparison fails and the redirect is dropped.