diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2005-06-13 20:17:27 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2005-06-13 20:17:27 +0000 |
commit | 0cc874bd647c94983f223a96be45e682a6f74cd0 (patch) | |
tree | da3961f335e4f0f945edd2848e98c058b636d055 /sys/net/pf_norm.c | |
parent | 68d75aded01e7d28a67c396197a0842c8c57d98b (diff) |
make the packet and byte counters on rules and src nodes per direction,
matches the counters on states now. also fix the counting on scrub rules
where we previously did not handle the byte counters at all.
extend pfctl -sl output to include the new seperate in/out counters
hacked on the ferry from Earls Cove to Saltery Bay
ok ryan
Diffstat (limited to 'sys/net/pf_norm.c')
-rw-r--r-- | sys/net/pf_norm.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/net/pf_norm.c b/sys/net/pf_norm.c index b404ecd7352..aa832e702e9 100644 --- a/sys/net/pf_norm.c +++ b/sys/net/pf_norm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_norm.c,v 1.100 2005/05/27 17:22:41 dhartmei Exp $ */ +/* $OpenBSD: pf_norm.c,v 1.101 2005/06/13 20:17:25 henning Exp $ */ /* * Copyright 2001 Niels Provos <provos@citi.umich.edu> @@ -851,8 +851,10 @@ pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, if (r == NULL || r->action == PF_NOSCRUB) return (PF_PASS); - else - r->packets++; + else { + r->packets[dir == PF_OUT]++; + r->bytes[dir == PF_OUT] += pd->tot_len; + } /* Check for illegal packets */ if (hlen < (int)sizeof(struct ip)) @@ -1069,8 +1071,10 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif, if (r == NULL || r->action == PF_NOSCRUB) return (PF_PASS); - else - r->packets++; + else { + r->packets[dir == PF_OUT]++; + r->bytes[dir == PF_OUT] += pd->tot_len; + } /* Check for illegal packets */ if (sizeof(struct ip6_hdr) + IPV6_MAXPACKET < m->m_pkthdr.len) @@ -1243,8 +1247,10 @@ pf_normalize_tcp(int dir, struct pfi_kif *kif, struct mbuf *m, int ipoff, if (rm == NULL || rm->action == PF_NOSCRUB) return (PF_PASS); - else - r->packets++; + else { + r->packets[dir == PF_OUT]++; + r->bytes[dir == PF_OUT] += pd->tot_len; + } if (rm->rule_flag & PFRULE_REASSEMBLE_TCP) pd->flags |= PFDESC_TCP_NORM; |