From owner-svn-src-all@FreeBSD.ORG Wed Mar 21 09:19:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 857581065674; Wed, 21 Mar 2012 09:19:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5607F8FC0C; Wed, 21 Mar 2012 09:19:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2L9JOO3063683; Wed, 21 Mar 2012 09:19:24 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2L9JOhx063681; Wed, 21 Mar 2012 09:19:24 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201203210919.q2L9JOhx063681@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 21 Mar 2012 09:19:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233275 - in stable/9/sys: contrib/pf/net i386/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 09:19:24 -0000 Author: glebius Date: Wed Mar 21 09:19:23 2012 New Revision: 233275 URL: http://svn.freebsd.org/changeset/base/233275 Log: Merge 232685 from head: Merge from OpenBSD: revision 1.146 date: 2010/05/12 08:11:11; author: claudio; state: Exp; lines: +2 -3 bzero() the full compressed update struct before setting the values. This is needed because pf_state_peer_hton() skips some fields in certain situations which could result in garbage beeing sent to the other peer. This seems to fix the pfsync storms seen by stephan@ and so dlg owes me a whiskey. I didn't see any storms, but this definitely fixes a useless memory allocation on the receiving side, due to non zero scrub_flags field in a pfsync_state_peer structure. Modified: stable/9/sys/contrib/pf/net/if_pfsync.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- stable/9/sys/contrib/pf/net/if_pfsync.c Wed Mar 21 08:57:15 2012 (r233274) +++ stable/9/sys/contrib/pf/net/if_pfsync.c Wed Mar 21 09:19:23 2012 (r233275) @@ -48,6 +48,7 @@ * 1.120, 1.175 - use monotonic time_uptime * 1.122 - reduce number of updates for non-TCP sessions * 1.128 - cleanups + * 1.146 - bzero() mbuf before sparsely filling it with data * 1.170 - SIOCSIFMTU checks */ @@ -2020,6 +2021,7 @@ pfsync_out_upd_c(struct pf_state *st, st { struct pfsync_upd_c *up = (struct pfsync_upd_c *)(m->m_data + offset); + bzero(up, sizeof(*up)); up->id = st->id; pf_state_peer_hton(&st->src, &up->src); pf_state_peer_hton(&st->dst, &up->dst); @@ -2032,8 +2034,6 @@ pfsync_out_upd_c(struct pf_state *st, st up->expire = htonl(up->expire - time_second); up->timeout = st->timeout; - bzero(up->_pad, sizeof(up->_pad)); /* XXX */ - return (sizeof(*up)); }