summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/pfctl/pf_print_state.c4
-rw-r--r--sbin/pfctl/pfctl_parser.c5
-rw-r--r--sys/net/if_pfsync.c10
-rw-r--r--sys/net/if_pfsync.h17
-rw-r--r--sys/net/pf.c11
-rw-r--r--sys/net/pfvar.h10
-rw-r--r--usr.sbin/tcpdump/pf_print_state.c4
-rw-r--r--usr.sbin/tcpdump/print-pfsync.c12
8 files changed, 43 insertions, 30 deletions
diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c
index 21670992eec..ec7bfa7060a 100644
--- a/sbin/pfctl/pf_print_state.c
+++ b/sbin/pfctl/pf_print_state.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_print_state.c,v 1.41 2005/05/24 22:14:22 pascoe Exp $ */
+/* $OpenBSD: pf_print_state.c,v 1.42 2005/11/04 08:24:15 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -274,7 +274,7 @@ print_state(struct pf_state *s, int opts)
min = s->expire % 60;
s->expire /= 60;
printf(", expires in %.2u:%.2u:%.2u", s->expire, min, sec);
- printf(", %u:%u pkts, %u:%u bytes",
+ printf(", %llu:%llu pkts, %llu:%llu bytes",
s->packets[0], s->packets[1], s->bytes[0], s->bytes[1]);
if (s->anchor.nr != -1)
printf(", anchor %u", s->anchor.nr);
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 429647ba396..5f0069ab721 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.221 2005/10/18 08:59:30 henning Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.222 2005/11/04 08:24:15 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -638,7 +638,8 @@ print_src_node(struct pf_src_node *sn, int opts)
printf(", expires in %.2u:%.2u:%.2u",
sn->expire, min, sec);
}
- printf(", %u pkts, %u bytes", sn->packets[0] + sn->packets[1],
+ printf(", %llu pkts, %llu bytes",
+ sn->packets[0] + sn->packets[1],
sn->bytes[0] + sn->bytes[1]);
switch (sn->ruletype) {
case PF_NAT:
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 3143f754458..b72daed2958 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.58 2005/11/01 06:26:52 pascoe Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.59 2005/11/04 08:24:14 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -1135,10 +1135,10 @@ pfsync_pack_state(u_int8_t action, struct pf_state *st, int flags)
bcopy(&st->rt_addr, &sp->rt_addr, sizeof(sp->rt_addr));
sp->creation = htonl(secs - st->creation);
- sp->packets[0] = htonl(st->packets[0]);
- sp->packets[1] = htonl(st->packets[1]);
- sp->bytes[0] = htonl(st->bytes[0]);
- sp->bytes[1] = htonl(st->bytes[1]);
+ pf_state_counter_hton(st->packets[0], sp->packets[0]);
+ pf_state_counter_hton(st->packets[1], sp->packets[1]);
+ pf_state_counter_hton(st->bytes[0], sp->bytes[0]);
+ pf_state_counter_hton(st->bytes[1], sp->bytes[1]);
if ((r = st->rule.ptr) == NULL)
sp->rule = htonl(-1);
else
diff --git a/sys/net/if_pfsync.h b/sys/net/if_pfsync.h
index 70bd69666e1..62902ddc1dc 100644
--- a/sys/net/if_pfsync.h
+++ b/sys/net/if_pfsync.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.h,v 1.27 2005/10/27 12:34:40 mcbride Exp $ */
+/* $OpenBSD: if_pfsync.h,v 1.28 2005/11/04 08:24:14 mcbride Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -72,8 +72,8 @@ struct pfsync_state {
u_int32_t nat_rule;
u_int32_t creation;
u_int32_t expire;
- u_int32_t packets[2];
- u_int32_t bytes[2];
+ u_int32_t packets[2][2];
+ u_int32_t bytes[2][2];
u_int32_t creatorid;
sa_family_t af;
u_int8_t proto;
@@ -295,6 +295,17 @@ struct pfsyncreq {
(d)->port = (s)->port; \
} while (0)
+#define pf_state_counter_hton(s,d) do { \
+ d[0] = htonl((s>>32)&0xffffffff); \
+ d[1] = htonl(s&0xffffffff); \
+} while (0)
+
+#define pf_state_counter_ntoh(s,d) do { \
+ d = ntohl(s[0]); \
+ d = d<<32; \
+ d += ntohl(s[1]); \
+} while (0)
+
#ifdef _KERNEL
void pfsync_input(struct mbuf *, ...);
int pfsync_clear_states(u_int32_t, char *);
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 4d5847e7886..ccc577f2067 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.506 2005/10/26 03:47:33 mcbride Exp $ */
+/* $OpenBSD: pf.c,v 1.507 2005/11/04 08:24:15 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -4384,8 +4384,8 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif,
printf("pf: loose state match: ");
pf_print_state(*state);
pf_print_flags(th->th_flags);
- printf(" seq=%u ack=%u len=%u ackskew=%d pkts=%d:%d\n",
- seq, ack, pd->p_len, ackskew,
+ printf(" seq=%u ack=%u len=%u ackskew=%d "
+ "pkts=%llu:%llu\n", seq, ack, pd->p_len, ackskew,
(*state)->packets[0], (*state)->packets[1]);
}
@@ -4436,8 +4436,9 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif,
printf("pf: BAD state: ");
pf_print_state(*state);
pf_print_flags(th->th_flags);
- printf(" seq=%u ack=%u len=%u ackskew=%d pkts=%d:%d "
- "dir=%s,%s\n", seq, ack, pd->p_len, ackskew,
+ printf(" seq=%u ack=%u len=%u ackskew=%d "
+ "pkts=%llu:%llu dir=%s,%s\n",
+ seq, ack, pd->p_len, ackskew,
(*state)->packets[0], (*state)->packets[1],
direction == PF_IN ? "in" : "out",
direction == (*state)->direction ? "fwd" : "rev");
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index fb1e653e589..50b387e1d26 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfvar.h,v 1.232 2005/10/27 12:34:40 mcbride Exp $ */
+/* $OpenBSD: pfvar.h,v 1.233 2005/11/04 08:24:15 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -625,8 +625,8 @@ struct pf_src_node {
struct pf_addr raddr;
union pf_rule_ptr rule;
struct pfi_kif *kif;
- u_int32_t bytes[2];
- u_int32_t packets[2];
+ u_int64_t bytes[2];
+ u_int64_t packets[2];
u_int32_t states;
u_int32_t conn;
struct pf_threshold conn_rate;
@@ -724,11 +724,11 @@ struct pf_state {
struct pfi_kif *rt_kif;
struct pf_src_node *src_node;
struct pf_src_node *nat_src_node;
+ u_int64_t packets[2];
+ u_int64_t bytes[2];
u_int32_t creation;
u_int32_t expire;
u_int32_t pfsync_time;
- u_int32_t packets[2];
- u_int32_t bytes[2];
u_int16_t tag;
};
diff --git a/usr.sbin/tcpdump/pf_print_state.c b/usr.sbin/tcpdump/pf_print_state.c
index 59bab3fdb2a..fc575aba1ab 100644
--- a/usr.sbin/tcpdump/pf_print_state.c
+++ b/usr.sbin/tcpdump/pf_print_state.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_print_state.c,v 1.2 2004/02/10 20:26:49 mcbride Exp $ */
+/* $OpenBSD: pf_print_state.c,v 1.3 2005/11/04 08:24:15 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -250,7 +250,7 @@ print_state(struct pf_state *s, int opts)
min = s->expire % 60;
s->expire /= 60;
printf(", expires in %.2u:%.2u:%.2u", s->expire, min, sec);
- printf(", %u:%u pkts, %u:%u bytes",
+ printf(", %llu:%llu pkts, %llu:%llu bytes",
s->packets[0], s->packets[1], s->bytes[0], s->bytes[1]);
if (s->anchor.nr != -1)
printf(", anchor %u", s->anchor.nr);
diff --git a/usr.sbin/tcpdump/print-pfsync.c b/usr.sbin/tcpdump/print-pfsync.c
index d4dcf061f9b..fd8b0962b71 100644
--- a/usr.sbin/tcpdump/print-pfsync.c
+++ b/usr.sbin/tcpdump/print-pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-pfsync.c,v 1.28 2005/05/28 15:10:07 ho Exp $ */
+/* $OpenBSD: print-pfsync.c,v 1.29 2005/11/04 08:24:15 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -28,7 +28,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-pfsync.c,v 1.28 2005/05/28 15:10:07 ho Exp $";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-pfsync.c,v 1.29 2005/11/04 08:24:15 mcbride Exp $";
#endif
#include <sys/param.h>
@@ -165,10 +165,10 @@ pfsync_print(struct pfsync_header *hdr, int len)
bcopy(&s->rt_addr, &st.rt_addr, sizeof(st.rt_addr));
st.creation = ntohl(s->creation);
st.expire = ntohl(s->expire);
- st.packets[0] = ntohl(s->packets[0]);
- st.packets[1] = ntohl(s->packets[1]);
- st.bytes[0] = ntohl(s->bytes[0]);
- st.bytes[1] = ntohl(s->bytes[1]);
+ pf_state_counter_ntoh(s->packets[0], st.packets[0]);
+ pf_state_counter_ntoh(s->packets[1], st.packets[1]);
+ pf_state_counter_ntoh(s->bytes[0], st.bytes[0]);
+ pf_state_counter_ntoh(s->bytes[1], st.bytes[1]);
st.creatorid = s->creatorid;
st.af = s->af;
st.proto = s->proto;