X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/1fe6e66ecec3fb7a7cc729038012cbb264542331..refs/pull/482/head:/print-pflog.c diff --git a/print-pflog.c b/print-pflog.c index 07f0732f..9815dc56 100644 --- a/print-pflog.c +++ b/print-pflog.c @@ -19,7 +19,6 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#define NETDISSECT_REWORKED #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -33,9 +32,9 @@ #include #include -#include +#include -#include "interface.h" +#include "netdissect.h" #include "extract.h" static const char tstr[] = "[|pflog]"; @@ -87,11 +86,11 @@ static const struct tok pf_directions[] = { static void pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr) { - u_int32_t rulenr, subrulenr; + uint32_t rulenr, subrulenr; rulenr = EXTRACT_32BITS(&hdr->rulenr); subrulenr = EXTRACT_32BITS(&hdr->subrulenr); - if (subrulenr == (u_int32_t)-1) + if (subrulenr == (uint32_t)-1) ND_PRINT((ndo, "rule %u/", rulenr)); else ND_PRINT((ndo, "rule %u.%s.%u/", rulenr, hdr->ruleset, subrulenr)); @@ -111,10 +110,10 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, u_int hdrlen; u_int caplen = h->caplen; const struct pfloghdr *hdr; - u_int8_t af; + uint8_t af; /* check length */ - if (caplen < sizeof(u_int8_t)) { + if (caplen < sizeof(uint8_t)) { ND_PRINT((ndo, "%s", tstr)); return (caplen); } @@ -152,21 +151,23 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, ip_print(ndo, p, length); break; -#ifdef INET6 +#if defined(AF_INET6) || defined(OPENBSD_AF_INET6) +#ifdef AF_INET6 case AF_INET6: -#if OPENBSD_AF_INET6 != AF_INET6 +#endif /* AF_INET6 */ +#if !defined(AF_INET6) || OPENBSD_AF_INET6 != AF_INET6 case OPENBSD_AF_INET6: /* XXX: read pcap files */ -#endif +#endif /* !defined(AF_INET6) || OPENBSD_AF_INET6 != AF_INET6 */ ip6_print(ndo, p, length); break; -#endif +#endif /* defined(AF_INET6) || defined(OPENBSD_AF_INET6) */ default: /* address family not handled, print raw packet */ if (!ndo->ndo_eflag) pflog_print(ndo, hdr); if (!ndo->ndo_suppress_default_print) - ndo->ndo_default_print(ndo, p, caplen); + ND_DEFAULTPRINT(p, caplen); } return (hdrlen);