]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-pflog.c
Add CAP_FCNTL and use cap_fcntls_limit().
[tcpdump] / print-pflog.c
index eb88784c9359d7c895aba3e78cd12c7209440b6f..72ae276320ce9a18ee669ff582cfb69e972616c5 100644 (file)
@@ -19,6 +19,7 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
+#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -34,7 +35,7 @@
 
 #include <tcpdump-stdinc.h>
 
-#include "netdissect.h"
+#include "interface.h"
 #include "extract.h"
 
 static const char tstr[] = "[|pflog]";
@@ -86,11 +87,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));
@@ -110,10 +111,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);
        }
@@ -151,21 +152,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);