diff options
author | Niels Provos <provos@cvs.openbsd.org> | 2001-06-26 15:40:30 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 2001-06-26 15:40:30 +0000 |
commit | 45d33c2a4a06e87f15216f96c37ba1b632edd904 (patch) | |
tree | a895b2faae8015fb1018d7aebe0f4c63c4a381d9 | |
parent | ca0b8f2a9da354623492e107393cbfe93f7af733 (diff) |
print out reason code, unless it is just a match
-rw-r--r-- | usr.sbin/tcpdump/print-pflog.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/usr.sbin/tcpdump/print-pflog.c b/usr.sbin/tcpdump/print-pflog.c index c6eaeaf52b3..aeed23e36f5 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: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-pflog.c,v 1.1 2001/06/25 23:05:17 provos Exp $ (LBL)"; + "@(#) $Header: /cvs/OpenBSD/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); |