Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Sep 2007 22:00:55 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 126489 for review
Message-ID:  <200709162200.l8GM0tUv080388@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help

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

Change 126489 by kmacy@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);
     }



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