From owner-freebsd-net@FreeBSD.ORG Thu May 17 22:07:52 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 8A896106564A for ; Thu, 17 May 2012 22:07:52 +0000 (UTC) (envelope-from prabhakar.lakhera@gmail.com) Received: from mail-gg0-f182.google.com (mail-gg0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 43D5F8FC14 for ; Thu, 17 May 2012 22:07:52 +0000 (UTC) Received: by ggnm2 with SMTP id m2so2935569ggn.13 for ; Thu, 17 May 2012 15:07:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ItmDOn18uv77y4O3oP1SBzsfqyvC1GMmCUxe9XWHvpA=; b=klo1i5lsdBTWX0+H2qoGcT8tvkKISbpcWTIPsVDuobSGy+hs8VkGdzXcHxOT7MR/vn Fjuq3E/G/VGiJCMwfMgXOsYySHuFHLYal9XKiq297SRwbZA7hlT+NDRmspJRe/kOYYrb l8Wkmu9Uj6UInbLexU8dYStuYvetlJKmG+E8JN1pKwRMmX907KRa0mu2oUbkFpnOJxdO M0phJs5rT3tP4hqTt29CPPC4XaVDWa05vqTVS2OpYGFh6NLzfVrOsjyRWhPOLNHIseYY g8jea+gXPh5pVS8Y2KU44Y3yUFyPh1LDiZJsuqXymngSCgR8MYX7+P6t7DsgLn5he+FQ Hwcg== MIME-Version: 1.0 Received: by 10.101.80.16 with SMTP id h16mr299611anl.37.1337292471686; Thu, 17 May 2012 15:07:51 -0700 (PDT) Received: by 10.101.60.18 with HTTP; Thu, 17 May 2012 15:07:51 -0700 (PDT) Date: Thu, 17 May 2012 15:07:51 -0700 Message-ID: From: prabhakar lakhera To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: 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:07:52 -0000 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 scope6_ifattach which sets the interface local scope and link local scope for the interface equal to the ifp index. scope6_ifattach(struct ifnet *ifp) { ..... ..... /* * XXX: IPV6_ADDR_SCOPE_xxx macros are not standard. * Should we rather hardcode here? */ sid->s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = ifp->if_index; sid->s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = ifp->if_index; ..... ..... } 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: fe80::: route_ifp: 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 = &(((struct sockaddr_in6 *)rt ->rt_gateway)->sin6_addr); 2348 if (bcmp (&src6, gw6, sizeof(struct in6_addr )) != 0) { 2349 nd6log ((LOG_ERR , 2350 *"ICMP6 redirect rejected; "* 2351 *"not equal to gw-for-src=%s (must be same): "* 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: fe80::: with fe80::: Since ids are different the comparison fails and the redirect is dropped.