summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tcpdump/print-pflog.c
diff options
context:
space:
mode:
authorprovos <provos@openbsd.org>2001-06-26 15:40:29 +0000
committerprovos <provos@openbsd.org>2001-06-26 15:40:29 +0000
commit34f5f99b9bb34dcf3171b392bfccc98767719443 (patch)
tree85a281bf4de5821e809bf244801f6dc8b3457dd0 /usr.sbin/tcpdump/print-pflog.c
parentforgot htons (diff)
downloadwireguard-openbsd-34f5f99b9bb34dcf3171b392bfccc98767719443.tar.xz
wireguard-openbsd-34f5f99b9bb34dcf3171b392bfccc98767719443.zip
print out reason code, unless it is just a match
Diffstat (limited to 'usr.sbin/tcpdump/print-pflog.c')
-rw-r--r--usr.sbin/tcpdump/print-pflog.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/usr.sbin/tcpdump/print-pflog.c b/usr.sbin/tcpdump/print-pflog.c
index eca138b1c43..5c3b24ced5e 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.1 2001/06/25 23:05:17 provos Exp $ */
+/* $OpenBSD: print-pflog.c,v 1.2 2001/06/26 15:40:29 provos Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-pflog.c,v 1.1 2001/06/25 23:05:17 provos Exp $ (LBL)";
+ "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-pflog.c,v 1.2 2001/06/26 15:40:29 provos Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -61,6 +61,7 @@ pflog_if_print(u_char *user, const struct pcap_pkthdr *h,
u_int caplen = h->caplen;
const struct ip *ip;
const struct pfloghdr *hdr;
+ const char *reason;
ts_print(&h->ts);
@@ -79,8 +80,18 @@ pflog_if_print(u_char *user, const struct pcap_pkthdr *h,
hdr = (struct pfloghdr *)p;
- printf("rule nr %d: %s %s on %s: ",
- ntohl(hdr->rnr),
+ switch(ntohs(hdr->reason)) {
+ case PFRES_MATCH:
+ reason = "";
+ break;
+
+ default:
+ reason = "(unknown)";
+ break;
+ }
+
+ printf("rule nr %d%s: %s %s on %s: ",
+ ntohs(hdr->rnr), reason,
ntohs(hdr->action) == PF_PASS ? "pass" : "block",
ntohs(hdr->dir) == PF_OUT ? "out" : "in",
hdr->ifname);