summaryrefslogtreecommitdiff
path: root/sbin/pfctl/pfctl_parser.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2024-04-22 13:30:23 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2024-04-22 13:30:23 +0000
commitbefc02d4f4652245622781a885024dafa2b58901 (patch)
treec7739a4140f7b70c26e564401b9a9790d4d88621 /sbin/pfctl/pfctl_parser.c
parent7f7f57b74856806c864572d00dc6f31cfb717b3a (diff)
Show pf fragment reassembly counters.
Framgent count and statistics are stored in struct pf_status. From there pfctl(8) and systat(1) collect and show them. Note that pfctl -s info needs the -v switch to show fragments. As fragment reassembly has its own mutex, also grab this in pf ipctl(2) and sysctl(2) code. input claudio@; OK henning@
Diffstat (limited to 'sbin/pfctl/pfctl_parser.c')
-rw-r--r--sbin/pfctl/pfctl_parser.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 57bab4b56a6..96ae206de87 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.350 2024/02/07 23:53:44 jsg Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.351 2024/04/22 13:30:22 bluhm Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -519,7 +519,8 @@ print_pool(struct pf_pool *pool, u_int16_t p1, u_int16_t p2,
const char *pf_reasons[PFRES_MAX+1] = PFRES_NAMES;
const char *pf_lcounters[LCNT_MAX+1] = LCNT_NAMES;
const char *pf_fcounters[FCNT_MAX+1] = FCNT_NAMES;
-const char *pf_scounters[FCNT_MAX+1] = FCNT_NAMES;
+const char *pf_scounters[SCNT_MAX+1] = FCNT_NAMES;
+const char *pf_ncounters[NCNT_MAX+1] = FCNT_NAMES;
void
print_status(struct pf_status *s, struct pfctl_watermarks *synflwats, int opts)
@@ -617,6 +618,20 @@ print_status(struct pf_status *s, struct pfctl_watermarks *synflwats, int opts)
printf("%14s\n", "");
}
}
+ if (opts & PF_OPT_VERBOSE) {
+ printf("Fragments\n");
+ printf(" %-25s %14u %14s\n", "current entries",
+ s->fragments, "");
+ for (i = 0; i < NCNT_MAX; i++) {
+ printf(" %-25s %14lld ", pf_ncounters[i],
+ s->ncounters[i]);
+ if (runtime > 0)
+ printf("%14.1f/s\n",
+ (double)s->ncounters[i] / (double)runtime);
+ else
+ printf("%14s\n", "");
+ }
+ }
printf("Counters\n");
for (i = 0; i < PFRES_MAX; i++) {
printf(" %-25s %14llu ", pf_reasons[i],