Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 May 2012 15:13:08 -0700
From:      prabhakar lakhera <prabhakar.lakhera@gmail.com>
To:        freebsd-net@freebsd.org
Subject:   Re: How to set the IPv6 linklocal scope id for an interface?
Message-ID:  <CALg%2BrhVNXmor3JSAYmOVG%2BnSEdbJBU15N6AnGxmNUFn81vXx8g@mail.gmail.com>
In-Reply-To: <CALg%2BrhVakDqBQdnvwYOsHFNKOo-6dsM2-nk5fGztt7E004hAMA@mail.gmail.com>
References:  <CALg%2BrhVakDqBQdnvwYOsHFNKOo-6dsM2-nk5fGztt7E004hAMA@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

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 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:<A's link local scope id embedded>::<identifier>
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:<A's link local scope id embedded>::<identifier> with
  fe80:<B's link local scope id embedded>::<identifier>

Since ids are different the comparison fails and the redirect is dropped.


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALg%2BrhVNXmor3JSAYmOVG%2BnSEdbJBU15N6AnGxmNUFn81vXx8g>