]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-nflog.c
bgp: Parse BGP extended message support capability
[tcpdump] / print-nflog.c
index 86e1a43c23b4d58b5b296784183066ec90a149cd..1e75561b967dc01b60e62e3af432f246ae5696b4 100644 (file)
@@ -105,9 +105,7 @@ typedef struct nflog_timestamp {
 
 static const struct tok nflog_values[] = {
        { AF_INET,              "IPv4" },
-#ifdef AF_INET6
        { AF_INET6,             "IPv6" },
-#endif /*AF_INET6*/
        { 0,                    NULL }
 };
 
@@ -132,9 +130,9 @@ nflog_hdr_print(netdissect_options *ndo, const nflog_hdr_t *hdr, u_int length)
        ND_PRINT(", length %u: ", length);
 }
 
-u_int
+void
 nflog_if_print(netdissect_options *ndo,
-                          const struct pcap_pkthdr *h, const u_char *p)
+              const struct pcap_pkthdr *h, const u_char *p)
 {
        const nflog_hdr_t *hdr = (const nflog_hdr_t *)p;
        uint16_t size;
@@ -142,14 +140,18 @@ nflog_if_print(netdissect_options *ndo,
        u_int caplen = h->caplen;
        u_int length = h->len;
 
-       ndo->ndo_protocol = "nflog_if";
-       if (caplen < NFLOG_HDR_LEN)
-               goto trunc;
+       ndo->ndo_protocol = "nflog";
+       if (caplen < NFLOG_HDR_LEN) {
+               nd_print_trunc(ndo);
+               ndo->ndo_ll_hdr_len += caplen;
+               return;
+       }
+       ndo->ndo_ll_hdr_len += NFLOG_HDR_LEN;
 
        ND_TCHECK_SIZE(hdr);
        if (GET_U_1(hdr->nflog_version) != 0) {
                ND_PRINT("version %u (unknown)", GET_U_1(hdr->nflog_version));
-               return h_size;
+               return;
        }
 
        if (ndo->ndo_eflag)
@@ -205,11 +207,9 @@ nflog_if_print(netdissect_options *ndo,
                ip_print(ndo, p, length);
                break;
 
-#ifdef AF_INET6
        case AF_INET6:
                ip6_print(ndo, p, length);
                break;
-#endif /* AF_INET6 */
 
        default:
                if (!ndo->ndo_eflag)
@@ -221,10 +221,11 @@ nflog_if_print(netdissect_options *ndo,
                break;
        }
 
-       return h_size;
+       ndo->ndo_ll_hdr_len += h_size - NFLOG_HDR_LEN;
+       return;
 trunc:
        nd_print_trunc(ndo);
-       return h_size;
+       ndo->ndo_ll_hdr_len += h_size - NFLOG_HDR_LEN;
 }
 
 #endif /* DLT_NFLOG */