Pass an adjusted struct pcap_pkthdr to the sub-printer.

The caplen and len of the packet it's printing must be reduced by the
length of the PPI header.
This commit is contained in:
Guy Harris 2016-02-12 18:48:22 -08:00
parent cc79646a9d
commit 63d0029e27

View File

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