Date: Mon, 26 Oct 1998 00:43:08 -0800 From: Don Lewis <Don.Lewis@tsc.tdk.com> To: Don Lewis <Don.Lewis@tsc.tdk.com>, Doug Rabson <dfr@nlsystems.com> Cc: Kris Kennaway <kkennawa@physics.adelaide.edu.au>, wollman@khavrinen.lcs.mit.edu, current@FreeBSD.ORG Subject: Re: nestea v2 against freebsd 3.0-Release (fwd) Message-ID: <199810260843.AAA26326@salsa.gv.tsc.tdk.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810260843.AAA26326>
