From owner-freebsd-current Mon Oct 26 00:42:43 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA17874 for freebsd-current-outgoing; Mon, 26 Oct 1998 00:42:43 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA17863 for ; Mon, 26 Oct 1998 00:42:40 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from herring.nlsystems.com (herring.nlsystems.com [10.0.0.2]) by nlsystems.com (8.9.1/8.8.5) with SMTP id IAA18335; Mon, 26 Oct 1998 08:43:22 GMT Date: Mon, 26 Oct 1998 08:43:22 +0000 (GMT) From: Doug Rabson To: Don Lewis cc: Kris Kennaway , wollman@khavrinen.lcs.mit.edu, current@FreeBSD.ORG Subject: Re: nestea v2 against freebsd 3.0-Release (fwd) In-Reply-To: <199810260715.XAA26243@salsa.gv.tsc.tdk.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 25 Oct 1998, Don Lewis wrote: > Lets say we start off with fp->ipq_frags pointing to the list: > > fp->ipq_frags => frag1(offset 0) => frag2(offset 6) => NULL > > and we receive a new fragment with offset 0 that overlaps both > frag1 and frag2. > > /* > * Find a segment which begins after this one does. > */ > for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) > if (GETIP(q)->ip_off > ip->ip_off) > break; > > after the above loop, we'll have: > > fp->ipq_frags => frag1(offset 0) => frag2(offset 6) => NULL > ^ ^ > | | > p q > > Next, we remove the beginning part of the new fragment that overlaps frag1 if > any (code not shown). > > Next, we want to throw away any fragments starting at q that are completely > covered by the new fragment, and if we find a fragment in the list that > partially overlaps the new fragment, we want to remove data from its beginning > to remove the overlap. > > [...] > > The 'if (i < GETIP(q)->ip_len)' clause takes care of the partial overlap > case. > > Using 'p = q, q = nq' in the for loop causes the following to be executed > at the end of each loop. > > m_freem(q); > p = q; > q = nq; > > This means that 'p' references something on the free list. Also, we > don't want to change 'p' because that is our insertion point for the > new fragment. Thanks for the explanation. Would you like to commit the patch or shall I? -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 951 1891 Fax: +44 181 381 1039 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message