]> The Tcpdump Group git mirrors - tcpdump/commitdiff
NFLOG: Update the link-layer dissector to a void function
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 4 May 2020 14:14:14 +0000 (16:14 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 4 May 2020 14:14:14 +0000 (16:14 +0200)
Moreover:
Remove trailing "_if" from protocol name.

netdissect.h
print-nflog.c
print.c

index 3968f3c962de7843a27de3cdf81bb61cb9386c18..65a0d9878785eabd04eb1189d8b0116663034702 100644 (file)
@@ -506,7 +506,7 @@ extern u_int ltalk_if_print IF_PRINTER_ARGS;
 extern u_int mfr_if_print IF_PRINTER_ARGS;
 extern u_int netanalyzer_if_print IF_PRINTER_ARGS;
 extern u_int netanalyzer_transparent_if_print IF_PRINTER_ARGS;
-extern u_int nflog_if_print IF_PRINTER_ARGS;
+extern void nflog_if_print IF_PRINTER_ARGS;
 extern void null_if_print IF_PRINTER_ARGS;
 extern u_int pflog_if_print IF_PRINTER_ARGS;
 extern void pktap_if_print IF_PRINTER_ARGS;
index 86e1a43c23b4d58b5b296784183066ec90a149cd..77f52f50b5e3dec5edd668f3b9b9baf2adcc7d2d 100644 (file)
@@ -132,9 +132,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 +142,17 @@ 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) {
+               ndo->ndo_ll_header_length += caplen;
+               return;
+       }
+       ndo->ndo_ll_header_length += 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)
@@ -221,10 +224,12 @@ nflog_if_print(netdissect_options *ndo,
                break;
        }
 
-       return h_size;
+       ndo->ndo_ll_header_length += h_size - NFLOG_HDR_LEN;
+       return;
 trunc:
        nd_print_trunc(ndo);
-       return h_size;
+       ndo->ndo_ll_header_length += h_size - NFLOG_HDR_LEN;
+       return;
 }
 
 #endif /* DLT_NFLOG */
diff --git a/print.c b/print.c
index 4c520e3fcb92d36e80250353f5be053a76dc1f84..7224e2e6e28c8f054995a63a52dd068feda0edb8 100644 (file)
--- a/print.c
+++ b/print.c
@@ -69,9 +69,6 @@ static const struct uint_printer uint_printers[] = {
 #ifdef DLT_NETANALYZER_TRANSPARENT
        { netanalyzer_transparent_if_print, DLT_NETANALYZER_TRANSPARENT },
 #endif
-#ifdef DLT_NFLOG
-       { nflog_if_print,       DLT_NFLOG},
-#endif
 #ifdef DLT_CIP
        { cip_if_print,         DLT_CIP },
 #endif
@@ -221,6 +218,9 @@ static const struct void_printer void_printers[] = {
 #endif
 #ifdef DLT_IPNET
        { ipnet_if_print,       DLT_IPNET },
+#endif
+#ifdef DLT_NFLOG
+       { nflog_if_print,       DLT_NFLOG},
 #endif
        { null_if_print,        DLT_NULL },
 #ifdef DLT_LOOP