]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Pass an adjusted struct pcap_pkthdr to the sub-printer.
authorGuy Harris <[email protected]>
Sat, 13 Feb 2016 02:48:22 +0000 (18:48 -0800)
committerGuy Harris <[email protected]>
Sat, 13 Feb 2016 02:48:22 +0000 (18:48 -0800)
The caplen and len of the packet it's printing must be reduced by the
length of the PPI header.

print-ppi.c

index ddf674d261fd44fa00f10bf286990ccd04156b11..3957154007e9f3fdaabd404109126c63c9c1cc30 100644 (file)
@@ -56,6 +56,7 @@ ppi_print(netdissect_options *ndo,
        uint16_t len;
        uint32_t dlt;
        uint32_t hdrlen;
+       struct pcap_pkthdr nhdr;
 
        if (caplen < sizeof(ppi_header_t)) {
                ND_PRINT((ndo, "[|ppi]"));
@@ -86,7 +87,10 @@ ppi_print(netdissect_options *ndo,
        p += len;
 
        if ((printer = lookup_printer(dlt)) != NULL) {
-               hdrlen = printer(ndo, h, p);
+               nhdr = *h;
+               nhdr.caplen = caplen;
+               nhdr.len = length;
+               hdrlen = printer(ndo, &nhdr, p);
        } else {
                if (!ndo->ndo_eflag)
                        ppi_header_print(ndo, (const u_char *)hdr, length + len);