summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface.h3
-rw-r--r--netdissect.h7
-rw-r--r--print-domain.c2
-rw-r--r--print-dvmrp.c2
-rw-r--r--print-fr.c2
-rw-r--r--print-hsrp.c4
-rw-r--r--print-igmp.c2
-rw-r--r--print-isoclns.c2
-rw-r--r--print-lspping.c4
-rw-r--r--print-lwres.c2
-rw-r--r--print-pim.c22
-rw-r--r--print-rsvp.c2
-rw-r--r--signature.c5
-rw-r--r--signature.h5
-rw-r--r--tcpdump.c2
-rw-r--r--util.c38
16 files changed, 51 insertions, 53 deletions
diff --git a/interface.h b/interface.h
index b05a9a16..d08f9880 100644
--- a/interface.h
+++ b/interface.h
@@ -117,9 +117,6 @@ extern int32_t thiszone; /* seconds offset from gmt to local time */
/* Bail if "var" was not captured */
#define TCHECK(var) TCHECK2(var, sizeof(var))
-extern void ts_print(const struct timeval *);
-extern void relts_print(int);
-
extern int fn_print(const u_char *, const u_char *);
extern int fn_printn(const u_char *, u_int, const u_char *);
extern int fn_printzp(const u_char *, u_int, const u_char *);
diff --git a/netdissect.h b/netdissect.h
index 1c53dae8..8ea2c37c 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -252,11 +252,8 @@ struct netdissect_options {
#define ND_PRINT(STUFF) (*ndo->ndo_printf)STUFF
#define ND_DEFAULTPRINT(ap, length) (*ndo->ndo_default_print)(ndo, ap, length)
-#if 0
-extern void ts_print(netdissect_options *ipdo,
- const struct timeval *);
-extern void relts_print(int);
-#endif
+extern void ts_print(netdissect_options *, const struct timeval *);
+extern void relts_print(netdissect_options *, int);
extern int fn_print(const u_char *, const u_char *);
extern int fn_printn(const u_char *, u_int, const u_char *);
diff --git a/print-domain.c b/print-domain.c
index ee556d6c..00119568 100644
--- a/print-domain.c
+++ b/print-domain.c
@@ -395,7 +395,7 @@ ns_rprint(netdissect_options *ndo,
} else if (ndo->ndo_vflag > 2) {
/* print ttl */
ND_PRINT((ndo, " ["));
- relts_print(EXTRACT_32BITS(cp));
+ relts_print(ndo, EXTRACT_32BITS(cp));
ND_PRINT((ndo, "]"));
cp += 4;
} else {
diff --git a/print-dvmrp.c b/print-dvmrp.c
index 20af2cf5..2d712d82 100644
--- a/print-dvmrp.c
+++ b/print-dvmrp.c
@@ -337,7 +337,7 @@ print_prune(netdissect_options *ndo,
ND_PRINT((ndo, " src %s grp %s", ipaddr_string(bp), ipaddr_string(bp + 4)));
bp += 8;
ND_PRINT((ndo, " timer "));
- relts_print(EXTRACT_32BITS(bp));
+ relts_print(ndo, EXTRACT_32BITS(bp));
return (0);
trunc:
return (-1);
diff --git a/print-fr.c b/print-fr.c
index 41ef2e2e..29976ab9 100644
--- a/print-fr.c
+++ b/print-fr.c
@@ -469,7 +469,7 @@ mfr_print(netdissect_options *ndo,
case MFR_CTRL_IE_TIMESTAMP:
if (ie_len == sizeof(struct timeval)) {
- ts_print((const struct timeval *)tptr);
+ ts_print(ndo, (const struct timeval *)tptr);
break;
}
/* fall through and hexdump if no unix timestamp */
diff --git a/print-hsrp.c b/print-hsrp.c
index f8299bcd..f35188f7 100644
--- a/print-hsrp.c
+++ b/print-hsrp.c
@@ -116,9 +116,9 @@ hsrp_print(netdissect_options *ndo, register const u_int8_t *bp, register u_int
ND_PRINT((ndo, "addr=%s", ipaddr_string(&hp->hsrp_virtaddr)));
if (ndo->ndo_vflag) {
ND_PRINT((ndo, " hellotime="));
- relts_print(hp->hsrp_hellotime);
+ relts_print(ndo, hp->hsrp_hellotime);
ND_PRINT((ndo, " holdtime="));
- relts_print(hp->hsrp_holdtime);
+ relts_print(ndo, hp->hsrp_holdtime);
ND_PRINT((ndo, " priority=%d", hp->hsrp_priority));
ND_PRINT((ndo, " auth=\""));
if (fn_printn(hp->hsrp_authdata, sizeof(hp->hsrp_authdata),
diff --git a/print-igmp.c b/print-igmp.c
index ae931a88..1c9a71c9 100644
--- a/print-igmp.c
+++ b/print-igmp.c
@@ -226,7 +226,7 @@ print_igmpv3_query(netdissect_options *ndo,
if (mrt < 600) {
ND_PRINT((ndo, "%.1fs", mrt * 0.1));
} else {
- relts_print(mrt / 10);
+ relts_print(ndo, mrt / 10);
}
ND_PRINT((ndo, "]"));
}
diff --git a/print-isoclns.c b/print-isoclns.c
index 50e268c8..d9a69093 100644
--- a/print-isoclns.c
+++ b/print-isoclns.c
@@ -2675,7 +2675,7 @@ isis_print(netdissect_options *ndo,
ND_PRINT((ndo, ", (malformed subTLV) "));
#ifdef HAVE_LIBCRYPTO
- sigcheck = signature_verify(optr, length,
+ sigcheck = signature_verify(ndo, optr, length,
(unsigned char *)tptr + 1);
#else
sigcheck = CANT_CHECK_SIGNATURE;
diff --git a/print-lspping.c b/print-lspping.c
index 9ecc77ed..4103a924 100644
--- a/print-lspping.c
+++ b/print-lspping.c
@@ -552,13 +552,13 @@ lspping_print(netdissect_options *ndo,
timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_sent_sec);
timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_sent_usec);
ND_PRINT((ndo, "\n\t Sender Timestamp: "));
- ts_print(&timestamp);
+ ts_print(ndo, &timestamp);
timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_sec);
timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_usec);
ND_PRINT((ndo, "Receiver Timestamp: "));
if ((timestamp.tv_sec != 0) && (timestamp.tv_usec != 0))
- ts_print(&timestamp);
+ ts_print(ndo, &timestamp);
else
ND_PRINT((ndo, "no timestamp"));
diff --git a/print-lwres.c b/print-lwres.c
index d253da9d..90334e8c 100644
--- a/print-lwres.c
+++ b/print-lwres.c
@@ -543,7 +543,7 @@ lwres_print(netdissect_options *ndo,
EXTRACT_16BITS(&grbn->rdclass))));
}
ND_PRINT((ndo, " TTL "));
- relts_print(EXTRACT_32BITS(&grbn->ttl));
+ relts_print(ndo, EXTRACT_32BITS(&grbn->ttl));
ND_PRINT((ndo, " %u/%u", EXTRACT_16BITS(&grbn->nrdatas),
EXTRACT_16BITS(&grbn->nsigs)));
diff --git a/print-pim.c b/print-pim.c
index 645a4901..9ac9eeb6 100644
--- a/print-pim.c
+++ b/print-pim.c
@@ -127,7 +127,7 @@ pimv1_join_prune_print(netdissect_options *ndo,
hold = EXTRACT_16BITS(&bp[6]);
if (hold != 180) {
ND_PRINT((ndo, "Hold "));
- relts_print(hold);
+ relts_print(ndo, hold);
}
ND_PRINT((ndo, "%s (%s/%d, %s", njoin ? "Join" : "Prune",
ipaddr_string(&bp[26]), bp[25] & 0x3f,
@@ -149,7 +149,7 @@ pimv1_join_prune_print(netdissect_options *ndo,
if (ndo->ndo_vflag > 1)
ND_PRINT((ndo, "\n"));
ND_PRINT((ndo, " Hold time: "));
- relts_print(EXTRACT_16BITS(&bp[6]));
+ relts_print(ndo, EXTRACT_16BITS(&bp[6]));
if (ndo->ndo_vflag < 2)
return;
bp += 8;
@@ -234,7 +234,7 @@ pimv1_print(netdissect_options *ndo,
if (ndo->ndo_vflag) {
ND_TCHECK2(bp[10],2);
ND_PRINT((ndo, " (Hold-time "));
- relts_print(EXTRACT_16BITS(&bp[10]));
+ relts_print(ndo, EXTRACT_16BITS(&bp[10]));
ND_PRINT((ndo, ")"));
}
break;
@@ -264,7 +264,7 @@ pimv1_print(netdissect_options *ndo,
if (EXTRACT_32BITS(&bp[12]) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(&bp[12])));
ND_PRINT((ndo, " RP %s hold ", ipaddr_string(&bp[16])));
- relts_print(EXTRACT_16BITS(&bp[22]));
+ relts_print(ndo, EXTRACT_16BITS(&bp[22]));
}
break;
case 5:
@@ -342,7 +342,7 @@ cisco_autorp_print(netdissect_options *ndo,
ND_PRINT((ndo, " Hold "));
hold = EXTRACT_16BITS(&bp[2]);
if (hold)
- relts_print(EXTRACT_16BITS(&bp[2]));
+ relts_print(ndo, EXTRACT_16BITS(&bp[2]));
else
ND_PRINT((ndo, "FOREVER"));
@@ -657,7 +657,7 @@ pimv2_print(netdissect_options *ndo,
switch (otype) {
case PIMV2_HELLO_OPTION_HOLDTIME:
- relts_print(EXTRACT_16BITS(bp));
+ relts_print(ndo, EXTRACT_16BITS(bp));
break;
case PIMV2_HELLO_OPTION_LANPRUNEDELAY:
@@ -698,7 +698,7 @@ pimv2_print(netdissect_options *ndo,
ND_PRINT((ndo, "v%d", *bp));
if (*(bp+1) != 0) {
ND_PRINT((ndo, ", interval "));
- relts_print(*(bp+1));
+ relts_print(ndo, *(bp+1));
}
if (EXTRACT_16BITS(bp+2) != 0) {
ND_PRINT((ndo, " ?0x%04x?", EXTRACT_16BITS(bp+2)));
@@ -863,7 +863,7 @@ pimv2_print(netdissect_options *ndo,
if (holdtime == 0xffff)
ND_PRINT((ndo, "infinite"));
else
- relts_print(holdtime);
+ relts_print(ndo, holdtime);
}
bp += 4; len -= 4;
for (i = 0; i < ngroup; i++) {
@@ -967,7 +967,7 @@ pimv2_print(netdissect_options *ndo,
goto bs_done;
}
ND_PRINT((ndo, ",holdtime="));
- relts_print(EXTRACT_16BITS(bp));
+ relts_print(ndo, EXTRACT_16BITS(bp));
if (bp + 2 >= ep) {
ND_PRINT((ndo, "...)"));
goto bs_done;
@@ -1019,7 +1019,7 @@ pimv2_print(netdissect_options *ndo,
ND_PRINT((ndo, " prio=%d", bp[1]));
if (bp + 3 >= ep) break;
ND_PRINT((ndo, " holdtime="));
- relts_print(EXTRACT_16BITS(&bp[2]));
+ relts_print(ndo, EXTRACT_16BITS(&bp[2]));
bp += 4;
/* Encoded-Unicast-RP-Address */
@@ -1065,7 +1065,7 @@ pimv2_print(netdissect_options *ndo,
bp += advance;
ND_TCHECK2(bp[0], 2);
ND_PRINT((ndo, " TUNR "));
- relts_print(EXTRACT_16BITS(bp));
+ relts_print(ndo, EXTRACT_16BITS(bp));
break;
diff --git a/print-rsvp.c b/print-rsvp.c
index e869b970..38bfbbb6 100644
--- a/print-rsvp.c
+++ b/print-rsvp.c
@@ -1666,7 +1666,7 @@ _U_
EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest + 12)));
#ifdef HAVE_LIBCRYPTO
- sigcheck = signature_verify(pptr, plen, (unsigned char *)obj_ptr.\
+ sigcheck = signature_verify(ndo, pptr, plen, (unsigned char *)obj_ptr.\
rsvp_obj_integrity->digest);
#else
sigcheck = CANT_CHECK_SIGNATURE;
diff --git a/signature.c b/signature.c
index f80c2853..c35b7838 100644
--- a/signature.c
+++ b/signature.c
@@ -115,7 +115,8 @@ USES_APPLE_RST
* Currently only MD5 is supported.
*/
int
-signature_verify (const u_char *pptr, u_int plen, u_char *sig_ptr)
+signature_verify(netdissect_options *ndo,
+ const u_char *pptr, u_int plen, u_char *sig_ptr)
{
u_int8_t rcvsig[16];
u_int8_t sig[16];
@@ -140,7 +141,7 @@ signature_verify (const u_char *pptr, u_int plen, u_char *sig_ptr)
} else {
for (i = 0; i < sizeof(sig); ++i) {
- (void)printf("%02x", sig[i]);
+ ND_PRINT((ndo, "%02x", sig[i]));
}
return (SIGNATURE_INVALID);
diff --git a/signature.h b/signature.h
index 3f664c5b..a052df86 100644
--- a/signature.h
+++ b/signature.h
@@ -15,10 +15,13 @@
* Original code by Hannes Gredler (hannes@juniper.net)
*/
+/* for netdissect_options */
+#include "netdissect.h"
+
/* signature checking result codes */
#define SIGNATURE_VALID 0
#define SIGNATURE_INVALID 1
#define CANT_CHECK_SIGNATURE 2
extern const struct tok signature_check_values[];
-extern int signature_verify (const u_char *, u_int, u_char *);
+extern int signature_verify(netdissect_options *, const u_char *, u_int, u_char *);
diff --git a/tcpdump.c b/tcpdump.c
index 3d2ef4e9..294c74bf 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1996,10 +1996,10 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
++packets_captured;
++infodelay;
- ts_print(&h->ts);
print_info = (struct print_info *)user;
ndo = print_info->ndo;
+ ts_print(ndo, &h->ts);
/*
* Some printers want to check that they're not walking off the
diff --git a/util.c b/util.c
index 822b60e5..4304e519 100644
--- a/util.c
+++ b/util.c
@@ -38,8 +38,6 @@
#include "interface.h"
-char * ts_format(register int, register int);
-
/*
* Print out a null-terminated filename (or other ascii string).
* If ep is NULL, assume no truncation check is needed.
@@ -137,7 +135,7 @@ fn_printzp(register const u_char *s, register u_int n,
/*
* Format the timestamp
*/
-char *
+static char *
ts_format(register int sec, register int usec)
{
static char buf[sizeof("00:00:00.000000")];
@@ -151,7 +149,8 @@ ts_format(register int sec, register int usec)
* Print the timestamp
*/
void
-ts_print(register const struct timeval *tvp)
+ts_print(netdissect_options *ndo,
+ register const struct timeval *tvp)
{
register int s;
struct tm *tm;
@@ -161,20 +160,20 @@ ts_print(register const struct timeval *tvp)
int d_usec;
int d_sec;
- switch (tflag) {
+ switch (ndo->ndo_tflag) {
case 0: /* Default */
s = (tvp->tv_sec + thiszone) % 86400;
- (void)printf("%s ", ts_format(s, tvp->tv_usec));
+ ND_PRINT((ndo, "%s ", ts_format(s, tvp->tv_usec)));
break;
case 1: /* No time stamp */
break;
case 2: /* Unix timeval style */
- (void)printf("%u.%06u ",
+ ND_PRINT((ndo, "%u.%06u ",
(unsigned)tvp->tv_sec,
- (unsigned)tvp->tv_usec);
+ (unsigned)tvp->tv_usec));
break;
case 3: /* Microseconds since previous packet */
@@ -193,9 +192,9 @@ ts_print(register const struct timeval *tvp)
d_sec--;
}
- (void)printf("%s ", ts_format(d_sec, d_usec));
+ ND_PRINT((ndo, "%s ", ts_format(d_sec, d_usec)));
- if (tflag == 3) { /* set timestamp for last packet */
+ if (ndo->ndo_tflag == 3) { /* set timestamp for last packet */
b_sec = tvp->tv_sec;
b_usec = tvp->tv_usec;
}
@@ -206,11 +205,11 @@ ts_print(register const struct timeval *tvp)
Time = (tvp->tv_sec + thiszone) - s;
tm = gmtime (&Time);
if (!tm)
- printf("Date fail ");
+ ND_PRINT((ndo, "Date fail "));
else
- printf("%04d-%02d-%02d %s ",
+ ND_PRINT((ndo, "%04d-%02d-%02d %s ",
tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
- ts_format(s, tvp->tv_usec));
+ ts_format(s, tvp->tv_usec)));
break;
}
}
@@ -221,7 +220,8 @@ ts_print(register const struct timeval *tvp)
* is represented as 1y1w1d1h1m1s.
*/
void
-relts_print(int secs)
+relts_print(netdissect_options *ndo,
+ int secs)
{
static const char *lengths[] = {"y", "w", "d", "h", "m", "s"};
static const int seconds[] = {31536000, 604800, 86400, 3600, 60, 1};
@@ -229,16 +229,16 @@ relts_print(int secs)
const int *s = seconds;
if (secs == 0) {
- (void)printf("0s");
+ ND_PRINT((ndo, "0s"));
return;
}
if (secs < 0) {
- (void)printf("-");
+ ND_PRINT((ndo, "-"));
secs = -secs;
}
while (secs > 0) {
if (secs >= *s) {
- (void)printf("%d%s", secs / *s, *l);
+ ND_PRINT((ndo, "%d%s", secs / *s, *l));
secs -= (secs / *s) * *s;
}
s++;
@@ -260,8 +260,8 @@ print_unknown_data(netdissect_options *ndo, const u_char *cp,const char *ident,i
ident));
return(0);
}
- if (snapend - cp < len)
- len = snapend - cp;
+ if (ndo->ndo_snapend - cp < len)
+ len = ndo->ndo_snapend - cp;
if (len < 0) {
ND_PRINT((ndo,"%sDissector error: print_unknown_data called with pointer past end of packet",
ident));