summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2011-08-03 00:01:30 +0000
committerdlg <dlg@openbsd.org>2011-08-03 00:01:30 +0000
commitb4c7c56e5a262a36adcdbcf708e643c9352af4e9 (patch)
treed8dc2ff088a750b56b4ab3883cf0c03ecc46f26a
parentclean up the 1st sentence even more. it is unbelievable how it sometimes (diff)
downloadwireguard-openbsd-b4c7c56e5a262a36adcdbcf708e643c9352af4e9.tar.xz
wireguard-openbsd-b4c7c56e5a262a36adcdbcf708e643c9352af4e9.zip
someone (*cough*henning*cough*) made pf_state.state_flags a u_int16_t
without growing it in pfsync_state too. to keep the wire format compat this uses some of the pad bytes to send all the state flags on the wire as well as maintaining the old state_flags field. after 5.0 we'll deprecate the original field and only use the new one. discussed with mcbride and deraadt and based on a diff from deraadt. tested against an "old" pfsync locally. ok mcbride@ henning@ deraadt@
-rw-r--r--sys/net/if_pfsync.c7
-rw-r--r--sys/net/pfvar.h7
2 files changed, 9 insertions, 5 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 7c951659c36..f8525bc8354 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.166 2011/08/02 13:13:57 mcbride Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.167 2011/08/03 00:01:30 dlg Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -449,7 +449,9 @@ pfsync_state_export(struct pfsync_state *sp, struct pf_state *st)
sp->direction = st->direction;
sp->log = st->log;
sp->timeout = st->timeout;
+ /* XXX replace state_flags post 5.0 */
sp->state_flags = st->state_flags;
+ sp->all_state_flags = htons(st->state_flags);
if (!SLIST_EMPTY(&st->src_nodes))
sp->sync_flags |= PFSYNC_FLAG_SRCNODE;
@@ -580,7 +582,8 @@ pfsync_state_import(struct pfsync_state *sp, int flags)
st->direction = sp->direction;
st->log = sp->log;
st->timeout = sp->timeout;
- st->state_flags = sp->state_flags;
+ /* XXX replace state_flags post 5.0 */
+ st->state_flags = sp->state_flags | ntohs(sp->all_state_flags);
st->max_mss = ntohs(sp->max_mss);
st->min_ttl = sp->min_ttl;
st->set_tos = sp->set_tos;
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 00bb367130c..eb0a887b96d 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfvar.h,v 1.342 2011/08/02 13:13:57 mcbride Exp $ */
+/* $OpenBSD: pfvar.h,v 1.343 2011/08/03 00:01:30 dlg Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -903,13 +903,14 @@ struct pfsync_state {
u_int8_t proto;
u_int8_t direction;
u_int8_t log;
- u_int8_t state_flags;
+ u_int8_t state_flags; /* XXX remove after 5.0 */
u_int8_t timeout;
u_int8_t sync_flags;
u_int8_t updates;
u_int8_t min_ttl;
u_int8_t set_tos;
- u_int8_t pad[4];
+ u_int16_t all_state_flags;
+ u_int8_t pad[2];
} __packed;
#define PFSYNC_FLAG_SRCNODE 0x04