diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-06-26 22:26:16 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-06-26 22:26:16 +0000 |
commit | 67d7d65b3c3f36cd590b1e5cb882d808f398cee8 (patch) | |
tree | 7bf988e0a8826de74920a945ce577b6b763607ed /sbin | |
parent | cfa97a227615d8171e81a56724c5dcd40fcecc26 (diff) |
array of counters indexed by reason codes
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/pfctl/pfctl_parser.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 75fd701a321..ce0036325cd 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.c,v 1.14 2001/06/26 20:50:26 dhartmei Exp $ */ +/* $OpenBSD: pfctl_parser.c,v 1.15 2001/06/26 22:26:15 deraadt Exp $ */ /* * Copyright (c) 2001, Daniel Hartmeier @@ -296,26 +296,33 @@ print_rdr(struct pf_rdr *r) printf("\n"); } +char *pf_reasons[PFRES_MAX+2] = PFRES_NAMES; + void print_status(struct pf_status *s) { + time_t t = time(NULL); + int i; - printf("Time: %u Since: %u Running: %u", t, s->since, s->running); + printf("Time: %u Since: %u Running: %u\n", t, s->since, s->running); if (s->running) { - printf(" Bytes In: %u Bytes Out: %u\n", - s->bytes[PF_IN], s->bytes[PF_OUT]); - printf(" Inbound Packets: Passed: %u Dropped: %u\n", - s->packets[PF_IN][PF_DROP], - s->packets[PF_IN][PF_DROP]); - printf(" Outbound Packets: Passed: %u Dropped: %u\n", - s->packets[PF_OUT][PF_PASS], - s->packets[PF_OUT][PF_DROP]); - printf(" States: %u Inserts: %u Removals: %u Searches: %u", - s->states, s->state_inserts, - s->state_removals, s->state_searches); + printf("Bytes In: %u Bytes Out: %u\n", + s->bytes[PF_IN], s->bytes[PF_OUT]); + printf("Inbound Packets: Passed: %u Dropped: %u\n", + s->packets[PF_IN][PF_DROP], + s->packets[PF_IN][PF_DROP]); + printf("Outbound Packets: Passed: %u Dropped: %u\n", + s->packets[PF_OUT][PF_PASS], + s->packets[PF_OUT][PF_DROP]); + printf("States: %u Inserts: %u Removals: %u Searches: %u\n", + s->states, s->state_inserts, + s->state_removals, s->state_searches); + printf("Counters\n"); + for (i = 0; i < PFRES_MAX; i++) + printf("%30s %8lld\n", pf_reasons[i], + s->counters[i]); } - printf("\n"); } void |