summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-06-26 22:26:16 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-06-26 22:26:16 +0000
commit67d7d65b3c3f36cd590b1e5cb882d808f398cee8 (patch)
tree7bf988e0a8826de74920a945ce577b6b763607ed /usr.sbin
parentcfa97a227615d8171e81a56724c5dcd40fcecc26 (diff)
array of counters indexed by reason codes
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/tcpdump/print-pflog.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/usr.sbin/tcpdump/print-pflog.c b/usr.sbin/tcpdump/print-pflog.c
index 695cfd7f30a..828253e1b7f 100644
--- a/usr.sbin/tcpdump/print-pflog.c
+++ b/usr.sbin/tcpdump/print-pflog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-pflog.c,v 1.4 2001/06/26 19:06:16 provos Exp $ */
+/* $OpenBSD: print-pflog.c,v 1.5 2001/06/26 22:26:14 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-pflog.c,v 1.4 2001/06/26 19:06:16 provos Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-pflog.c,v 1.5 2001/06/26 22:26:14 deraadt Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -53,6 +53,8 @@ struct rtentry;
#include "interface.h"
#include "addrtoname.h"
+char *pf_reasons[PFRES_MAX+2] = PFRES_NAMES;
+
void
pflog_if_print(u_char *user, const struct pcap_pkthdr *h,
register const u_char *p)
@@ -82,27 +84,7 @@ pflog_if_print(u_char *user, const struct pcap_pkthdr *h,
hdr = (struct pfloghdr *)p;
res = ntohs(hdr->reason);
- switch(res) {
- case PFRES_MATCH:
- why = "match";
- break;
-
- case PFRES_BADOFF:
- why = "bad-offset";
- break;
-
- case PFRES_FRAG:
- why = "fragment";
- break;
-
- case PFRES_SHORT:
- why = "short";
- break;
-
- default:
- why = "unkn";
- break;
- }
+ why = (res <= PFRES_MAX) ? pf_reasons[res] : "unkn";
snprintf(reason, sizeof(reason), "%d(%s)", res, why);