Module Name:    src
Committed By:   maxv
Date:           Sun Apr  8 12:18:06 UTC 2018

Modified Files:
        src/sys/netinet: ip_var.h tcp_input.c

Log Message:
Remove the ipre_mlast field and the TRAVERSE macro.

The goal was to store in ipre_mlast the last mbuf of the chain, so that
m_cat could be called on it. But it's not needed, since m_cat already
does the equivalent of TRAVERSE itself.

If it were needed, there would be a bug, since we don't call TRAVERSE on
ipre_mlast when creating a new reassembly entry.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/netinet/ip_var.h
cvs rdiff -u -r1.404 -r1.405 src/sys/netinet/tcp_input.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_var.h
diff -u src/sys/netinet/ip_var.h:1.124 src/sys/netinet/ip_var.h:1.125
--- src/sys/netinet/ip_var.h:1.124	Sun Apr  8 11:50:46 2018
+++ src/sys/netinet/ip_var.h	Sun Apr  8 12:18:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_var.h,v 1.124 2018/04/08 11:50:46 maxv Exp $	*/
+/*	$NetBSD: ip_var.h,v 1.125 2018/04/08 12:18:06 maxv Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -72,8 +72,7 @@ struct ipflow {
 TAILQ_HEAD(ipqehead, ipqent);
 struct ipqent {
 	TAILQ_ENTRY(ipqent) ipqe_q;
-	struct mbuf	*ipqe_m;	/* point to first mbuf */
-	struct mbuf	*ipre_mlast;	/* point to last mbuf */
+	struct mbuf *ipqe_m;
 	TAILQ_ENTRY(ipqent) ipqe_timeq;
 	u_int32_t ipqe_seq;
 	u_int32_t ipqe_len;

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.404 src/sys/netinet/tcp_input.c:1.405
--- src/sys/netinet/tcp_input.c:1.404	Tue Apr  3 09:03:59 2018
+++ src/sys/netinet/tcp_input.c	Sun Apr  8 12:18:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.404 2018/04/03 09:03:59 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.405 2018/04/08 12:18:06 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.404 2018/04/03 09:03:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.405 2018/04/08 12:18:06 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -405,8 +405,6 @@ static void tcp4_log_refused(const struc
 static void tcp6_log_refused(const struct ip6_hdr *, const struct tcphdr *);
 #endif
 
-#define	TRAVERSE(x) while ((x)->m_next) (x) = (x)->m_next
-
 #if defined(MBUFTRACE)
 struct mowner tcp_reass_mowner = MOWNER_INIT("tcp", "reass");
 #endif /* defined(MBUFTRACE) */
@@ -501,8 +499,7 @@ tcp_reass(struct tcpcb *tp, const struct
 		if (pkt_seq == p->ipqe_seq + p->ipqe_len) {
 			p->ipqe_len += pkt_len;
 			p->ipqe_flags |= pkt_flags;
-			m_cat(p->ipre_mlast, m);
-			TRAVERSE(p->ipre_mlast);
+			m_cat(p->ipqe_m, m);
 			m = NULL;
 			tiqe = p;
 			TAILQ_REMOVE(&tp->timeq, p, ipqe_timeq);
@@ -533,8 +530,6 @@ tcp_reass(struct tcpcb *tp, const struct
 			q->ipqe_flags |= pkt_flags;
 			m_cat(m, q->ipqe_m);
 			q->ipqe_m = m;
-			q->ipre_mlast = m; /* last mbuf may have changed */
-			TRAVERSE(q->ipre_mlast);
 			tiqe = q;
 			TAILQ_REMOVE(&tp->timeq, q, ipqe_timeq);
 			TCP_REASS_COUNTER_INCR(&tcp_reass_prependfirst);
@@ -562,8 +557,7 @@ tcp_reass(struct tcpcb *tp, const struct
 			pkt_len += q->ipqe_len;
 			pkt_flags |= q->ipqe_flags;
 			pkt_seq = q->ipqe_seq;
-			m_cat(q->ipre_mlast, m);
-			TRAVERSE(q->ipre_mlast);
+			m_cat(q->ipqe_m, m);
 			m = q->ipqe_m;
 			TCP_REASS_COUNTER_INCR(&tcp_reass_append);
 			goto free_ipqe;
@@ -629,8 +623,7 @@ tcp_reass(struct tcpcb *tp, const struct
 			int overlap = q->ipqe_seq + q->ipqe_len - pkt_seq;
 			m_adj(m, overlap);
 			rcvpartdupbyte += overlap;
-			m_cat(q->ipre_mlast, m);
-			TRAVERSE(q->ipre_mlast);
+			m_cat(q->ipqe_m, m);
 			m = q->ipqe_m;
 			pkt_seq = q->ipqe_seq;
 			pkt_len += q->ipqe_len - overlap;
@@ -750,7 +743,6 @@ insert_it:
 	 * Insert the new fragment queue entry into both queues.
 	 */
 	tiqe->ipqe_m = m;
-	tiqe->ipre_mlast = m;
 	tiqe->ipqe_seq = pkt_seq;
 	tiqe->ipqe_len = pkt_len;
 	tiqe->ipqe_flags = pkt_flags;

Reply via email to