diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2010-01-10 23:54:22 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2010-01-10 23:54:22 +0000 |
commit | 7dd20475c8d4f96569ff09a7be4f95dda9251728 (patch) | |
tree | dd7e64de7268a10b2f92c95276743117f809bc4a /sys/net/if_pfsync.c | |
parent | 818fc93d0c40ace3edf9223de2bc5946b077088b (diff) |
replace a pad in the pfsync subheader with a length field. it stores the
length of its message in dwords. multiply that by the count of the messages
to figure out how to skip to the next subheader.
"old" code still thinks the len field is a pad, which it doesnt look at, so
new messages with a filled in len are still parsed correctly by "old" code.
input and ok mcbride@
sounds good! Simon Perreault
Diffstat (limited to 'sys/net/if_pfsync.c')
-rw-r--r-- | sys/net/if_pfsync.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c index 3f19771e2e8..ebfe8f27640 100644 --- a/sys/net/if_pfsync.c +++ b/sys/net/if_pfsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.c,v 1.135 2009/12/14 12:31:45 henning Exp $ */ +/* $OpenBSD: if_pfsync.c,v 1.136 2010/01/10 23:54:21 dlg Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -1668,6 +1668,7 @@ pfsync_sendout(void) } bzero(subh, sizeof(*subh)); + subh->len = sizeof(ur->ur_msg) >> 2; subh->action = PFSYNC_ACT_UPD_REQ; subh->count = htons(count); } @@ -1696,6 +1697,7 @@ pfsync_sendout(void) bzero(subh, sizeof(*subh)); subh->action = PFSYNC_ACT_TDB; + subh->len = sizeof(struct pfsync_tdb) >> 2; subh->count = htons(count); } @@ -1722,6 +1724,7 @@ pfsync_sendout(void) bzero(subh, sizeof(*subh)); subh->action = pfsync_qs[q].action; + subh->len = pfsync_qs[q].len >> 2; subh->count = htons(count); } @@ -1730,6 +1733,7 @@ pfsync_sendout(void) bzero(subh, sizeof(*subh)); subh->action = PFSYNC_ACT_EOF; + subh->len = 0 >> 2; subh->count = htons(1); /* we're done, let's put it on the wire */ @@ -2082,6 +2086,7 @@ pfsync_clear_states(u_int32_t creatorid, const char *ifname) bzero(&r, sizeof(r)); r.subh.action = PFSYNC_ACT_CLR; + r.subh.len = sizeof(struct pfsync_clr) >> 2; r.subh.count = htons(1); strlcpy(r.clr.ifname, ifname, sizeof(r.clr.ifname)); @@ -2286,6 +2291,7 @@ pfsync_bulk_status(u_int8_t status) bzero(&r, sizeof(r)); r.subh.action = PFSYNC_ACT_BUS; + r.subh.len = sizeof(struct pfsync_bus) >> 2; r.subh.count = htons(1); r.bus.creatorid = pf_status.hostid; |