]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-pflog.c
Add EXTRACT_ calls.
[tcpdump] / print-pflog.c
index b107c09d57c0431103034c978ed3c0250bb00e01..1f552e14bde68a297d398984445bc14e5a7a305b 100644 (file)
@@ -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
@@ -88,23 +90,23 @@ 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
                ND_PRINT((ndo, "rule %u.%s.%u/", rulenr, hdr->ruleset, subrulenr));
 
        ND_PRINT((ndo, "%s: %s %s on %s: ",
-           tok2str(pf_reasons, "unkn(%u)", hdr->reason),
-           tok2str(pf_actions, "unkn(%u)", hdr->action),
-           tok2str(pf_directions, "unkn(%u)", hdr->dir),
+           tok2str(pf_reasons, "unkn(%u)", EXTRACT_U_1(&hdr->reason)),
+           tok2str(pf_actions, "unkn(%u)", EXTRACT_U_1(&hdr->action)),
+           tok2str(pf_directions, "unkn(%u)", EXTRACT_U_1(&hdr->dir)),
            hdr->ifname));
 }
 
 u_int
 pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
-               register const u_char *p)
+               const u_char *p)
 {
        u_int length = h->len;
        u_int hdrlen;
@@ -137,7 +139,7 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
                pflog_print(ndo, hdr);
 
        /* skip to the real packet */
-       af = hdr->af;
+       af = EXTRACT_U_1(&hdr->af);
        length -= hdrlen;
        caplen -= hdrlen;
        p += hdrlen;