]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Clean up various things.
authorGuy Harris <[email protected]>
Mon, 10 Jun 2013 01:16:02 +0000 (18:16 -0700)
committerGuy Harris <[email protected]>
Mon, 10 Jun 2013 01:16:02 +0000 (18:16 -0700)
Clean up white space, just add 104 (the length of the NFLOG header) to
the pointer, and return the length of the NFLOG header from
nflog_if_print().  Mark the caplen argument to nflog_print() as unused.

print-nflog.c

index 5cce7488eed4ab859f3316282a85eb7e4c143e43..eed9c484f65a60cbd8b354607976ccf571318267 100644 (file)
 #ifdef DLT_NFLOG
 
 static void
-nflog_print(struct netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
+nflog_print(struct netdissect_options *ndo, const u_char *p, u_int length, u_int caplen _U_)
 {
-    ip_print(ndo, p, length);
-    return;
+       ip_print(ndo, p, length);
+       return;
 }
 
 u_int
 nflog_if_print(struct netdissect_options *ndo,
-               const struct pcap_pkthdr *h, const u_char *p)
+              const struct pcap_pkthdr *h, const u_char *p)
 {
-    int j = 0;
+       if (h->len < 104 || h->caplen < 104) {
+               ND_PRINT((ndo, "[!nflog]"));
+               return h->caplen;
+       }
 
-    /* Discard NFLOG header */
-    for (j = 0; j < 104; j++) {
-        *p++;
-    }
+       nflog_print(ndo, p + 104, h->len - 104, h->caplen - 104);
 
-       nflog_print(ndo, p, h->len - 104, h->caplen - 104);
-
-       return 0;
+       return 104;
 }
 
 #endif /* DLT_NFLOG */