From owner-freebsd-ipfw@FreeBSD.ORG Tue Apr 5 21:30:15 2011 Return-Path: Delivered-To: freebsd-ipfw@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32088106566C for ; Tue, 5 Apr 2011 21:30:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 233BE8FC19 for ; Tue, 5 Apr 2011 21:30:15 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p35LUFFR030955 for ; Tue, 5 Apr 2011 21:30:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p35LUElF030950; Tue, 5 Apr 2011 21:30:14 GMT (envelope-from gnats) Date: Tue, 5 Apr 2011 21:30:14 GMT Message-Id: <201104052130.p35LUElF030950@freefall.freebsd.org> To: freebsd-ipfw@FreeBSD.org From: Gleb Smirnoff Cc: Subject: kern/156180 X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Gleb Smirnoff List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2011 21:30:15 -0000 The following reply was made to PR kern/156180; it has been noted by GNATS. From: Gleb Smirnoff To: bug-followup@FreeBSD.org Cc: ae@FreeBSD.org Subject: kern/156180 Date: Wed, 6 Apr 2011 01:07:29 +0400 --5gxpn/Q6ypwruk0T Content-Type: text/plain; charset=koi8-r Content-Disposition: inline What about the following approach? See attached snap, not tested, patch. -- Totus tuus, Glebius. --5gxpn/Q6ypwruk0T Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="156180.diff" Index: ip_fw2.c =================================================================== --- ip_fw2.c (revision 220373) +++ ip_fw2.c (working copy) @@ -913,9 +913,10 @@ * pointer might become stale after other pullups (but we never use it * this way). */ -#define PULLUP_TO(_len, p, T) \ +#define PULLUP_TO(_len, p, T) PULLUP_LEN(_len, p, sizeof(T)) +#define PULLUP_LEN(_len, p, T) \ do { \ - int x = (_len) + sizeof(T); \ + int x = (_len) + T; \ if ((m)->m_len < x) { \ args->m = m = m_pullup(m, x); \ if (m == NULL) \ @@ -1600,6 +1601,7 @@ break; case O_TCPOPTS: + PULLUP_LEN(hlen, ulp, (TCP(ulp)->th_off << 2)); match = (proto == IPPROTO_TCP && offset == 0 && tcpopts_match(TCP(ulp), cmd)); break; @@ -2230,6 +2232,7 @@ } } /* end of inner loop, scan opcodes */ +#undef PULLUP_LEN if (done) break; --5gxpn/Q6ypwruk0T--