svn commit: r196871 - in head/sys: net netinet6

Qing Li qingli at FreeBSD.org
Sat Sep 5 20:24:38 UTC 2009


Author: qingli
Date: Sat Sep  5 20:24:37 2009
New Revision: 196871
URL: http://svn.freebsd.org/changeset/base/196871

Log:
  The addresses that are assigned to the loopback interface
  should be part of the kernel routing table.
  
  Reviewed by:	bz
  MFC after:	immediately

Modified:
  head/sys/net/if_llatbl.c
  head/sys/netinet6/in6.c

Modified: head/sys/net/if_llatbl.c
==============================================================================
--- head/sys/net/if_llatbl.c	Sat Sep  5 18:44:36 2009	(r196870)
+++ head/sys/net/if_llatbl.c	Sat Sep  5 20:24:37 2009	(r196871)
@@ -263,15 +263,6 @@ lla_rt_output(struct rt_msghdr *rtm, str
 		    __func__, dl->sdl_index);
 		return EINVAL;
 	}
-	if (ifp->if_flags & IFF_LOOPBACK) {
-		struct ifaddr *ia;
-		ia = ifa_ifwithaddr(dst);
-		if (ia != NULL) {
-			ifp = ia->ifa_ifp;
-			ifa_free(ia);
-		} else 
-			return EINVAL;
-	}
 
 	switch (rtm->rtm_type) {
 	case RTM_ADD:

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Sat Sep  5 18:44:36 2009	(r196870)
+++ head/sys/netinet6/in6.c	Sat Sep  5 20:24:37 2009	(r196871)
@@ -1192,9 +1192,10 @@ in6_purgeaddr(struct ifaddr *ifa)
 
 	/*
 	 * Remove the loopback route to the interface address.
-	 * The check for the current setting of "nd6_useloopback" is not needed.
+	 * The check for the current setting of "nd6_useloopback" 
+	 * is not needed.
 	 */
-	if (!(ia->ia_ifp->if_flags & IFF_LOOPBACK)) {
+	{
 		struct rt_addrinfo info;
 		struct sockaddr_dl null_sdl;
 
@@ -1767,7 +1768,9 @@ in6_ifinit(struct ifnet *ifp, struct in6
 	/*
 	 * add a loopback route to self
 	 */
-	if (V_nd6_useloopback && !(ifp->if_flags & IFF_LOOPBACK)) {
+	if (!(ia->ia_flags & IFA_ROUTE)
+	    && (V_nd6_useloopback
+		|| (ifp->if_flags & IFF_LOOPBACK))) {
 		struct rt_addrinfo info;
 		struct rtentry *rt = NULL;
 		static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK};
@@ -1788,7 +1791,7 @@ in6_ifinit(struct ifnet *ifp, struct in6
 			RT_REMREF(rt);
 			RT_UNLOCK(rt);
 		} else if (error != 0)
-			log(LOG_INFO, "in6_ifinit: insertion failed\n");
+			log(LOG_INFO, "in6_ifinit: error = %d, insertion failed\n", error);
 	}
 
 	/* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */


More information about the svn-src-head mailing list