PERFORCE change 166491 for review

Andre Oppermann andre at FreeBSD.org
Fri Jul 24 09:08:51 UTC 2009


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

Change 166491 by andre at andre_t61 on 2009/07/24 09:08:32

	Pass the header length to tcp_reass() so we can drop it there.
	Adjust KASSERT's.

Affected files ...

.. //depot/projects/tcp_reass/netinet/tcp_input.c#16 edit
.. //depot/projects/tcp_reass/netinet/tcp_reass.c#48 edit
.. //depot/projects/tcp_reass/netinet/tcp_var.h#23 edit

Differences ...

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

@@ -1999,7 +1999,7 @@
 		 * later; if not, do so now to pass queued data to user.
 		 */
 		if (tlen == 0 && (thflags & TH_FIN) == 0)
-			(void)tcp_reass(tp, NULL, 0, NULL);
+			(void)tcp_reass(tp, NULL, NULL, 0, 0);
 		tp->snd_wl1 = th->th_seq - 1;
 		/* FALLTHROUGH */
 
@@ -2591,7 +2591,7 @@
 			/*
 			 * NB: tcp_reass() always consumes the mbuf chain.
 			 */
-			thflags = tcp_reass(tp, th, tlen, m);
+			thflags = tcp_reass(tp, th, m, tlen, drop_hdrlen);
 			tp->t_flags |= TF_ACKNOW;
 		}
 #ifdef INVARIANTS

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

@@ -276,7 +276,7 @@
  * the queue or by freeing it.
  */
 int
-tcp_reass(struct tcpcb *tp, struct tcphdr *th, int len, struct mbuf *m)
+tcp_reass(struct tcpcb *tp, struct tcphdr *th, struct mbuf *m, int len, int hlen)
 {
 	int thflags = 0;
 	tcp_seq th_seq;
@@ -303,8 +303,10 @@
 
 	KASSERT(th != NULL, ("%s: th is NULL", __func__));
 	KASSERT(m != NULL, ("%s: m is NULL", __func__));
-	KASSERT(len == m_length(m, NULL),
-	    ("%s: tlen != mbuf length", __func__));
+	KASSERT(len + hlen == m_length(m, NULL),
+	    ("%s: len + hlen != mbuf length", __func__));
+	KASSERT(hlen <= m_length(m, NULL),
+	    ("%s: hlen > mbuf length", __func__));
 
 	/*
 	 * Store TCP header information in local variables as
@@ -387,6 +389,7 @@
 	 * Compact mbuf chain.
 	 */
 	m_demote(m, 1);
+	m_adj(m, hlen);
 	m = m_trimhead(m);
 	if (tcp_reass_spacetime && m->m_next != NULL)
 		m = m_collapse(m, M_DONTWAIT, 1024);

==== //depot/projects/tcp_reass/netinet/tcp_var.h#23 (text+ko) ====

@@ -649,7 +649,7 @@
 void	 tcp_fini(void *);
 char 	*tcp_log_addrs(struct in_conninfo *, struct tcphdr *, void *,
 	    const void *);
-int	 tcp_reass(struct tcpcb *, struct tcphdr *, int, struct mbuf *);
+int	 tcp_reass(struct tcpcb *, struct tcphdr *, struct mbuf *, int, int);
 void	 tcp_reass_init(void);
 int	 tcp_reass_sack(struct tcpcb *, u_char *, int);
 void	 tcp_reass_flush(struct tcpcb *);


More information about the p4-projects mailing list