PERFORCE change 166454 for review

Andre Oppermann andre at FreeBSD.org
Thu Jul 23 15:16:16 UTC 2009


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

Change 166454 by andre at andre_t61 on 2009/07/23 15:15:37

	Move the delayed header drop into the socket append block. It is
	no longer necessary for tcp_reass.
	Update comment on tcp_reass invocation.
	Replace thflags with what tcp_reass returns. Or'ing was incorrect.
	With INVARIANTS zero out th, m and tlen after socket append or
	tcp_reass. They're no longer valid.

Affected files ...

.. //depot/projects/tcp_reass/netinet/tcp_input.c#14 edit

Differences ...

==== //depot/projects/tcp_reass/netinet/tcp_input.c#14 (text+ko) ====

@@ -2556,7 +2556,6 @@
 	 */
 	if ((tlen || (thflags & TH_FIN)) &&
 	    TCPS_HAVERCVDFIN(tp->t_state) == 0) {
-		m_adj(m, drop_hdrlen);	/* delayed header drop */
 		/*
 		 * Insert segment which includes th into TCP reassembly queue
 		 * with control block tp.  Set thflags to whether reassembly now
@@ -2572,6 +2571,7 @@
 		if (th->th_seq == tp->rcv_nxt &&
 		    RB_EMPTY(&tp->rcv_reass) &&
 		    TCPS_HAVEESTABLISHED(tp->t_state)) {
+			m_adj(m, drop_hdrlen);	/* delayed header drop */
 			if (DELAY_ACK(tp))
 				tp->t_flags |= TF_DELACK;
 			else
@@ -2590,14 +2590,16 @@
 			sorwakeup_locked(so);
 		} else {
 			/*
-			 * XXX: Due to the header drop above "th" is
-			 * theoretically invalid by now.  Fortunately
-			 * m_adj() doesn't actually frees any mbufs
-			 * when trimming from the head.
+			 * NB: tcp_reass() always consumes the mbuf chain.
 			 */
-			thflags |= tcp_reass(tp, th, &tlen, m);
+			thflags = tcp_reass(tp, th, &tlen, m);
 			tp->t_flags |= TF_ACKNOW;
 		}
+#ifdef INVARIANTS
+		th = NULL;
+		m = NULL;
+		tlen = 0;
+#endif /* INVARIANTS */
 #if 0
 		/*
 		 * Note the amount of data that peer has sent into


More information about the p4-projects mailing list