]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print.c
On Solaris, for 64-bit builds, use the 64-bit pcap-config.
[tcpdump] / print.c
diff --git a/print.c b/print.c
index 5b776d612644e296b6763db22b337ce61d1f9e0d..447955f0a1ca98ec1b8606f65035c88a27c366b9 100644 (file)
--- a/print.c
+++ b/print.c
@@ -201,8 +201,8 @@ static const struct printer printers[] = {
        { ppp_hdlc_if_print,    DLT_PPP_SERIAL },
 #endif
        { ppp_if_print,         DLT_PPP },
-#ifdef DLT_PPP_WITHDIRECTION
-       { ppp_if_print,         DLT_PPP_WITHDIRECTION },
+#ifdef DLT_PPP_PPPD
+       { ppp_if_print,         DLT_PPP_PPPD },
 #endif
 #ifdef DLT_PPP_ETHER
        { pppoe_if_print,       DLT_PPP_ETHER },
@@ -246,21 +246,6 @@ static const struct printer printers[] = {
        { NULL,                 0 },
 };
 
-static void    ndo_default_print(netdissect_options *ndo, const u_char *bp,
-                   u_int length);
-
-static void NORETURN ndo_error(netdissect_options *ndo,
-                    status_exit_codes_t status,
-                    FORMAT_STRING(const char *fmt), ...)
-                    PRINTFLIKE(3, 4);
-static void    ndo_warning(netdissect_options *ndo,
-                   FORMAT_STRING(const char *fmt), ...)
-                   PRINTFLIKE(2, 3);
-
-static int     ndo_printf(netdissect_options *ndo,
-                    FORMAT_STRING(const char *fmt), ...)
-                    PRINTFLIKE(2, 3);
-
 void
 init_print(netdissect_options *ndo, uint32_t localnet, uint32_t mask)
 {
@@ -386,7 +371,16 @@ pretty_print_packet(netdissect_options *ndo, const struct pcap_pkthdr *h,
         * bigger lengths.
         */
 
-       ts_print(ndo, &h->ts);
+       /*
+        * The header /usr/include/pcap/pcap.h in OpenBSD declares h->ts as
+        * struct bpf_timeval, not struct timeval. The former comes from
+        * /usr/include/net/bpf.h and uses 32-bit unsigned types instead of
+        * the types used in struct timeval.
+        */
+       struct timeval tvbuf;
+       tvbuf.tv_sec = h->ts.tv_sec;
+       tvbuf.tv_usec = h->ts.tv_usec;
+       ts_print(ndo, &tvbuf);
 
        /*
         * Printers must check that they're not walking off the end of
@@ -398,12 +392,17 @@ pretty_print_packet(netdissect_options *ndo, const struct pcap_pkthdr *h,
 
        ndo->ndo_protocol = "";
        ndo->ndo_ll_hdr_len = 0;
-       if (setjmp(ndo->ndo_truncated) == 0) {
+       switch (setjmp(ndo->ndo_early_end)) {
+       case 0:
                /* Print the packet. */
                (ndo->ndo_if_printer)(ndo, h, sp);
-       } else {
+               break;
+       case ND_TRUNCATED:
                /* A printer quit because the packet was truncated; report it */
-               ND_PRINT(" [|%s]", ndo->ndo_protocol);
+               nd_print_trunc(ndo);
+               /* Print the full packet */
+               ndo->ndo_ll_hdr_len = 0;
+               break;
        }
        hdrlen = ndo->ndo_ll_hdr_len;
 
@@ -492,9 +491,9 @@ ndo_default_print(netdissect_options *ndo, const u_char *bp, u_int length)
 }
 
 /* VARARGS */
-static void
+static void NORETURN PRINTFLIKE(3, 4)
 ndo_error(netdissect_options *ndo, status_exit_codes_t status,
-         const char *fmt, ...)
+          FORMAT_STRING(const char *fmt), ...)
 {
        va_list ap;
 
@@ -514,8 +513,8 @@ ndo_error(netdissect_options *ndo, status_exit_codes_t status,
 }
 
 /* VARARGS */
-static void
-ndo_warning(netdissect_options *ndo, const char *fmt, ...)
+static void PRINTFLIKE(2, 3)
+ndo_warning(netdissect_options *ndo, FORMAT_STRING(const char *fmt), ...)
 {
        va_list ap;
 
@@ -532,8 +531,9 @@ ndo_warning(netdissect_options *ndo, const char *fmt, ...)
        }
 }
 
-static int
-ndo_printf(netdissect_options *ndo, const char *fmt, ...)
+/* VARARGS */
+static int PRINTFLIKE(2, 3)
+ndo_printf(netdissect_options *ndo, FORMAT_STRING(const char *fmt), ...)
 {
        va_list args;
        int ret;