From: Francois-Xavier Le Bail Date: Mon, 4 May 2020 14:14:14 +0000 (+0200) Subject: NFLOG: Update the link-layer dissector to a void function X-Git-Tag: tcpdump-4.99-bp~428 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/5b52e5fa194e55e49b978fefe3cac7820579a60d NFLOG: Update the link-layer dissector to a void function Moreover: Remove trailing "_if" from protocol name. --- diff --git a/netdissect.h b/netdissect.h index 3968f3c9..65a0d987 100644 --- a/netdissect.h +++ b/netdissect.h @@ -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; diff --git a/print-nflog.c b/print-nflog.c index 86e1a43c..77f52f50 100644 --- a/print-nflog.c +++ b/print-nflog.c @@ -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 4c520e3f..7224e2e6 100644 --- 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