diff options
Diffstat (limited to '')
-rw-r--r-- | print-nflog.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/print-nflog.c b/print-nflog.c index 1e75561..a5f7a82 100644 --- a/print-nflog.c +++ b/print-nflog.c @@ -27,9 +27,7 @@ /* \summary: DLT_NFLOG printer */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif #include "netdissect-stdinc.h" @@ -97,15 +95,25 @@ typedef struct nflog_timestamp { #define NFULA_PREFIX 10 /* text string - null-terminated, count includes NUL */ #define NFULA_UID 11 /* UID owning socket on which packet was sent/received */ #define NFULA_SEQ 12 /* sequence number of packets on this NFLOG socket */ -#define NFULA_SEQ_GLOBAL 13 /* sequence number of pakets on all NFLOG sockets */ +#define NFULA_SEQ_GLOBAL 13 /* sequence number of packets on all NFLOG sockets */ #define NFULA_GID 14 /* GID owning socket on which packet was sent/received */ #define NFULA_HWTYPE 15 /* ARPHRD_ type of skbuff's device */ #define NFULA_HWHEADER 16 /* skbuff's MAC-layer header */ #define NFULA_HWLEN 17 /* length of skbuff's MAC-layer header */ +/* + * Define two constants specifically for the two AF code points from the + * LINKTYPE_NFLOG specification above and use these constants instead of + * AF_INET and AF_INET6. This is the only way to dissect the "wire" encoding + * correctly because some BSD systems define AF_INET6 differently from Linux + * (see af.h) and Haiku defines both AF_INET and AF_INET6 differently from + * Linux. + */ +#define NFLOG_AF_INET 2 +#define NFLOG_AF_INET6 10 static const struct tok nflog_values[] = { - { AF_INET, "IPv4" }, - { AF_INET6, "IPv6" }, + { NFLOG_AF_INET, "IPv4" }, + { NFLOG_AF_INET6, "IPv6" }, { 0, NULL } }; @@ -203,11 +211,11 @@ nflog_if_print(netdissect_options *ndo, switch (GET_U_1(hdr->nflog_family)) { - case AF_INET: + case NFLOG_AF_INET: ip_print(ndo, p, length); break; - case AF_INET6: + case NFLOG_AF_INET6: ip6_print(ndo, p, length); break; |