How to set the IPv6 linklocal scope id for an interface?
prabhakar lakhera
prabhakar.lakhera at gmail.com
Thu May 17 22:13:09 UTC 2012
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.
More information about the freebsd-net
mailing list