Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Mar 2012 09:19:24 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r233275 - in stable/9/sys: contrib/pf/net i386/conf
Message-ID:  <201203210919.q2L9JOhx063681@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203210919.q2L9JOhx063681>