};
static inline void
-nflog_hdr_print(struct netdissect_options *ndo, const u_char *bp, u_int length)
+nflog_hdr_print(struct netdissect_options *ndo, const nflog_hdr_t *hdr, u_int length)
{
- const nflog_hdr_t *hdr;
- hdr = (const nflog_hdr_t *)bp;
-
ND_PRINT((ndo, "version %d, resource ID %d", hdr->nflog_version, ntohs(hdr->nflog_rid)));
if (!ndo->ndo_qflag) {
nflog_if_print(struct netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
- const nflog_hdr_t *hdr;
+ 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);
return h_size;
}
+ if (!(hdr->nflog_version) == 0) {
+ ND_PRINT((ndo, ", NFLOG version mismatch: %u", hdr->nflog_version));
+ return h_size;
+ }
+
if (ndo->ndo_eflag)
- nflog_hdr_print(ndo, p, length);
+ nflog_hdr_print(ndo, hdr, length);
length -= sizeof(nflog_hdr_t);
caplen -= sizeof(nflog_hdr_t);
- hdr = (const nflog_hdr_t *)p;
p += sizeof(nflog_hdr_t);
- if (!(hdr->nflog_version) == 0) {
- ND_PRINT((ndo, ", NFLOG version mismatch: %u", hdr->nflog_version));
- return h_size;
- }
-
do {
tlv = (const nflog_tlv_t *) p;
size = tlv->tlv_length;
default:
if (!ndo->ndo_eflag)
- nflog_hdr_print(ndo, (u_char *)hdr,
+ nflog_hdr_print(ndo, hdr,
length + sizeof(nflog_hdr_t));
if (!ndo->ndo_suppress_default_print)