Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jun 2009 05:00:33 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r193686 - user/kmacy/releng_7_2_fcs/sys/netinet
Message-ID:  <200906080500.n5850XAn016526@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)) &&



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906080500.n5850XAn016526>