summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--print-arcnet.c2
-rw-r--r--print-ascii.c10
-rw-r--r--print-bootp.c62
-rw-r--r--print-dccp.c1
-rw-r--r--print-dhcp6.c4
-rw-r--r--print-esp.c8
-rw-r--r--print-ether.c14
-rw-r--r--print-icmp.c2
-rw-r--r--print-icmp6.c14
-rw-r--r--print-ip6.c22
-rw-r--r--print-ip6opts.c4
-rw-r--r--print-lane.c2
12 files changed, 71 insertions, 74 deletions
diff --git a/print-arcnet.c b/print-arcnet.c
index 08921bdb..666b3115 100644
--- a/print-arcnet.c
+++ b/print-arcnet.c
@@ -340,7 +340,7 @@ arcnet_encap_print(netdissect_options *ndo, u_char arctype, const u_char *p,
case ARCTYPE_ATALK: /* XXX was this ever used? */
if (ndo->ndo_vflag)
- fputs("et1 ", stdout);
+ ND_PRINT((ndo, "et1 "));
atalk_print(p, length);
return (1);
diff --git a/print-ascii.c b/print-ascii.c
index 55e0ae72..2f05c387 100644
--- a/print-ascii.c
+++ b/print-ascii.c
@@ -153,16 +153,16 @@ hex_print_with_offset(netdissect_options *ndo,
i = 0;
while (--nshorts >= 0) {
if ((i++ % 8) == 0) {
- (void)ND_PRINT((ndo,"%s0x%04x: ", ident, oset));
- oset += HEXDUMP_BYTES_PER_LINE;
+ ND_PRINT((ndo,"%s0x%04x: ", ident, oset));
+ oset += HEXDUMP_BYTES_PER_LINE;
}
s = *cp++;
- (void)ND_PRINT((ndo," %02x%02x", s, *cp++));
+ ND_PRINT((ndo," %02x%02x", s, *cp++));
}
if (length & 1) {
if ((i % 8) == 0)
- (void)ND_PRINT((ndo,"%s0x%04x: ", ident, oset));
- (void)ND_PRINT((ndo," %02x", *cp));
+ ND_PRINT((ndo,"%s0x%04x: ", ident, oset));
+ ND_PRINT((ndo," %02x", *cp));
}
}
diff --git a/print-bootp.c b/print-bootp.c
index 85b56301..c714f939 100644
--- a/print-bootp.c
+++ b/print-bootp.c
@@ -132,21 +132,21 @@ bootp_print(netdissect_options *ndo,
if (*bp->bp_sname) {
ND_PRINT((ndo, "\n\t sname \""));
if (fn_print(bp->bp_sname, ndo->ndo_snapend)) {
- putchar('"');
- fputs(tstr + 1, stdout);
+ ND_PRINT((ndo, "\""));
+ ND_PRINT((ndo, tstr + 1));
return;
}
- putchar('"');
+ ND_PRINT((ndo, "\""));
}
ND_TCHECK2(bp->bp_file[0], 1); /* check first char only */
if (*bp->bp_file) {
ND_PRINT((ndo, "\n\t file \""));
if (fn_print(bp->bp_file, ndo->ndo_snapend)) {
- putchar('"');
- fputs(tstr + 1, stdout);
+ ND_PRINT((ndo, "\""));
+ ND_PRINT((ndo, tstr + 1));
return;
}
- putchar('"');
+ ND_PRINT((ndo, "\""));
}
/* Decode the vendor buffer */
@@ -167,7 +167,7 @@ bootp_print(netdissect_options *ndo,
return;
trunc:
- fputs(tstr, stdout);
+ ND_PRINT((ndo, tstr));
}
/*
@@ -452,7 +452,7 @@ rfc1048_print(netdissect_options *ndo,
bp += 2;
cp = tok2str(xtag2str, "?xT%u", us);
if (!first)
- putchar('+');
+ ND_PRINT((ndo, "+"));
ND_PRINT((ndo, "%s", cp + 1));
first = 0;
}
@@ -474,12 +474,12 @@ rfc1048_print(netdissect_options *ndo,
case 'a':
/* ascii strings */
- putchar('"');
+ ND_PRINT((ndo, "\""));
if (fn_printn(bp, len, ndo->ndo_snapend)) {
- putchar('"');
+ ND_PRINT((ndo, "\""));
goto trunc;
}
- putchar('"');
+ ND_PRINT((ndo, "\""));
bp += len;
len = 0;
break;
@@ -490,7 +490,7 @@ rfc1048_print(netdissect_options *ndo,
/* ip addresses/32-bit words */
while (len >= sizeof(ul)) {
if (!first)
- putchar(',');
+ ND_PRINT((ndo, ","));
ul = EXTRACT_32BITS(bp);
if (c == 'i') {
ul = htonl(ul);
@@ -509,7 +509,7 @@ rfc1048_print(netdissect_options *ndo,
/* IP address pairs */
while (len >= 2*sizeof(ul)) {
if (!first)
- putchar(',');
+ ND_PRINT((ndo, ","));
memcpy((char *)&ul, (const char *)bp, sizeof(ul));
ND_PRINT((ndo, "(%s:", ipaddr_string(&ul)));
bp += sizeof(ul);
@@ -525,7 +525,7 @@ rfc1048_print(netdissect_options *ndo,
/* shorts */
while (len >= sizeof(us)) {
if (!first)
- putchar(',');
+ ND_PRINT((ndo, ","));
us = EXTRACT_16BITS(bp);
ND_PRINT((ndo, "%u", us));
bp += sizeof(us);
@@ -538,13 +538,13 @@ rfc1048_print(netdissect_options *ndo,
/* boolean */
while (len > 0) {
if (!first)
- putchar(',');
+ ND_PRINT((ndo, ","));
switch (*bp) {
case 0:
- putchar('N');
+ ND_PRINT((ndo, "N"));
break;
case 1:
- putchar('Y');
+ ND_PRINT((ndo, "Y"));
break;
default:
ND_PRINT((ndo, "%u?", *bp));
@@ -562,7 +562,7 @@ rfc1048_print(netdissect_options *ndo,
/* Bytes */
while (len > 0) {
if (!first)
- putchar(c == 'x' ? ':' : '.');
+ ND_PRINT((ndo, c == 'x' ? ":" : "."));
if (c == 'x')
ND_PRINT((ndo, "%02x", *bp));
else
@@ -586,7 +586,7 @@ rfc1048_print(netdissect_options *ndo,
}
tag = *bp++;
--len;
- fputs(tok2str(nbo2str, NULL, tag), stdout);
+ ND_PRINT((ndo, tok2str(nbo2str, NULL, tag)));
break;
case TAG_OPT_OVERLOAD:
@@ -598,7 +598,7 @@ rfc1048_print(netdissect_options *ndo,
}
tag = *bp++;
--len;
- fputs(tok2str(oo2str, NULL, tag), stdout);
+ ND_PRINT((ndo, tok2str(oo2str, NULL, tag)));
break;
case TAG_CLIENT_FQDN:
@@ -616,12 +616,12 @@ rfc1048_print(netdissect_options *ndo,
if (*bp || *(bp+1))
ND_PRINT((ndo, "%u/%u ", *bp, *(bp+1)));
bp += 2;
- putchar('"');
+ ND_PRINT((ndo, "\""));
if (fn_printn(bp, len - 3, ndo->ndo_snapend)) {
- putchar('"');
+ ND_PRINT((ndo, "\""));
goto trunc;
}
- putchar('"');
+ ND_PRINT((ndo, "\""));
bp += len - 3;
len = 0;
break;
@@ -638,12 +638,12 @@ rfc1048_print(netdissect_options *ndo,
type = *bp++;
len--;
if (type == 0) {
- putchar('"');
+ ND_PRINT((ndo, "\""));
if (fn_printn(bp, len, ndo->ndo_snapend)) {
- putchar('"');
+ ND_PRINT((ndo, "\""));
goto trunc;
}
- putchar('"');
+ ND_PRINT((ndo, "\""));
bp += len;
len = 0;
break;
@@ -651,7 +651,7 @@ rfc1048_print(netdissect_options *ndo,
ND_PRINT((ndo, "%s ", tok2str(arp2str, "hardware-type %u,", type)));
while (len > 0) {
if (!first)
- putchar(':');
+ ND_PRINT((ndo, ":"));
ND_PRINT((ndo, "%02x", *bp));
++bp;
--len;
@@ -711,7 +711,7 @@ rfc1048_print(netdissect_options *ndo,
}
while (len > 0) {
if (!first)
- putchar(',');
+ ND_PRINT((ndo, ","));
mask_width = *bp++;
len--;
/* mask_width <= 32 */
@@ -729,13 +729,13 @@ rfc1048_print(netdissect_options *ndo,
len = 0;
break;
}
- putchar('(');
+ ND_PRINT((ndo, "("));
if (mask_width == 0)
ND_PRINT((ndo, "default"));
else {
for (i = 0; i < significant_octets ; i++) {
if (i > 0)
- putchar('.');
+ ND_PRINT((ndo, "."));
ND_PRINT((ndo, "%d", *bp++));
}
for (i = significant_octets ; i < 4 ; i++)
@@ -799,7 +799,7 @@ cmu_print(netdissect_options *ndo,
return;
trunc:
- fputs(tstr, stdout);
+ ND_PRINT((ndo, tstr));
#undef PRINTCMUADDR
}
diff --git a/print-dccp.c b/print-dccp.c
index 07163e38..e9b246b0 100644
--- a/print-dccp.c
+++ b/print-dccp.c
@@ -312,7 +312,6 @@ void dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
ipaddr_string(&ip->ip_src), sport,
ipaddr_string(&ip->ip_dst), dport));
}
- fflush(stdout);
if (ndo->ndo_qflag) {
ND_PRINT((ndo, " %d", len - hlen));
diff --git a/print-dhcp6.c b/print-dhcp6.c
index 70c0e15c..28b30451 100644
--- a/print-dhcp6.c
+++ b/print-dhcp6.c
@@ -606,7 +606,7 @@ dhcp6opt_print(netdissect_options *ndo,
case DH6OPT_DOMAIN_LIST:
tp = (u_char *)(dh6o + 1);
while (tp < cp + sizeof(*dh6o) + optlen) {
- putchar(' ');
+ ND_PRINT((ndo, " "));
if ((tp = ns_nprint(ndo, tp, cp + sizeof(*dh6o) + optlen)) == NULL)
goto trunc;
}
@@ -759,7 +759,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " %s", ip6addr_string(&tp[0])));
break;
case DH6OPT_NTP_SUBOPTION_SRV_FQDN:
- putchar(' ');
+ ND_PRINT((ndo, " "));
if (ns_nprint(ndo, tp, tp + subopt_len) == NULL)
goto trunc;
break;
diff --git a/print-esp.c b/print-esp.c
index 5e000ae1..78f3253b 100644
--- a/print-esp.c
+++ b/print-esp.c
@@ -21,14 +21,14 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <string.h>
-
#include <tcpdump-stdinc.h>
+#include <string.h>
#include <stdlib.h>
/* Any code in this file that depends on HAVE_LIBCRYPTO depends on
@@ -43,14 +43,12 @@
#endif
#endif
-#include <stdio.h>
-
#include "ip.h"
#ifdef INET6
#include "ip6.h"
#endif
-#include "netdissect.h"
+#include "interface.h"
#include "extract.h"
/*
diff --git a/print-ether.c b/print-ether.c
index 231c0728..09b9baba 100644
--- a/print-ether.c
+++ b/print-ether.c
@@ -93,26 +93,26 @@ ether_hdr_print(netdissect_options *ndo,
ep = (const struct ether_header *)bp;
- (void)ND_PRINT((ndo, "%s > %s",
+ ND_PRINT((ndo, "%s > %s",
etheraddr_string(ESRC(ep)),
etheraddr_string(EDST(ep))));
ether_type = EXTRACT_16BITS(&ep->ether_type);
if (!ndo->ndo_qflag) {
if (ether_type <= ETHERMTU)
- (void)ND_PRINT((ndo, ", 802.3"));
+ ND_PRINT((ndo, ", 802.3"));
else
- (void)ND_PRINT((ndo, ", ethertype %s (0x%04x)",
+ ND_PRINT((ndo, ", ethertype %s (0x%04x)",
tok2str(ethertype_values,"Unknown", ether_type),
ether_type));
} else {
if (ether_type <= ETHERMTU)
- (void)ND_PRINT((ndo, ", 802.3"));
+ ND_PRINT((ndo, ", 802.3"));
else
- (void)ND_PRINT((ndo, ", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", ether_type)));
+ ND_PRINT((ndo, ", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", ether_type)));
}
- (void)ND_PRINT((ndo, ", length %u: ", length));
+ ND_PRINT((ndo, ", length %u: ", length));
}
/*
@@ -341,7 +341,7 @@ ethertype_print(netdissect_options *ndo,
case ETHERTYPE_ATALK:
if (ndo->ndo_vflag)
- fputs("et1 ", stdout);
+ ND_PRINT((ndo, "et1 "));
atalk_print(/*ndo,*/p, length);
return (1);
diff --git a/print-icmp.c b/print-icmp.c
index e680c01c..c22d92b8 100644
--- a/print-icmp.c
+++ b/print-icmp.c
@@ -688,7 +688,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
return;
trunc:
- fputs("[|icmp]", stdout);
+ ND_PRINT((ndo, "[|icmp]"));
}
/*
* Local Variables:
diff --git a/print-icmp6.c b/print-icmp6.c
index 9024225c..7b5f3f3c 100644
--- a/print-icmp6.c
+++ b/print-icmp6.c
@@ -909,11 +909,11 @@ icmp6_print(netdissect_options *ndo,
udp_sum = EXTRACT_16BITS(&dp->icmp6_cksum);
sum = icmp6_cksum(ip, dp, length);
if (sum != 0)
- (void)ND_PRINT((ndo,"[bad icmp6 cksum 0x%04x -> 0x%04x!] ",
+ ND_PRINT((ndo,"[bad icmp6 cksum 0x%04x -> 0x%04x!] ",
udp_sum,
in_cksum_shouldbe(udp_sum, sum)));
else
- (void)ND_PRINT((ndo,"[icmp6 sum ok] "));
+ ND_PRINT((ndo,"[icmp6 sum ok] "));
}
}
@@ -1456,13 +1456,13 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len)
ND_PRINT((ndo,", %d source(s)", nsrcs));
else {
/* Print the sources */
- (void)ND_PRINT((ndo," {"));
+ ND_PRINT((ndo," {"));
for (j = 0; j < nsrcs; j++) {
ND_TCHECK2(bp[group + 20 + j * sizeof(struct in6_addr)],
sizeof(struct in6_addr));
ND_PRINT((ndo," %s", ip6addr_string(&bp[group + 20 + j * sizeof(struct in6_addr)])));
}
- (void)ND_PRINT((ndo," }"));
+ ND_PRINT((ndo," }"));
}
/* Next group record */
group += 20 + nsrcs * sizeof(struct in6_addr);
@@ -1471,7 +1471,7 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len)
}
return;
trunc:
- (void)ND_PRINT((ndo,"[|icmp6]"));
+ ND_PRINT((ndo,"[|icmp6]"));
return;
}
@@ -1497,7 +1497,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
mrt = ((mrc & 0x0fff) | 0x1000) << (((mrc & 0x7000) >> 12) + 3);
}
if (ndo->ndo_vflag) {
- (void)ND_PRINT((ndo," [max resp delay=%d]", mrt));
+ ND_PRINT((ndo," [max resp delay=%d]", mrt));
}
ND_TCHECK2(bp[8], sizeof(struct in6_addr));
ND_PRINT((ndo," [gaddr %s", ip6addr_string(&bp[8])));
@@ -1537,7 +1537,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
ND_PRINT((ndo,"]"));
return;
trunc:
- (void)ND_PRINT((ndo,"[|icmp6]"));
+ ND_PRINT((ndo,"[|icmp6]"));
return;
}
diff --git a/print-ip6.c b/print-ip6.c
index f341d7ee..dbebc4fb 100644
--- a/print-ip6.c
+++ b/print-ip6.c
@@ -88,7 +88,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
ND_TCHECK(*ip6);
if (length < sizeof (struct ip6_hdr)) {
- (void)ND_PRINT((ndo, "truncated-ip6 %u", length));
+ ND_PRINT((ndo, "truncated-ip6 %u", length));
return;
}
@@ -103,7 +103,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
payload_len = EXTRACT_16BITS(&ip6->ip6_plen);
len = payload_len + sizeof(struct ip6_hdr);
if (length < len)
- (void)ND_PRINT((ndo, "truncated-ip6 - %u bytes missing!",
+ ND_PRINT((ndo, "truncated-ip6 - %u bytes missing!",
len - length));
if (ndo->ndo_vflag) {
@@ -112,18 +112,18 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
#if 0
/* rfc1883 */
if (flow & 0x0f000000)
- (void)ND_PRINT((ndo, "pri 0x%02x, ", (flow & 0x0f000000) >> 24));
+ ND_PRINT((ndo, "pri 0x%02x, ", (flow & 0x0f000000) >> 24));
if (flow & 0x00ffffff)
- (void)ND_PRINT((ndo, "flowlabel 0x%06x, ", flow & 0x00ffffff));
+ ND_PRINT((ndo, "flowlabel 0x%06x, ", flow & 0x00ffffff));
#else
/* RFC 2460 */
if (flow & 0x0ff00000)
- (void)ND_PRINT((ndo, "class 0x%02x, ", (flow & 0x0ff00000) >> 20));
+ ND_PRINT((ndo, "class 0x%02x, ", (flow & 0x0ff00000) >> 20));
if (flow & 0x000fffff)
- (void)ND_PRINT((ndo, "flowlabel 0x%05x, ", flow & 0x000fffff));
+ ND_PRINT((ndo, "flowlabel 0x%05x, ", flow & 0x000fffff));
#endif
- (void)ND_PRINT((ndo, "hlim %u, next-header %s (%u) payload length: %u) ",
+ ND_PRINT((ndo, "hlim %u, next-header %s (%u) payload length: %u) ",
ip6->ip6_hlim,
tok2str(ipproto_values,"unknown",ip6->ip6_nxt),
ip6->ip6_nxt,
@@ -147,7 +147,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
if (cp == (const u_char *)(ip6 + 1) &&
nh != IPPROTO_TCP && nh != IPPROTO_UDP &&
nh != IPPROTO_DCCP && nh != IPPROTO_SCTP) {
- (void)ND_PRINT((ndo, "%s > %s: ", ip6addr_string(&ip6->ip6_src),
+ ND_PRINT((ndo, "%s > %s: ", ip6addr_string(&ip6->ip6_src),
ip6addr_string(&ip6->ip6_dst)));
}
@@ -252,18 +252,18 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
return;
case IPPROTO_NONE:
- (void)ND_PRINT((ndo, "no next header"));
+ ND_PRINT((ndo, "no next header"));
return;
default:
- (void)ND_PRINT((ndo, "ip-proto-%d %d", nh, len));
+ ND_PRINT((ndo, "ip-proto-%d %d", nh, len));
return;
}
}
return;
trunc:
- (void)ND_PRINT((ndo, "[|ip6]"));
+ ND_PRINT((ndo, "[|ip6]"));
}
#endif /* INET6 */
diff --git a/print-ip6opts.c b/print-ip6opts.c
index e6493842..835fe411 100644
--- a/print-ip6opts.c
+++ b/print-ip6opts.c
@@ -186,7 +186,7 @@ hbhopt_print(netdissect_options *ndo, register const u_char *bp)
return(hbhlen);
trunc:
- fputs("[|HBH]", stdout);
+ ND_PRINT((ndo, "[|HBH]"));
return(-1);
}
@@ -208,7 +208,7 @@ dstopt_print(netdissect_options *ndo, register const u_char *bp)
return(dstoptlen);
trunc:
- fputs("[|DSTOPT]", stdout);
+ ND_PRINT((ndo, "[|DSTOPT]"));
return(-1);
}
#endif /* INET6 */
diff --git a/print-lane.c b/print-lane.c
index 97653efd..c8d919e1 100644
--- a/print-lane.c
+++ b/print-lane.c
@@ -68,7 +68,7 @@ static const struct tok lecop2str[] = {
static void
lane_hdr_print(netdissect_options *ndo, const u_char *bp)
{
- (void)ND_PRINT((ndo, "lecid:%x ", EXTRACT_16BITS(bp)));
+ ND_PRINT((ndo, "lecid:%x ", EXTRACT_16BITS(bp)));
}
/*