PERFORCE change 126489 for review

Kip Macy kmacy at FreeBSD.org
Sun Sep 16 15:00:56 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126489

Change 126489 by kmacy at kmacy_home:ethng on 2007/09/16 22:00:18

	cache the route in the inpcb
	this is currently half-complete at best as it doesn't yet
	re-validate the rt_entry against a gen_count as is intended

Affected files ...

.. //depot/projects/ethng/src/sys/netinet/tcp_output.c#3 edit

Differences ...

==== //depot/projects/ethng/src/sys/netinet/tcp_output.c#3 (text+ko) ====

@@ -123,7 +123,8 @@
 int
 tcp_output(struct tcpcb *tp)
 {
-	struct socket *so = tp->t_inpcb->inp_socket;
+	struct inpcb *inp = tp->t_inpcb;
+	struct socket *so = inp->inp_socket;
 	long len, recwin, sendwin;
 	int off, flags, error;
 #ifdef TCP_SIGNATURE
@@ -1121,9 +1122,23 @@
 	 */
 	if (path_mtu_discovery)
 		ip->ip_off |= IP_DF;
+	/*
+	 * XXX need to validate
+	 */ 
+	if (inp->inp_route.ro_rt == NULL) {
+		struct sockaddr_in *dst =  (struct sockaddr_in *)&inp->inp_route.ro_dst;
+		struct ip *ip = mtod(m, struct ip *);
+		
+		bzero(dst, sizeof(*dst));
+		dst->sin_family = AF_INET;
+		dst->sin_len = sizeof(*dst);
+		dst->sin_addr = ip->ip_dst;
+		
+		rtalloc_ign(&inp->inp_route, 0);
+	}
 
 	m->m_pkthdr.rss_hash = tp->t_inpcb->inp_rss_hash;
-	error = ip_output(m, tp->t_inpcb->inp_options, NULL,
+	error = ip_output(m, tp->t_inpcb->inp_options, &inp->inp_route,
 	    ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0,
 	    tp->t_inpcb);
     }


More information about the p4-projects mailing list