summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2012-03-08 09:20:00 +0000
committerglebius <glebius@FreeBSD.org>2012-03-08 09:20:00 +0000
commitd8060072d1c3c7524d479041d0b27e86668a0fe9 (patch)
tree32b57d435b5498c67634df8def521718d436ff11
parentfd7603d60b423c07ff1d83eb2019c0e8ffce1673 (diff)
downloadFreeBSD-src-d8060072d1c3c7524d479041d0b27e86668a0fe9.zip
FreeBSD-src-d8060072d1c3c7524d479041d0b27e86668a0fe9.tar.gz
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.
-rw-r--r--sys/contrib/pf/net/if_pfsync.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/contrib/pf/net/if_pfsync.c b/sys/contrib/pf/net/if_pfsync.c
index 0f3f5cc..f4d296d 100644
--- a/sys/contrib/pf/net/if_pfsync.c
+++ b/sys/contrib/pf/net/if_pfsync.c
@@ -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
*/
@@ -2011,6 +2012,7 @@ pfsync_out_upd_c(struct pf_state *st, struct mbuf *m, int offset)
{
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);
@@ -2023,8 +2025,6 @@ pfsync_out_upd_c(struct pf_state *st, struct mbuf *m, int offset)
up->expire = htonl(up->expire - time_second);
up->timeout = st->timeout;
- bzero(up->_pad, sizeof(up->_pad)); /* XXX */
-
return (sizeof(*up));
}
OpenPOWER on IntegriCloud