From owner-freebsd-current Mon Oct 26 00:44:00 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA17958 for freebsd-current-outgoing; Mon, 26 Oct 1998 00:44:00 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from gatekeeper.tsc.tdk.com (gatekeeper.tsc.tdk.com [207.113.159.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA17952 for ; Mon, 26 Oct 1998 00:43:57 -0800 (PST) (envelope-from gdonl@tsc.tdk.com) Received: from sunrise.gv.tsc.tdk.com (root@sunrise.gv.tsc.tdk.com [192.168.241.191]) by gatekeeper.tsc.tdk.com (8.8.8/8.8.8) with ESMTP id AAA06923; Mon, 26 Oct 1998 00:43:11 -0800 (PST) (envelope-from gdonl@tsc.tdk.com) Received: from salsa.gv.tsc.tdk.com (salsa.gv.tsc.tdk.com [192.168.241.194]) by sunrise.gv.tsc.tdk.com (8.8.5/8.8.5) with ESMTP id AAA23777; Mon, 26 Oct 1998 00:43:10 -0800 (PST) Received: (from gdonl@localhost) by salsa.gv.tsc.tdk.com (8.8.5/8.8.5) id AAA26326; Mon, 26 Oct 1998 00:43:08 -0800 (PST) From: Don Lewis Message-Id: <199810260843.AAA26326@salsa.gv.tsc.tdk.com> Date: Mon, 26 Oct 1998 00:43:08 -0800 X-Mailer: Mail User's Shell (7.2.6 alpha(3) 7/19/95) To: Don Lewis , Doug Rabson Subject: Re: nestea v2 against freebsd 3.0-Release (fwd) Cc: Kris Kennaway , wollman@khavrinen.lcs.mit.edu, current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Here's a similar patch that also does some rearrangement so that it can optimize out some conditional code. I think it's also a bit easier to understand. I've only lightly tested this patch. --- ip_input.c.orig Fri Oct 23 02:17:19 1998 +++ ip_input.c Mon Oct 26 00:34:42 1998 @@ -711,13 +711,13 @@ fp->ipq_id = ip->ip_id; fp->ipq_src = ip->ip_src; fp->ipq_dst = ip->ip_dst; - fp->ipq_frags = 0; + fp->ipq_frags = m; + m->m_nextpkt = NULL; #ifdef IPDIVERT fp->ipq_divert = 0; fp->ipq_div_cookie = 0; #endif - q = 0; - goto insert; + goto inserted; } #define GETIP(m) ((struct ip*)((m)->m_pkthdr.header)) @@ -732,7 +732,8 @@ /* * If there is a preceding segment, it may provide some of * our data already. If so, drop the data from the incoming - * segment. If it provides all of our data, drop us. + * segment. If it provides all of our data, drop us, otherwise + * stick new segment in the proper place. */ if (p) { i = GETIP(p)->ip_off + GETIP(p)->ip_len - ip->ip_off; @@ -743,6 +744,11 @@ ip->ip_off += i; ip->ip_len -= i; } + m->m_nextpkt = p->m_nextpkt; + p->m_nextpkt = m; + } else { + m->m_nextpkt = fp->ipq_frags; + fp->ipq_frags = m; } /* @@ -750,7 +756,7 @@ * if they are completely covered, dequeue them. */ for (; q != NULL && ip->ip_off + ip->ip_len > GETIP(q)->ip_off; - p = q, q = nq) { + q = nq) { i = (ip->ip_off + ip->ip_len) - GETIP(q)->ip_off; if (i < GETIP(q)->ip_len) { @@ -760,14 +766,11 @@ break; } nq = q->m_nextpkt; - if (p) - p->m_nextpkt = nq; - else - fp->ipq_frags = nq; + m->m_nextpkt = nq; m_freem(q); } -insert: +inserted: #ifdef IPDIVERT /* @@ -782,16 +785,8 @@ #endif /* - * Stick new segment in its place; - * check for complete reassembly. + * Check for complete reassembly. */ - if (p == NULL) { - m->m_nextpkt = fp->ipq_frags; - fp->ipq_frags = m; - } else { - m->m_nextpkt = p->m_nextpkt; - p->m_nextpkt = m; - } next = 0; for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) { if (GETIP(q)->ip_off != next) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message