diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2011-11-29 10:17:53 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2011-11-29 10:17:53 +0000 |
commit | e10fd0f6269e09e343c373e11984718fe4d3910e (patch) | |
tree | a9f5b03d3c7e0601fcbe4047fed16039f7a865b3 /sys/net | |
parent | c1bc07b4e505bf0e75a7ec3d4f6ed5322db04d91 (diff) |
use a u_int64_t for the state id in pfsync_state. this makes it consistent
with every other thing that stores the state id (including other pfsync
messages).
includes improvements to the systat code to consider the creatorid as well
as the state id in its cache to avoid collisions between states created on
different hosts.
tested by me in production and on amd64 talking to sparc64.
ok henning@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_pfsync.c | 18 | ||||
-rw-r--r-- | sys/net/pf_ioctl.c | 4 | ||||
-rw-r--r-- | sys/net/pfvar.h | 4 |
3 files changed, 13 insertions, 13 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c index 48b8e00e8f3..009f797a96d 100644 --- a/sys/net/if_pfsync.c +++ b/sys/net/if_pfsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.c,v 1.177 2011/11/27 16:06:30 mikeb Exp $ */ +/* $OpenBSD: if_pfsync.c,v 1.178 2011/11/29 10:17:52 dlg Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -457,7 +457,7 @@ pfsync_state_export(struct pfsync_state *sp, struct pf_state *st) if (!SLIST_EMPTY(&st->src_nodes)) sp->sync_flags |= PFSYNC_FLAG_SRCNODE; - bcopy(&st->id, &sp->id, sizeof(sp->id)); + sp->id = st->id; sp->creatorid = st->creatorid; pf_state_peer_hton(&st->src, &sp->src); pf_state_peer_hton(&st->dst, &sp->dst); @@ -611,7 +611,7 @@ pfsync_state_import(struct pfsync_state *sp, int flags) st->min_ttl = sp->min_ttl; st->set_tos = sp->set_tos; - bcopy(sp->id, &st->id, sizeof(st->id)); + st->id = sp->id; st->creatorid = sp->creatorid; pf_state_peer_ntoh(&sp->src, &st->src); pf_state_peer_ntoh(&sp->dst, &st->dst); @@ -859,7 +859,7 @@ pfsync_in_iack(caddr_t buf, int len, int count, int flags) for (i = 0; i < count; i++) { ia = (struct pfsync_ins_ack *)(buf + len * i); - bcopy(&ia->id, &id_key.id, sizeof(id_key.id)); + id_key.id = ia->id; id_key.creatorid = ia->creatorid; st = pf_find_state_byid(&id_key); @@ -928,7 +928,7 @@ pfsync_in_upd(caddr_t buf, int len, int count, int flags) continue; } - bcopy(sp->id, &id_key.id, sizeof(id_key.id)); + id_key.id = sp->id; id_key.creatorid = sp->creatorid; st = pf_find_state_byid(&id_key); @@ -1005,7 +1005,7 @@ pfsync_in_upd_c(caddr_t buf, int len, int count, int flags) continue; } - bcopy(&up->id, &id_key.id, sizeof(id_key.id)); + id_key.id = up->id; id_key.creatorid = up->creatorid; st = pf_find_state_byid(&id_key); @@ -1067,7 +1067,7 @@ pfsync_in_ureq(caddr_t buf, int len, int count, int flags) for (i = 0; i < count; i++) { ur = (struct pfsync_upd_req *)(buf + len * i); - bcopy(&ur->id, &id_key.id, sizeof(id_key.id)); + id_key.id = ur->id; id_key.creatorid = ur->creatorid; if (id_key.id == 0 && id_key.creatorid == 0) @@ -1099,7 +1099,7 @@ pfsync_in_del(caddr_t buf, int len, int count, int flags) for (i = 0; i < count; i++) { sp = (struct pfsync_state *)(buf + len * i); - bcopy(sp->id, &id_key.id, sizeof(id_key.id)); + id_key.id = sp->id; id_key.creatorid = sp->creatorid; st = pf_find_state_byid(&id_key); @@ -1125,7 +1125,7 @@ pfsync_in_del_c(caddr_t buf, int len, int count, int flags) for (i = 0; i < count; i++) { sp = (struct pfsync_del_c *)(buf + len * i); - bcopy(&sp->id, &id_key.id, sizeof(id_key.id)); + id_key.id = sp->id; id_key.creatorid = sp->creatorid; st = pf_find_state_byid(&id_key); diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 980d5d29d4f..aa883ba6d14 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.246 2011/11/28 01:04:50 dlg Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.247 2011/11/29 10:17:52 dlg Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1408,7 +1408,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) struct pf_state_cmp id_key; bzero(&id_key, sizeof(id_key)); - bcopy(ps->state.id, &id_key.id, sizeof(id_key.id)); + id_key.id = ps->state.id; id_key.creatorid = ps->state.creatorid; s = pf_find_state_byid(&id_key); diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index f1d2b1c51e5..62e5652afef 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar.h,v 1.356 2011/11/28 01:04:50 dlg Exp $ */ +/* $OpenBSD: pfvar.h,v 1.357 2011/11/29 10:17:52 dlg Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -887,7 +887,7 @@ struct pfsync_state_key { }; struct pfsync_state { - u_int32_t id[2]; + u_int64_t id; char ifname[IFNAMSIZ]; struct pfsync_state_key key[2]; struct pfsync_state_peer src; |