Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jul 2009 15:16:15 GMT
From:      Andre Oppermann <andre@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 166454 for review
Message-ID:  <200907231516.n6NFGFEX036179@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=166454

Change 166454 by andre@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



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