]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ppi.c
Note that interfaces may have numerical names.
[tcpdump] / print-ppi.c
index dde1cdb0be51de95ade781f047080e64c99aa86c..3957154007e9f3fdaabd404109126c63c9c1cc30 100644 (file)
@@ -6,9 +6,9 @@
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "extract.h"
 
 typedef struct ppi_header {
@@ -50,19 +50,20 @@ ppi_print(netdissect_options *ndo,
                const struct pcap_pkthdr *h, const u_char *p)
 {
        if_printer printer;
-       ppi_header_t *hdr;
+       const ppi_header_t *hdr;
        u_int caplen = h->caplen;
        u_int length = h->len;
        uint16_t len;
        uint32_t dlt;
        uint32_t hdrlen;
+       struct pcap_pkthdr nhdr;
 
        if (caplen < sizeof(ppi_header_t)) {
                ND_PRINT((ndo, "[|ppi]"));
                return (caplen);
        }
 
-       hdr = (ppi_header_t *)p;
+       hdr = (const ppi_header_t *)p;
        len = EXTRACT_LE_16BITS(&hdr->ppi_len);
        if (caplen < len) {
                /*
@@ -86,10 +87,13 @@ 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, (u_char *)hdr, length + len);
+                       ppi_header_print(ndo, (const u_char *)hdr, length + len);
 
                if (!ndo->ndo_suppress_default_print)
                        ND_DEFAULTPRINT(p, caplen);