summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/net/if_pfsync.c18
-rw-r--r--sys/net/pf_ioctl.c4
-rw-r--r--sys/net/pfvar.h4
-rw-r--r--usr.bin/systat/cache.c18
-rw-r--r--usr.bin/systat/cache.h5
5 files changed, 25 insertions, 24 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;
diff --git a/usr.bin/systat/cache.c b/usr.bin/systat/cache.c
index f199919df75..5c9a2a89d6f 100644
--- a/usr.bin/systat/cache.c
+++ b/usr.bin/systat/cache.c
@@ -1,4 +1,4 @@
-/* $Id: cache.c,v 1.3 2008/12/07 02:56:06 canacar Exp $ */
+/* $Id: cache.c,v 1.4 2011/11/29 10:17:52 dlg Exp $ */
/*
* Copyright (c) 2001, 2007 Can Erkin Acar <canacar@openbsd.org>
*
@@ -118,8 +118,8 @@ add_state(struct pfsync_state *st)
cache_size--;
- ent->id[0] = st->id[0];
- ent->id[1] = st->id[1];
+ ent->id = st->id;
+ ent->creatorid = st->creatorid;
ent->bytes = COUNTER(st->bytes[0]) + COUNTER(st->bytes[1]);
ent->peak = 0;
ent->rate = 0;
@@ -139,8 +139,8 @@ cache_state(struct pfsync_state *st)
if (cache_max == 0)
return (NULL);
- ent.id[0] = st->id[0];
- ent.id[1] = st->id[1];
+ ent.id = st->id;
+ ent.creatorid = st->creatorid;
old = RB_FIND(sc_tree, &sctree, &ent);
if (old == NULL) {
@@ -189,13 +189,13 @@ cache_endupdate(void)
static __inline int
sc_cmp(struct sc_ent *a, struct sc_ent *b)
{
- if (a->id[0] > b->id[0])
+ if (a->id > b->id)
return (1);
- if (a->id[0] < b->id[0])
+ if (a->id < b->id)
return (-1);
- if (a->id[1] > b->id[1])
+ if (a->creatorid > b->creatorid)
return (1);
- if (a->id[1] < b->id[1])
+ if (a->creatorid < b->creatorid)
return (-1);
return (0);
}
diff --git a/usr.bin/systat/cache.h b/usr.bin/systat/cache.h
index d09620dd20e..abc72cfe2cb 100644
--- a/usr.bin/systat/cache.h
+++ b/usr.bin/systat/cache.h
@@ -1,4 +1,4 @@
-/* $Id: cache.h,v 1.2 2008/07/16 10:23:39 canacar Exp $ */
+/* $Id: cache.h,v 1.3 2011/11/29 10:17:52 dlg Exp $ */
/*
* Copyright (c) 2001, 2007 Can Erkin Acar <canacar@openbsd.org>
*
@@ -25,7 +25,8 @@
struct sc_ent {
RB_ENTRY(sc_ent) tlink;
TAILQ_ENTRY(sc_ent) qlink;
- u_int32_t id[2];
+ u_int64_t id;
+ u_int32_t creatorid;
double peak;
double rate;
time_t t;