]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-pflog.c
RADIUS: Rename a test with an invalid length
[tcpdump] / print-pflog.c
index 05b9eb3a3a9b707fa31c09abd3809d4dda477eb5..4081135340ae6521a014000baf9b8b9a029cf558 100644 (file)
@@ -67,11 +67,11 @@ static const struct tok pf_actions[] = {
        { PF_DROP,              "block" },
        { PF_SCRUB,             "scrub" },
        { PF_NAT,               "nat" },
-       { PF_NONAT,             "nat" },
+       { PF_NONAT,             "nonat" },
        { PF_BINAT,             "binat" },
-       { PF_NOBINAT,           "binat" },
+       { PF_NOBINAT,           "nobinat" },
        { PF_RDR,               "rdr" },
-       { PF_NORDR,             "rdr" },
+       { PF_NORDR,             "nordr" },
        { PF_SYNPROXY_DROP,     "synproxy-drop" },
 #if defined(__FreeBSD__)
        { PF_DEFER,             "defer" },
@@ -106,8 +106,8 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr)
        uint32_t rulenr, subrulenr;
 
        ndo->ndo_protocol = "pflog";
-       rulenr = GET_BE_U_4(&hdr->rulenr);
-       subrulenr = GET_BE_U_4(&hdr->subrulenr);
+       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 {
@@ -117,9 +117,9 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr)
        }
 
        ND_PRINT("%s: %s %s on ",
-           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)));
+           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)));
        nd_printjnp(ndo, (const u_char*)hdr->ifname, PFLOG_IFNAMSIZ);
        ND_PRINT(": ");
 }
@@ -144,12 +144,13 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
 
 #define MIN_PFLOG_HDRLEN       45
        hdr = (const struct pfloghdr *)p;
-       if (GET_U_1(&hdr->length) < MIN_PFLOG_HDRLEN) {
+       hdrlen = GET_U_1(hdr->length);
+       if (hdrlen < MIN_PFLOG_HDRLEN) {
                ND_PRINT("[pflog: invalid header length!]");
-               ndo->ndo_ll_hdr_len += GET_U_1(&hdr->length);   /* XXX: not really */
+               ndo->ndo_ll_hdr_len += hdrlen;  /* XXX: not really */
                return;
        }
-       hdrlen = roundup2(hdr->length, 4);
+       hdrlen = roundup2(hdrlen, 4);
 
        if (caplen < hdrlen) {
                nd_print_trunc(ndo);
@@ -163,7 +164,7 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
                pflog_print(ndo, hdr);
 
        /* skip to the real packet */
-       af = GET_U_1(&hdr->af);
+       af = GET_U_1(hdr->af);
        length -= hdrlen;
        caplen -= hdrlen;
        p += hdrlen;
@@ -176,7 +177,7 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
                 *
                 * Hopefully, there isn't.
                 */
-               case AFNUM_INET:
+               case BSD_AF_INET:
                        ip_print(ndo, p, length);
                        break;
 
@@ -184,9 +185,9 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
                 * Try all AF_INET6 values for all systems with pflog,
                 * including Darwin.
                 */
-               case BSD_AFNUM_INET6_BSD:
-               case BSD_AFNUM_INET6_FREEBSD:
-               case BSD_AFNUM_INET6_DARWIN:
+               case BSD_AF_INET6_BSD:
+               case BSD_AF_INET6_FREEBSD:
+               case BSD_AF_INET6_DARWIN:
                        ip6_print(ndo, p, length);
                        break;