+ if (ndo->ndo_eflag)
+ nflog_hdr_print(ndo, hdr, length);
+
+ p += sizeof(nflog_hdr_t);
+ length -= sizeof(nflog_hdr_t);
+ caplen -= sizeof(nflog_hdr_t);
+
+ while (length > 0) {
+ /* We have some data. Do we have enough for the TLV header? */
+ if (caplen < sizeof(nflog_tlv_t) || length < sizeof(nflog_tlv_t)) {
+ /* No. */
+ ND_PRINT((ndo, "[|nflog]"));
+ return h_size;
+ }
+
+ tlv = (const nflog_tlv_t *) p;
+ size = tlv->tlv_length;
+ if (size % 4 != 0)
+ size += 4 - size % 4;
+
+ /* Is the TLV's length less than the minimum? */
+ if (size < sizeof(nflog_tlv_t)) {
+ /* Yes. Give up now. */
+ ND_PRINT((ndo, "[|nflog]"));
+ return h_size;
+ }
+
+ /* Do we have enough data for the full TLV? */
+ if (caplen < size || length < size) {
+ /* No. */
+ ND_PRINT((ndo, "[|nflog]"));
+ return h_size;
+ }
+
+ if (tlv->tlv_type == NFULA_PAYLOAD) {
+ /*
+ * This TLV's data is the packet payload.
+ * Skip past the TLV header, and break out
+ * of the loop so we print the packet data.
+ */
+ p += sizeof(nflog_tlv_t);
+ h_size += sizeof(nflog_tlv_t);
+ length -= sizeof(nflog_tlv_t);
+ caplen -= sizeof(nflog_tlv_t);
+ break;
+ }
+
+ p += size;
+ h_size += size;
+ length -= size;
+ caplen -= size;
+ }
+
+ switch (hdr->nflog_family) {
+
+ case AF_INET:
+ ip_print(ndo, p, length);
+ break;
+
+#ifdef AF_INET6
+ case AF_INET6:
+ ip6_print(ndo, p, length);
+ break;
+#endif /* AF_INET6 */
+
+ default:
+ if (!ndo->ndo_eflag)
+ nflog_hdr_print(ndo, hdr,
+ length + sizeof(nflog_hdr_t));
+
+ if (!ndo->ndo_suppress_default_print)
+ ND_DEFAULTPRINT(p, caplen);
+ break;
+ }