[Midnightbsd-cvs] src: sys/netinet6: Fix spurious warnings from neighbor discovery when
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Mar 16 20:02:17 EDT 2008
Log Message:
-----------
Fix spurious warnings from neighbor discovery when working with IPv6 over
point to point tunnels (gif).
This crops up when using one of the many IPV6 tunnel brokers, etc. with MidnightBSD.
Obtained from FreeBSD.
Modified Files:
--------------
src/sys/netinet6:
in6.c (r1.2 -> r1.3)
nd6.c (r1.2 -> r1.3)
-------------- next part --------------
Index: in6.c
===================================================================
RCS file: /home/cvs/src/sys/netinet6/in6.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/netinet6/in6.c -L sys/netinet6/in6.c -u -r1.2 -r1.3
--- sys/netinet6/in6.c
+++ sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/in6.c,v 1.51.2.8 2006/03/09 11:59:03 gnn Exp $ */
+/* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netinet6/in6.c,v 1.51.2.9 2006/06/17 17:58:33 gnn Exp $ */
/* $KAME: in6.c,v 1.259 2002/01/21 11:37:50 keiichi Exp $ */
/*-
@@ -1720,20 +1720,55 @@
/* we could do in(6)_socktrim here, but just omit it at this moment. */
+ if (newhost && nd6_need_cache(ifp) != 0) {
+ /* set the rtrequest function to create llinfo */
+ ia->ia_ifa.ifa_rtrequest = nd6_rtrequest;
+ }
+
/*
* Special case:
* If a new destination address is specified for a point-to-point
* interface, install a route to the destination as an interface
- * direct route.
+ * direct route. In addition, if the link is expected to have neighbor
+ * cache entries, specify RTF_LLINFO so that a cache entry for the
+ * destination address will be created.
+ * created
* XXX: the logic below rejects assigning multiple addresses on a p2p
- * interface that share a same destination.
+ * interface that share the same destination.
*/
plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */
if (!(ia->ia_flags & IFA_ROUTE) && plen == 128 &&
ia->ia_dstaddr.sin6_family == AF_INET6) {
- if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD,
- RTF_UP | RTF_HOST)) != 0)
+ int rtflags = RTF_UP | RTF_HOST;
+ struct rtentry *rt = NULL, **rtp = NULL;
+
+ if (nd6_need_cache(ifp) != 0) {
+ rtflags |= RTF_LLINFO;
+ rtp = &rt;
+ }
+
+ error = rtrequest(RTM_ADD, (struct sockaddr *)&ia->ia_dstaddr,
+ (struct sockaddr *)&ia->ia_addr,
+ (struct sockaddr *)&ia->ia_prefixmask,
+ ia->ia_flags | rtflags, rtp);
+ if (error != 0)
return (error);
+ if (rt != NULL) {
+ struct llinfo_nd6 *ln;
+
+ RT_LOCK(rt);
+ ln = (struct llinfo_nd6 *)rt->rt_llinfo;
+ if (ln != NULL) {
+ /*
+ * Set the state to STALE because we don't
+ * have to perform address resolution on this
+ * link.
+ */
+ ln->ln_state = ND6_LLINFO_STALE;
+ }
+ RT_REMREF(rt);
+ RT_UNLOCK(rt);
+ }
ia->ia_flags |= IFA_ROUTE;
}
if (plen < 128) {
@@ -1744,11 +1779,8 @@
}
/* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */
- if (newhost) {
- /* set the rtrequest function to create llinfo */
- ia->ia_ifa.ifa_rtrequest = nd6_rtrequest;
+ if (newhost)
in6_ifaddloop(&(ia->ia_ifa));
- }
return (error);
}
Index: nd6.c
===================================================================
RCS file: /home/cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/netinet6/nd6.c -L sys/netinet6/nd6.c -u -r1.2 -r1.3
--- sys/netinet6/nd6.c
+++ sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/nd6.c,v 1.48.2.12 2006/03/29 21:05:11 suz Exp $ */
+/* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netinet6/nd6.c,v 1.48.2.13 2006/06/17 17:58:33 gnn Exp $ */
/* $KAME: nd6.c,v 1.144 2001/05/24 07:44:00 itojun Exp $ */
/*-
@@ -512,6 +512,19 @@
ln->ln_asked++;
nd6_llinfo_settimer(ln, (long)ndi->retrans * hz / 1000);
nd6_ns_output(ifp, dst, dst, ln, 0);
+ } else if (rt->rt_ifa != NULL &&
+ rt->rt_ifa->ifa_addr->sa_family == AF_INET6 &&
+ (((struct in6_ifaddr *)rt->rt_ifa)->ia_flags & IFA_ROUTE)) {
+ /*
+ * This is an unreachable neighbor whose address is
+ * specified as the destination of a p2p interface
+ * (see in6_ifinit()). We should not free the entry
+ * since this is sort of a "static" entry generated
+ * via interface address configuration.
+ */
+ ln->ln_asked = 0;
+ ln->ln_expire = 0; /* make it permanent */
+ ln->ln_state = ND6_LLINFO_STALE;
} else {
(void)nd6_free(rt, 0);
ln = NULL;
More information about the Midnightbsd-cvs
mailing list