diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2013-06-26 07:54:00 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2013-06-26 07:54:00 +0000 |
commit | feaa5c3eb6db1089559e6ecef2894b368b933037 (patch) | |
tree | 9a8fa5cf7c6250806fa4b2c833c3cad281daf9d0 /sys/net | |
parent | ba5297806bfc5c1dd82da4938c5758e67f90dceb (diff) |
Rudimentary counter fix for tables used in match rules.
Fixes an issue seen by reyk@
ok henning@ reyk@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/pf.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index 799463d302a..d44e455d52b 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.835 2013/06/17 19:50:06 bluhm Exp $ */ +/* $OpenBSD: pf.c,v 1.836 2013/06/26 07:53:59 blambert Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -6526,6 +6526,23 @@ pf_counters_inc(int action, struct pf_pdesc *pd, struct pf_state *s, SLIST_FOREACH(ri, &s->match_rules, entry) { ri->r->packets[dirndx]++; ri->r->bytes[dirndx] += pd->tot_len; + + if (ri->r->src.addr.type == PF_ADDR_TABLE) + pfr_update_stats(ri->r->src.addr.p.tbl, + &s->key[(s->direction == PF_IN)]-> + addr[(s->direction == PF_OUT)], + pd->af, pd->tot_len, + pd->dir == PF_OUT, + r->action == PF_PASS, + ri->r->src.neg); + if (ri->r->dst.addr.type == PF_ADDR_TABLE) + pfr_update_stats(ri->r->dst.addr.p.tbl, + &s->key[(s->direction == PF_IN)]-> + addr[(s->direction == PF_IN)], + pd->af, pd->tot_len, + pd->dir == PF_OUT, + r->action == PF_PASS, + ri->r->dst.neg); } } if (r->src.addr.type == PF_ADDR_TABLE) |