]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-pflog.c
Clean up comments.
[tcpdump] / print-pflog.c
index 3680e887b2b620a643ccf648d3057c3851102bd6..fc83a04b0c68b89fe99b9a3e2be0a793e82a9b34 100644 (file)
@@ -22,7 +22,7 @@
 /* \summary: OpenBSD packet filter log file printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #ifndef HAVE_NET_PFVAR_H
@@ -39,7 +39,6 @@
 #include "netdissect.h"
 #include "extract.h"
 
-static const char tstr[] = "[|pflog]";
 
 static const struct tok pf_reasons[] = {
        { 0,    "0(match)" },
@@ -90,17 +89,18 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr)
 {
        uint32_t rulenr, subrulenr;
 
-       rulenr = EXTRACT_BE_U_4(&hdr->rulenr);
-       subrulenr = EXTRACT_BE_U_4(&hdr->subrulenr);
+       ndo->ndo_protocol = "pflog";
+       rulenr = GET_BE_U_4(&hdr->rulenr);
+       subrulenr = GET_BE_U_4(&hdr->subrulenr);
        if (subrulenr == (uint32_t)-1)
                ND_PRINT("rule %u/", rulenr);
        else
                ND_PRINT("rule %u.%s.%u/", rulenr, hdr->ruleset, subrulenr);
 
        ND_PRINT("%s: %s %s on %s: ",
-           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)),
+           tok2str(pf_reasons, "unkn(%u)", GET_U_1(&hdr->reason)),
+           tok2str(pf_actions, "unkn(%u)", GET_U_1(&hdr->action)),
+           tok2str(pf_directions, "unkn(%u)", GET_U_1(&hdr->dir)),
            hdr->ifname);
 }
 
@@ -114,9 +114,10 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
        const struct pfloghdr *hdr;
        uint8_t af;
 
+       ndo->ndo_protocol = "pflog_if";
        /* check length */
        if (caplen < sizeof(uint8_t)) {
-               ND_PRINT("%s", tstr);
+               nd_print_trunc(ndo);
                return (caplen);
        }
 
@@ -129,7 +130,7 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
        hdrlen = BPF_WORDALIGN(hdr->length);
 
        if (caplen < hdrlen) {
-               ND_PRINT("%s", tstr);
+               nd_print_trunc(ndo);
                return (hdrlen);        /* XXX: true? */
        }
 
@@ -139,7 +140,7 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
                pflog_print(ndo, hdr);
 
        /* skip to the real packet */
-       af = EXTRACT_U_1(&hdr->af);
+       af = GET_U_1(&hdr->af);
        length -= hdrlen;
        caplen -= hdrlen;
        p += hdrlen;
@@ -173,13 +174,6 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
 
        return (hdrlen);
 trunc:
-       ND_PRINT("%s", tstr);
+       nd_print_trunc(ndo);
        return (hdrlen);
 }
-
-/*
- * Local Variables:
- * c-style: whitesmith
- * c-basic-offset: 8
- * End:
- */