X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/1fe6e66ecec3fb7a7cc729038012cbb264542331..1fb50928ce27360c1c987312774f686b23c69b51:/print-nflog.c diff --git a/print-nflog.c b/print-nflog.c index 5985799e..41cbf788 100644 --- a/print-nflog.c +++ b/print-nflog.c @@ -25,26 +25,29 @@ * DAMAGE. */ -#define NETDISSECT_REWORKED +/* \summary: DLT_NFLOG printer */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include -#include "interface.h" +#include "netdissect.h" #if defined(DLT_NFLOG) && defined(HAVE_PCAP_NFLOG_H) #include static const struct tok nflog_values[] = { { AF_INET, "IPv4" }, +#ifdef AF_INET6 { AF_INET6, "IPv6" }, - { 0, NULL } +#endif /*AF_INET6*/ + { 0, NULL } }; static inline void -nflog_hdr_print(struct netdissect_options *ndo, const nflog_hdr_t *hdr, u_int length) +nflog_hdr_print(netdissect_options *ndo, const nflog_hdr_t *hdr, u_int length) { ND_PRINT((ndo, "version %d, resource ID %d", hdr->nflog_version, ntohs(hdr->nflog_rid))); @@ -64,13 +67,13 @@ nflog_hdr_print(struct netdissect_options *ndo, const nflog_hdr_t *hdr, u_int le } u_int -nflog_if_print(struct netdissect_options *ndo, +nflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { const nflog_hdr_t *hdr = (const nflog_hdr_t *)p; const nflog_tlv_t *tlv; - u_int16_t size; - u_int16_t h_size = sizeof(nflog_hdr_t); + uint16_t size; + uint16_t h_size = sizeof(nflog_hdr_t); u_int caplen = h->caplen; u_int length = h->len; @@ -79,7 +82,7 @@ nflog_if_print(struct netdissect_options *ndo, return h_size; } - if (!(hdr->nflog_version) == 0) { + if (hdr->nflog_version != 0) { ND_PRINT((ndo, "version %u (unknown)", hdr->nflog_version)); return h_size; } @@ -143,11 +146,11 @@ nflog_if_print(struct netdissect_options *ndo, ip_print(ndo, p, length); break; -#ifdef INET6 +#ifdef AF_INET6 case AF_INET6: ip6_print(ndo, p, length); break; -#endif /*INET6*/ +#endif /* AF_INET6 */ default: if (!ndo->ndo_eflag) @@ -155,7 +158,7 @@ nflog_if_print(struct netdissect_options *ndo, length + sizeof(nflog_hdr_t)); if (!ndo->ndo_suppress_default_print) - ndo->ndo_default_print(ndo, p, caplen); + ND_DEFAULTPRINT(p, caplen); break; }