X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/7b2c5a11a7bc236d72b440c4db5263edb23b4880..0f328b4aa16b0b47f05a85c440ce1d07719e3cac:/print-pflog.c diff --git a/print-pflog.c b/print-pflog.c index 0df10c84..d53fea81 100644 --- a/print-pflog.c +++ b/print-pflog.c @@ -19,6 +19,8 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +/* \summary: OpenBSD packet filter log file printer */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -32,9 +34,9 @@ #include #include -#include +#include -#include "interface.h" +#include "netdissect.h" #include "extract.h" static const char tstr[] = "[|pflog]"; @@ -88,8 +90,8 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr) { uint32_t rulenr, subrulenr; - rulenr = EXTRACT_32BITS(&hdr->rulenr); - subrulenr = EXTRACT_32BITS(&hdr->subrulenr); + rulenr = EXTRACT_BE_U_4(&hdr->rulenr); + subrulenr = EXTRACT_BE_U_4(&hdr->subrulenr); if (subrulenr == (uint32_t)-1) ND_PRINT((ndo, "rule %u/", rulenr)); else @@ -119,7 +121,7 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, } #define MIN_PFLOG_HDRLEN 45 - hdr = (struct pfloghdr *)p; + hdr = (const struct pfloghdr *)p; if (hdr->length < MIN_PFLOG_HDRLEN) { ND_PRINT((ndo, "[pflog: invalid header length!]")); return (hdr->length); /* XXX: not really */ @@ -132,7 +134,6 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, } /* print what we know */ - hdr = (struct pfloghdr *)p; ND_TCHECK(*hdr); if (ndo->ndo_eflag) pflog_print(ndo, hdr);