svn commit: r193686 - user/kmacy/releng_7_2_fcs/sys/netinet

Kip Macy kmacy at FreeBSD.org
Mon Jun 8 05:00:33 UTC 2009


Author: kmacy
Date: Mon Jun  8 05:00:32 2009
New Revision: 193686
URL: http://svn.freebsd.org/changeset/base/193686

Log:
  cleanup caching of ifp

Modified:
  user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c

Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c	Mon Jun  8 04:53:28 2009	(r193685)
+++ user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c	Mon Jun  8 05:00:32 2009	(r193686)
@@ -166,7 +166,6 @@ ip_output(struct mbuf *m, struct mbuf *o
 	if (ro == &iproute &&
 	    flowtable_lookup(ip_ft, m, ro) == 0) {
 		nortfree = 1;
-		ifp = ro->ro_rt->rt_ifp;
 	}
 	if (opt) {
 		len = 0;
@@ -175,8 +174,6 @@ ip_output(struct mbuf *m, struct mbuf *o
 			hlen = len;
 	}
 	ip = mtod(m, struct ip *);
-	if (nortfree)
-		ip->ip_ttl = 1;
 	
 	/*
 	 * Fill in IP header.  If we are not allowing fragmentation,
@@ -247,14 +244,18 @@ again:
 		ifp = ia->ia_ifp;
 		ip->ip_ttl = 1;
 		isbroadcast = 1;
-	} else if (ifp == NULL && (flags & IP_ROUTETOIF)) {
-		if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL &&
+	} else if (flags & IP_ROUTETOIF) {
+		if (nortfree == 0 &&
+		    (ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL &&
 		    (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == NULL) {
 			V_ipstat.ips_noroute++;
 			error = ENETUNREACH;
 			goto bad;
 		}
-		ifp = ia->ia_ifp;
+		if (nortfree)
+			ifp = ro->ro_rt->rt_ifp;
+		else
+			ifp = ia->ia_ifp;
 		ip->ip_ttl = 1;
 		isbroadcast = in_broadcast(dst->sin_addr, ifp);
 	} else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) &&


More information about the svn-src-user mailing list