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 | |
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
-rw-r--r-- | sys/net/if_pfsync.c | 8 | ||||
-rw-r--r-- | sys/net/if_pfsync.h | 6 |
2 files changed, 10 insertions, 4 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; diff --git a/sys/net/if_pfsync.h b/sys/net/if_pfsync.h index 108dc47a341..6a6e024a3d5 100644 --- a/sys/net/if_pfsync.h +++ b/sys/net/if_pfsync.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.h,v 1.40 2009/11/09 23:46:38 dlg Exp $ */ +/* $OpenBSD: if_pfsync.h,v 1.41 2010/01/10 23:54:21 dlg Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -114,7 +114,7 @@ struct pfsync_header { u_int8_t version; u_int8_t _pad; - u_int16_t len; + u_int16_t len; /* in bytes */ u_int8_t pfcksum[PF_MD5_DIGEST_LENGTH]; } __packed; @@ -124,7 +124,7 @@ struct pfsync_header { struct pfsync_subheader { u_int8_t action; - u_int8_t _pad; + u_int8_t len; /* in dwords */ u_int16_t count; } __packed; |