diff options
author | Richard Procter <procter@cvs.openbsd.org> | 2020-01-24 22:46:38 +0000 |
---|---|---|
committer | Richard Procter <procter@cvs.openbsd.org> | 2020-01-24 22:46:38 +0000 |
commit | 29981ecc3d0e1a683ba42811ac611ce0c7cf23a2 (patch) | |
tree | 96f3673162bcfd42351dcc9545f7a069644845aa /usr.sbin/tcpdump | |
parent | cd1bbbfbe5544d90fb80a0d423234cef5385897f (diff) |
- (void)printf() -> printf(); the cast adds clutter for little value.
- fprintf(stdout, ...) -> printf()
- fputs(x, stdout) -> printf(); for consistency.
fputs is twice as fast on atom x5-Z8300@1.44GHz but Amdahl sees a pure printf
tcpdump only 2% slower than a pure fputs (for constant strings) tcpdump
to /dev/null across a 20MB/~170k packet pcap file.
ok dlg@ for fputs and ok tedu@ krw@ deraadt@ a2k19 for the rest
Diffstat (limited to 'usr.sbin/tcpdump')
40 files changed, 721 insertions, 727 deletions
diff --git a/usr.sbin/tcpdump/print-arp.c b/usr.sbin/tcpdump/print-arp.c index 6b0e642e935..7ac2d98cde1 100644 --- a/usr.sbin/tcpdump/print-arp.c +++ b/usr.sbin/tcpdump/print-arp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-arp.c,v 1.15 2015/11/18 15:36:20 mmcc Exp $ */ +/* $OpenBSD: print-arp.c,v 1.16 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -62,7 +62,7 @@ arp_print(const u_char *bp, u_int length, u_int caplen) return; } if (length < sizeof(struct ether_arp)) { - (void)printf("truncated-arp"); + printf("truncated-arp"); default_print((u_char *)ap, length); return; } @@ -74,48 +74,47 @@ arp_print(const u_char *bp, u_int length, u_int caplen) if ((pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) || ap->arp_hln != sizeof(SHA(ap)) || ap->arp_pln != sizeof(SPA(ap))) { - (void)printf("arp-#%d for proto #%d (%d) hardware #%d (%d)", - op, pro, ap->arp_pln, - hrd, ap->arp_hln); + printf("arp-#%d for proto #%d (%d) hardware #%d (%d)", + op, pro, ap->arp_pln, hrd, ap->arp_hln); return; } if (pro == ETHERTYPE_TRAIL) - (void)printf("trailer-"); + printf("trailer-"); eh = (struct ether_header *)packetp; switch (op) { case ARPOP_REQUEST: - (void)printf("arp who-has %s", ipaddr_string(TPA(ap))); + printf("arp who-has %s", ipaddr_string(TPA(ap))); if (memcmp((char *)ezero, (char *)THA(ap), 6) != 0) - (void)printf(" (%s)", etheraddr_string(THA(ap))); - (void)printf(" tell %s", ipaddr_string(SPA(ap))); + printf(" (%s)", etheraddr_string(THA(ap))); + printf(" tell %s", ipaddr_string(SPA(ap))); if (memcmp((char *)ESRC(eh), (char *)SHA(ap), 6) != 0) - (void)printf(" (%s)", etheraddr_string(SHA(ap))); + printf(" (%s)", etheraddr_string(SHA(ap))); break; case ARPOP_REPLY: - (void)printf("arp reply %s", ipaddr_string(SPA(ap))); + printf("arp reply %s", ipaddr_string(SPA(ap))); if (memcmp((char *)ESRC(eh), (char *)SHA(ap), 6) != 0) - (void)printf(" (%s)", etheraddr_string(SHA(ap))); - (void)printf(" is-at %s", etheraddr_string(SHA(ap))); + printf(" (%s)", etheraddr_string(SHA(ap))); + printf(" is-at %s", etheraddr_string(SHA(ap))); if (memcmp((char *)EDST(eh), (char *)THA(ap), 6) != 0) - (void)printf(" (%s)", etheraddr_string(THA(ap))); + printf(" (%s)", etheraddr_string(THA(ap))); break; case REVARP_REQUEST: - (void)printf("rarp who-is %s tell %s", - etheraddr_string(THA(ap)), - etheraddr_string(SHA(ap))); + printf("rarp who-is %s tell %s", + etheraddr_string(THA(ap)), + etheraddr_string(SHA(ap))); break; case REVARP_REPLY: - (void)printf("rarp reply %s at %s", - etheraddr_string(THA(ap)), - ipaddr_string(TPA(ap))); + printf("rarp reply %s at %s", + etheraddr_string(THA(ap)), + ipaddr_string(TPA(ap))); break; default: - (void)printf("arp-#%d", op); + printf("arp-#%d", op); default_print((u_char *)ap, caplen); return; } diff --git a/usr.sbin/tcpdump/print-atalk.c b/usr.sbin/tcpdump/print-atalk.c index d1c13781c64..3b8ddbc1c53 100644 --- a/usr.sbin/tcpdump/print-atalk.c +++ b/usr.sbin/tcpdump/print-atalk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-atalk.c,v 1.33 2017/08/30 09:23:00 otto Exp $ */ +/* $OpenBSD: print-atalk.c,v 1.34 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -99,7 +99,7 @@ atalk_print(const u_char *bp, u_int length) u_short snet; if (length < ddpSize) { - (void)printf(" [|ddp %d]", length); + printf(" [|ddp %d]", length); return; } dp = (const struct atDDP *)bp; @@ -129,7 +129,7 @@ atalk_print_llap(const u_char *bp, u_int length) u_short snet; if (length < sizeof(*lp)) { - (void)printf(" [|llap %d]", length); + printf(" [|llap %d]", length); return; } @@ -140,7 +140,7 @@ atalk_print_llap(const u_char *bp, u_int length) case lapShortDDP: if (length < ddpSSize) { - (void)printf(" [|sddp %d]", length); + printf(" [|sddp %d]", length); return; } sdp = (const struct atShortDDP *)bp; @@ -155,7 +155,7 @@ atalk_print_llap(const u_char *bp, u_int length) case lapDDP: if (length < ddpSize) { - (void)printf(" [|ddp %d]", length); + printf(" [|ddp %d]", length); return; } dp = (const struct atDDP *)bp; @@ -198,21 +198,21 @@ aarp_print(const u_char *bp, u_int length) switch (ntohs(ap->op)) { case 1: /* request */ - (void)printf("who-has %s tell %s", + printf("who-has %s tell %s", AT(pdaddr), AT(psaddr)); return; case 2: /* response */ - (void)printf("reply %s is-at %s", + printf("reply %s is-at %s", AT(pdaddr), etheraddr_string(ap->hdaddr)); return; case 3: /* probe (oy!) */ - (void)printf("probe %s tell %s", + printf("probe %s tell %s", AT(pdaddr), AT(psaddr)); return; } - (void)printf("len %u op %u htype %u ptype %#x halen %u palen %u", + printf("len %u op %u htype %u ptype %#x halen %u palen %u", length, ntohs(ap->op), ntohs(ap->htype), ntohs(ap->ptype), ap->halen, ap->palen); } @@ -250,7 +250,7 @@ ddp_print(const u_char *bp, u_int length, int t, break; default: - (void)printf(" at-%s %d", tok2str(type2str, NULL, t), length); + printf(" at-%s %d", tok2str(type2str, NULL, t), length); break; } } @@ -263,88 +263,88 @@ atp_print(const struct atATP *ap, u_int length) if ((const u_char *)(ap + 1) > snapend) { /* Just bail if we don't have the whole chunk. */ - fputs(tstr, stdout); + printf("%s", tstr); return; } length -= sizeof(*ap); switch (ap->control & 0xc0) { case atpReqCode: - (void)printf(" atp-req%s %d", - ap->control & atpXO? " " : "*", - EXTRACT_16BITS(&ap->transID)); + printf(" atp-req%s %d", + ap->control & atpXO? " " : "*", + EXTRACT_16BITS(&ap->transID)); atp_bitmap_print(ap->bitmap); if (length != 0) - (void)printf(" [len=%d]", length); + printf(" [len=%d]", length); switch (ap->control & (atpEOM|atpSTS)) { case atpEOM: - (void)printf(" [EOM]"); + printf(" [EOM]"); break; case atpSTS: - (void)printf(" [STS]"); + printf(" [STS]"); break; case atpEOM|atpSTS: - (void)printf(" [EOM,STS]"); + printf(" [EOM,STS]"); break; } break; case atpRspCode: - (void)printf(" atp-resp%s%d:%d (%d)", - ap->control & atpEOM? "*" : " ", - EXTRACT_16BITS(&ap->transID), ap->bitmap, length); + printf(" atp-resp%s%d:%d (%d)", + ap->control & atpEOM? "*" : " ", + EXTRACT_16BITS(&ap->transID), ap->bitmap, length); switch (ap->control & (atpXO|atpSTS)) { case atpXO: - (void)printf(" [XO]"); + printf(" [XO]"); break; case atpSTS: - (void)printf(" [STS]"); + printf(" [STS]"); break; case atpXO|atpSTS: - (void)printf(" [XO,STS]"); + printf(" [XO,STS]"); break; } break; case atpRelCode: - (void)printf(" atp-rel %d", EXTRACT_16BITS(&ap->transID)); + printf(" atp-rel %d", EXTRACT_16BITS(&ap->transID)); atp_bitmap_print(ap->bitmap); /* length should be zero */ if (length) - (void)printf(" [len=%d]", length); + printf(" [len=%d]", length); /* there shouldn't be any control flags */ if (ap->control & (atpXO|atpEOM|atpSTS)) { c = '['; if (ap->control & atpXO) { - (void)printf("%cXO", c); + printf("%cXO", c); c = ','; } if (ap->control & atpEOM) { - (void)printf("%cEOM", c); + printf("%cEOM", c); c = ','; } if (ap->control & atpSTS) { - (void)printf("%cSTS", c); + printf("%cSTS", c); c = ','; } - (void)printf("]"); + printf("]"); } break; default: - (void)printf(" atp-0x%x %d (%d)", ap->control, - EXTRACT_16BITS(&ap->transID), length); + printf(" atp-0x%x %d (%d)", ap->control, + EXTRACT_16BITS(&ap->transID), length); break; } data = EXTRACT_32BITS(&ap->userData); if (data != 0) - (void)printf(" 0x%x", data); + printf(" 0x%x", data); } static void @@ -362,19 +362,19 @@ atp_bitmap_print(u_char bm) c = '<'; for (i = 0; bm; ++i) { if (bm & 1) { - (void)printf("%c%d", c, i); + printf("%c%d", c, i); c = ','; } bm >>= 1; } - (void)printf(">"); + printf(">"); } else { for (i = 0; bm; ++i) bm >>= 1; if (i > 1) - (void)printf("<0-%d>", i - 1); + printf("<0-%d>", i - 1); else - (void)printf("<0>"); + printf("<0>"); } } @@ -388,7 +388,7 @@ nbp_print(const struct atNBP *np, u_int length, u_short snet, const u_char *ep; if (length < nbpHeaderSize) { - (void)printf(" truncated-nbp %d", length); + printf(" truncated-nbp %d", length); return; } @@ -396,30 +396,29 @@ nbp_print(const struct atNBP *np, u_int length, u_short snet, if (length < 8) { /* must be room for at least one tuple */ if (np->control == nbpNATLKerr) { - (void)printf(" nbp-netatalk_err"); + printf(" nbp-netatalk_err"); return; } else if (np->control == nbpNATLKok) { - (void)printf(" nbp-netatalk_ok"); + printf(" nbp-netatalk_ok"); return; } - (void)printf(" truncated-nbp nbp-0x%x %d (%d)", - np->control, np->id, length + nbpHeaderSize); + printf(" truncated-nbp nbp-0x%x %d (%d)", + np->control, np->id, length + nbpHeaderSize); return; } /* ep points to end of available data */ ep = snapend; if ((const u_char *)tp > ep) { - fputs(tstr, stdout); + printf("%s", tstr); return; } switch (i = np->control & 0xf0) { case nbpBrRq: case nbpLkUp: - (void)printf(i == nbpLkUp? " nbp-lkup %d:":" nbp-brRq %d:", - np->id); + printf(i == nbpLkUp? " nbp-lkup %d:":" nbp-brRq %d:", np->id); if ((const u_char *)(tp + 1) > ep) { - fputs(tstr, stdout); + printf("%s", tstr); return; } (void)nbp_name_print(tp, ep); @@ -429,18 +428,18 @@ nbp_print(const struct atNBP *np, u_int length, u_short snet, * address and the enumerator should be zero. */ if ((np->control & 0xf) != 1) - (void)printf(" [ntup=%d]", np->control & 0xf); + printf(" [ntup=%d]", np->control & 0xf); if (tp->enumerator) - (void)printf(" [enum=%d]", tp->enumerator); + printf(" [enum=%d]", tp->enumerator); if (EXTRACT_16BITS(&tp->net) != snet || tp->node != snode || tp->skt != skt) - (void)printf(" [addr=%s.%d]", + printf(" [addr=%s.%d]", ataddr_string(EXTRACT_16BITS(&tp->net), tp->node), tp->skt); break; case nbpLkUpReply: - (void)printf(" nbp-reply %d:", np->id); + printf(" nbp-reply %d:", np->id); /* print each of the tuples in the reply */ for (i = np->control & 0xf; --i >= 0 && tp; ) @@ -449,17 +448,17 @@ nbp_print(const struct atNBP *np, u_int length, u_short snet, case nbpNATLKrgstr: case nbpNATLKunrgstr: - (void)printf((i == nbpNATLKrgstr) ? - " nbp-netatalk_rgstr %d:" : - " nbp-netatalk_unrgstr %d:", - np->id); + printf((i == nbpNATLKrgstr) ? + " nbp-netatalk_rgstr %d:" : + " nbp-netatalk_unrgstr %d:", + np->id); for (i = np->control & 0xf; --i >= 0 && tp; ) tp = nbp_tuple_print(tp, ep, snet, snode, skt); break; default: - (void)printf(" nbp-0x%x %d (%d)", np->control, np->id, - length); + printf(" nbp-0x%x %d (%d)", np->control, np->id, + length); break; } } @@ -471,19 +470,19 @@ print_cstring(const char *cp, const u_char *ep) u_int length; if (cp >= (const char *)ep) { - fputs(tstr, stdout); + printf("%s", tstr); return (0); } length = *cp++; /* Spec says string can be at most 32 bytes long */ if (length > 32) { - (void)printf("[len=%d]", length); + printf("[len=%d]", length); return (0); } while ((int)--length >= 0) { if (cp >= (char *)ep) { - fputs(tstr, stdout); + printf("%s", tstr); return (0); } putchar(*cp++); @@ -500,22 +499,22 @@ nbp_tuple_print(const struct atNBPtuple *tp, const struct atNBPtuple *tpn; if ((const u_char *)(tp + 1) > ep) { - fputs(tstr, stdout); + printf("%s", tstr); return 0; } tpn = nbp_name_print(tp, ep); /* if the enumerator isn't 1, print it */ if (tp->enumerator != 1) - (void)printf("(%d)", tp->enumerator); + printf("(%d)", tp->enumerator); /* if the socket doesn't match the src socket, print it */ if (tp->skt != skt) - (void)printf(" %d", tp->skt); + printf(" %d", tp->skt); /* if the address doesn't match the src address, it's an anomaly */ if (EXTRACT_16BITS(&tp->net) != snet || tp->node != snode) - (void)printf(" [addr=%s]", + printf(" [addr=%s]", ataddr_string(EXTRACT_16BITS(&tp->net), tp->node)); return (tpn); diff --git a/usr.sbin/tcpdump/print-atm.c b/usr.sbin/tcpdump/print-atm.c index edcf81eee3b..6dca1df7692 100644 --- a/usr.sbin/tcpdump/print-atm.c +++ b/usr.sbin/tcpdump/print-atm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-atm.c,v 1.13 2018/10/22 16:12:45 kn Exp $ */ +/* $OpenBSD: print-atm.c,v 1.14 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1994, 1995, 1996, 1997 @@ -120,7 +120,7 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) case ETHERTYPE_ATALK: if (vflag) - fputs("et1 ", stdout); + printf("et1 "); atalk_print(p, length); break; diff --git a/usr.sbin/tcpdump/print-bootp.c b/usr.sbin/tcpdump/print-bootp.c index 47d947a3d04..5c90f39f6e0 100644 --- a/usr.sbin/tcpdump/print-bootp.c +++ b/usr.sbin/tcpdump/print-bootp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-bootp.c,v 1.23 2018/07/06 05:47:22 dlg Exp $ */ +/* $OpenBSD: print-bootp.c,v 1.24 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 @@ -138,7 +138,7 @@ bootp_print(const u_char *cp, u_int length, printf(" sname \""); if (fn_print(bp->bp_sname, snapend)) { putchar('"'); - fputs(tstr + 1, stdout); + printf("%s", tstr + 1); return; } putchar('"'); @@ -148,7 +148,7 @@ bootp_print(const u_char *cp, u_int length, printf(" file \""); if (fn_print(bp->bp_file, snapend)) { putchar('"'); - fputs(tstr + 1, stdout); + printf("%s", tstr + 1); return; } putchar('"'); @@ -173,7 +173,7 @@ bootp_print(const u_char *cp, u_int length, return; trunc: - fputs(tstr, stdout); + printf("%s", tstr); } /* The first character specifies the format to print */ @@ -289,12 +289,12 @@ rfc1048_print(const u_char *bp, u_int length) /* Get the length; check for truncation */ if (bp + 1 >= snapend) { - fputs(tstr, stdout); + printf("%s", tstr); return; } len = *bp++; if (bp + len >= snapend) { - fputs(tstr, stdout); + printf("%s", tstr); return; } @@ -465,6 +465,6 @@ cmu_print(const u_char *bp, u_int length) return; trunc: - fputs(tstr, stdout); + printf("%s", tstr); #undef PRINTCMUADDR } diff --git a/usr.sbin/tcpdump/print-decnet.c b/usr.sbin/tcpdump/print-decnet.c index cfe32f79517..8f2c907133d 100644 --- a/usr.sbin/tcpdump/print-decnet.c +++ b/usr.sbin/tcpdump/print-decnet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-decnet.c,v 1.17 2015/11/16 00:16:39 mmcc Exp $ */ +/* $OpenBSD: print-decnet.c,v 1.18 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997 @@ -71,18 +71,18 @@ decnet_print(const u_char *ap, u_int length, u_int caplen) const u_char *nspp; if (length < sizeof(struct shorthdr)) { - (void)printf("[|decnet]"); + printf("[|decnet]"); return; } TCHECK2(*ap, sizeof(short)); pktlen = EXTRACT_LE_16BITS(ap); if (pktlen < sizeof(struct shorthdr)) { - (void)printf("[|decnet]"); + printf("[|decnet]"); return; } if (pktlen > length) { - (void)printf("[|decnet]"); + printf("[|decnet]"); return; } length = pktlen; @@ -98,9 +98,9 @@ decnet_print(const u_char *ap, u_int length, u_int caplen) /* pad bytes of some sort in front of message */ u_int padlen = mflags & RMF_PADMASK; if (vflag) - (void) printf("[pad:%d] ", padlen); + printf("[pad:%d] ", padlen); if (length < padlen + 2) { - (void)printf("[|decnet]"); + printf("[|decnet]"); return; } TCHECK2(ap[sizeof(short)], padlen); @@ -114,7 +114,7 @@ decnet_print(const u_char *ap, u_int length, u_int caplen) } if (mflags & RMF_FVER) { - (void) printf("future-version-decnet"); + printf("future-version-decnet"); default_print(ap, min(length, caplen)); return; } @@ -129,7 +129,7 @@ decnet_print(const u_char *ap, u_int length, u_int caplen) switch (mflags & RMF_MASK) { case RMF_LONG: if (length < sizeof(struct longhdr)) { - (void)printf("[|decnet]"); + printf("[|decnet]"); return; } TCHECK(rhp->rh_long); @@ -150,21 +150,21 @@ decnet_print(const u_char *ap, u_int length, u_int caplen) nsplen = length - sizeof(struct shorthdr); break; default: - (void) printf("unknown message flags under mask"); + printf("unknown message flags under mask"); default_print((u_char *)ap, min(length, caplen)); return; } - (void)printf("%s > %s %d ", - dnaddr_string(src), dnaddr_string(dst), pktlen); + printf("%s > %s %d ", + dnaddr_string(src), dnaddr_string(dst), pktlen); if (vflag) { if (mflags & RMF_RQR) - (void)printf("RQR "); + printf("RQR "); if (mflags & RMF_RTS) - (void)printf("RTS "); + printf("RTS "); if (mflags & RMF_IE) - (void)printf("IE "); - (void)printf("%d hops ", hops); + printf("IE "); + printf("%d hops ", hops); } if (!print_nsp(nspp, nsplen)) @@ -172,7 +172,7 @@ decnet_print(const u_char *ap, u_int length, u_int caplen) return; trunc: - (void)printf("[|decnet]"); + printf("[|decnet]"); return; } @@ -190,7 +190,7 @@ print_decnet_ctlmsg(const union routehdr *rhp, u_int length, switch (mflags & RMF_CTLMASK) { case RMF_INIT: - (void)printf("init "); + printf("init "); if (length < sizeof(struct initmsg)) goto trunc; TCHECK(cmp->cm_init); @@ -202,55 +202,53 @@ print_decnet_ctlmsg(const union routehdr *rhp, u_int length, ueco = EXTRACT_LE_8BITS(cmp->cm_init.in_ueco); hello = EXTRACT_LE_16BITS(cmp->cm_init.in_hello); print_t_info(info); - (void)printf( - "src %sblksize %d vers %d eco %d ueco %d hello %d", - dnaddr_string(src), blksize, vers, eco, ueco, - hello); + printf("src %sblksize %d vers %d eco %d ueco %d hello %d", + dnaddr_string(src), blksize, vers, eco, ueco, hello); ret = 1; break; case RMF_VER: - (void)printf("verification "); + printf("verification "); if (length < sizeof(struct verifmsg)) goto trunc; TCHECK(cmp->cm_ver); src = EXTRACT_LE_16BITS(cmp->cm_ver.ve_src); other = EXTRACT_LE_8BITS(cmp->cm_ver.ve_fcnval); - (void)printf("src %s fcnval %o", dnaddr_string(src), other); + printf("src %s fcnval %o", dnaddr_string(src), other); ret = 1; break; case RMF_TEST: - (void)printf("test "); + printf("test "); if (length < sizeof(struct testmsg)) goto trunc; TCHECK(cmp->cm_test); src = EXTRACT_LE_16BITS(cmp->cm_test.te_src); other = EXTRACT_LE_8BITS(cmp->cm_test.te_data); - (void)printf("src %s data %o", dnaddr_string(src), other); + printf("src %s data %o", dnaddr_string(src), other); ret = 1; break; case RMF_L1ROUT: - (void)printf("lev-1-routing "); + printf("lev-1-routing "); if (length < sizeof(struct l1rout)) goto trunc; TCHECK(cmp->cm_l1rou); src = EXTRACT_LE_16BITS(cmp->cm_l1rou.r1_src); - (void)printf("src %s ", dnaddr_string(src)); + printf("src %s ", dnaddr_string(src)); ret = print_l1_routes(&(rhpx[sizeof(struct l1rout)]), length - sizeof(struct l1rout)); break; case RMF_L2ROUT: - (void)printf("lev-2-routing "); + printf("lev-2-routing "); if (length < sizeof(struct l2rout)) goto trunc; TCHECK(cmp->cm_l2rout); src = EXTRACT_LE_16BITS(cmp->cm_l2rout.r2_src); - (void)printf("src %s ", dnaddr_string(src)); + printf("src %s ", dnaddr_string(src)); ret = print_l2_routes(&(rhpx[sizeof(struct l2rout)]), length - sizeof(struct l2rout)); break; case RMF_RHELLO: - (void)printf("router-hello "); + printf("router-hello "); if (length < sizeof(struct rhellomsg)) goto trunc; TCHECK(cmp->cm_rhello); @@ -265,15 +263,13 @@ print_decnet_ctlmsg(const union routehdr *rhp, u_int length, priority = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_priority); hello = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_hello); print_i_info(info); - (void)printf( - "vers %d eco %d ueco %d src %s blksize %d pri %d hello %d", - vers, eco, ueco, dnaddr_string(src), - blksize, priority, hello); + printf("vers %d eco %d ueco %d src %s blksize %d pri %d hello %d", + vers, eco, ueco, dnaddr_string(src), blksize, priority, hello); ret = print_elist(&(rhpx[sizeof(struct rhellomsg)]), length - sizeof(struct rhellomsg)); break; case RMF_EHELLO: - (void)printf("endnode-hello "); + printf("endnode-hello "); if (length < sizeof(struct ehellomsg)) goto trunc; TCHECK(cmp->cm_ehello); @@ -292,15 +288,15 @@ print_decnet_ctlmsg(const union routehdr *rhp, u_int length, hello = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_hello); other = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_data); print_i_info(info); - (void)printf( + printf( "vers %d eco %d ueco %d src %s blksize %d rtr %s hello %d data %o", - vers, eco, ueco, dnaddr_string(src), - blksize, dnaddr_string(dst), hello, other); + vers, eco, ueco, dnaddr_string(src), + blksize, dnaddr_string(dst), hello, other); ret = 1; break; default: - (void)printf("unknown control message"); + printf("unknown control message"); default_print((u_char *)rhp, min(length, caplen)); ret = 1; break; @@ -316,15 +312,15 @@ print_t_info(int info) { int ntype = info & 3; switch (ntype) { - case 0: (void)printf("reserved-ntype? "); break; - case TI_L2ROUT: (void)printf("l2rout "); break; - case TI_L1ROUT: (void)printf("l1rout "); break; - case TI_ENDNODE: (void)printf("endnode "); break; + case 0: printf("reserved-ntype? "); break; + case TI_L2ROUT: printf("l2rout "); break; + case TI_L1ROUT: printf("l1rout "); break; + case TI_ENDNODE: printf("endnode "); break; } if (info & TI_VERIF) - (void)printf("verif "); + printf("verif "); if (info & TI_BLOCK) - (void)printf("blo "); + printf("blo "); } static int @@ -348,8 +344,8 @@ print_l1_routes(const char *rp, u_int len) info = EXTRACT_LE_16BITS(rp); rp += sizeof(short); len -= sizeof(short); - (void)printf("{ids %d-%d cost %d hops %d} ", id, id + count, - RI_COST(info), RI_HOPS(info)); + printf("{ids %d-%d cost %d hops %d} ", id, id + count, + RI_COST(info), RI_HOPS(info)); } return (1); @@ -378,8 +374,8 @@ print_l2_routes(const char *rp, u_int len) info = EXTRACT_LE_16BITS(rp); rp += sizeof(short); len -= sizeof(short); - (void)printf("{areas %d-%d cost %d hops %d} ", area, area + count, - RI_COST(info), RI_HOPS(info)); + printf("{areas %d-%d cost %d hops %d} ", area, area + count, + RI_COST(info), RI_HOPS(info)); } return (1); @@ -392,17 +388,17 @@ print_i_info(int info) { int ntype = info & II_TYPEMASK; switch (ntype) { - case 0: (void)printf("reserved-ntype? "); break; - case II_L2ROUT: (void)printf("l2rout "); break; - case II_L1ROUT: (void)printf("l1rout "); break; - case II_ENDNODE: (void)printf("endnode "); break; + case 0: printf("reserved-ntype? "); break; + case II_L2ROUT: printf("l2rout "); break; + case II_L1ROUT: printf("l1rout "); break; + case II_ENDNODE: printf("endnode "); break; } if (info & II_VERIF) - (void)printf("verif "); + printf("verif "); if (info & II_NOMCAST) - (void)printf("nomcast "); + printf("nomcast "); if (info & II_BLOCK) - (void)printf("blo "); + printf("blo "); } static int @@ -447,9 +443,9 @@ print_nsp(const u_char *nspp, u_int nsplen) ack = EXTRACT_LE_16BITS(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) - (void)printf("nak %d ", ack & SGQ_MASK); + printf("nak %d ", ack & SGQ_MASK); else - (void)printf("ack %d ", ack & SGQ_MASK); + printf("ack %d ", ack & SGQ_MASK); data_off += sizeof(short); if (nsplen < data_off) goto trunc; @@ -457,9 +453,9 @@ print_nsp(const u_char *nspp, u_int nsplen) ack = EXTRACT_LE_16BITS(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackoth field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) - (void)printf("onak %d ", ack & SGQ_MASK); + printf("onak %d ", ack & SGQ_MASK); else - (void)printf("oack %d ", ack & SGQ_MASK); + printf("oack %d ", ack & SGQ_MASK); data_off += sizeof(short); if (nsplen < data_off) goto trunc; @@ -467,7 +463,7 @@ print_nsp(const u_char *nspp, u_int nsplen) ack = EXTRACT_LE_16BITS(shp->sh_seq[2]); } } - (void)printf("seg %d ", ack & SGQ_MASK); + printf("seg %d ", ack & SGQ_MASK); #ifdef PRINT_NSPDATA if (nsplen > data_off) { dp = &(nspp[data_off]); @@ -493,9 +489,9 @@ print_nsp(const u_char *nspp, u_int nsplen) ack = EXTRACT_LE_16BITS(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) - (void)printf("nak %d ", ack & SGQ_MASK); + printf("nak %d ", ack & SGQ_MASK); else - (void)printf("ack %d ", ack & SGQ_MASK); + printf("ack %d ", ack & SGQ_MASK); data_off += sizeof(short); if (nsplen < data_off) goto trunc; @@ -503,9 +499,9 @@ print_nsp(const u_char *nspp, u_int nsplen) ack = EXTRACT_LE_16BITS(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) - (void)printf("nakdat %d ", ack & SGQ_MASK); + printf("nakdat %d ", ack & SGQ_MASK); else - (void)printf("ackdat %d ", ack & SGQ_MASK); + printf("ackdat %d ", ack & SGQ_MASK); data_off += sizeof(short); if (nsplen < data_off) goto trunc; @@ -513,7 +509,7 @@ print_nsp(const u_char *nspp, u_int nsplen) ack = EXTRACT_LE_16BITS(shp->sh_seq[2]); } } - (void)printf("seg %d ", ack & SGQ_MASK); + printf("seg %d ", ack & SGQ_MASK); #ifdef PRINT_NSPDATA if (nsplen > data_off) { dp = &(nspp[data_off]); @@ -524,7 +520,7 @@ print_nsp(const u_char *nspp, u_int nsplen) } break; case MFS_ILS: - (void)printf("link-service %d>%d ", src, dst); + printf("link-service %d>%d ", src, dst); { struct seghdr *shp = (struct seghdr *)nspp; struct lsmsg *lsmp = @@ -538,59 +534,59 @@ print_nsp(const u_char *nspp, u_int nsplen) ack = EXTRACT_LE_16BITS(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) - (void)printf("nak %d ", ack & SGQ_MASK); + printf("nak %d ", ack & SGQ_MASK); else - (void)printf("ack %d ", ack & SGQ_MASK); + printf("ack %d ", ack & SGQ_MASK); TCHECK(shp->sh_seq[1]); ack = EXTRACT_LE_16BITS(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) - (void)printf("nakdat %d ", ack & SGQ_MASK); + printf("nakdat %d ", ack & SGQ_MASK); else - (void)printf("ackdat %d ", ack & SGQ_MASK); + printf("ackdat %d ", ack & SGQ_MASK); TCHECK(shp->sh_seq[2]); ack = EXTRACT_LE_16BITS(shp->sh_seq[2]); } } - (void)printf("seg %d ", ack & SGQ_MASK); + printf("seg %d ", ack & SGQ_MASK); TCHECK(*lsmp); lsflags = EXTRACT_LE_8BITS(lsmp->ls_lsflags); fcval = EXTRACT_LE_8BITS(lsmp->ls_fcval); switch (lsflags & LSI_MASK) { case LSI_DATA: - (void)printf("dat seg count %d ", fcval); + printf("dat seg count %d ", fcval); switch (lsflags & LSM_MASK) { case LSM_NOCHANGE: break; case LSM_DONOTSEND: - (void)printf("donotsend-data "); + printf("donotsend-data "); break; case LSM_SEND: - (void)printf("send-data "); + printf("send-data "); break; default: - (void)printf("reserved-fcmod? %x", lsflags); + printf("reserved-fcmod? %x", lsflags); break; } break; case LSI_INTR: - (void)printf("intr req count %d ", fcval); + printf("intr req count %d ", fcval); break; default: - (void)printf("reserved-fcval-int? %x", lsflags); + printf("reserved-fcval-int? %x", lsflags); break; } } break; default: - (void)printf("reserved-subtype? %x %d > %d", flags, src, dst); + printf("reserved-subtype? %x %d > %d", flags, src, dst); break; } break; case MFT_ACK: switch (flags & NSP_SUBMASK) { case MFS_DACK: - (void)printf("data-ack %d>%d ", src, dst); + printf("data-ack %d>%d ", src, dst); { struct ackmsg *amp = (struct ackmsg *)nspp; int ack; @@ -601,21 +597,21 @@ print_nsp(const u_char *nspp, u_int nsplen) ack = EXTRACT_LE_16BITS(amp->ak_acknum[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) - (void)printf("nak %d ", ack & SGQ_MASK); + printf("nak %d ", ack & SGQ_MASK); else - (void)printf("ack %d ", ack & SGQ_MASK); + printf("ack %d ", ack & SGQ_MASK); ack = EXTRACT_LE_16BITS(amp->ak_acknum[1]); if (ack & SGQ_OACK) { /* ackoth field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) - (void)printf("onak %d ", ack & SGQ_MASK); + printf("onak %d ", ack & SGQ_MASK); else - (void)printf("oack %d ", ack & SGQ_MASK); + printf("oack %d ", ack & SGQ_MASK); } } } break; case MFS_IACK: - (void)printf("ils-ack %d>%d ", src, dst); + printf("ils-ack %d>%d ", src, dst); { struct ackmsg *amp = (struct ackmsg *)nspp; int ack; @@ -626,25 +622,25 @@ print_nsp(const u_char *nspp, u_int nsplen) ack = EXTRACT_LE_16BITS(amp->ak_acknum[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) - (void)printf("nak %d ", ack & SGQ_MASK); + printf("nak %d ", ack & SGQ_MASK); else - (void)printf("ack %d ", ack & SGQ_MASK); + printf("ack %d ", ack & SGQ_MASK); TCHECK(amp->ak_acknum[1]); ack = EXTRACT_LE_16BITS(amp->ak_acknum[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) - (void)printf("nakdat %d ", ack & SGQ_MASK); + printf("nakdat %d ", ack & SGQ_MASK); else - (void)printf("ackdat %d ", ack & SGQ_MASK); + printf("ackdat %d ", ack & SGQ_MASK); } } } break; case MFS_CACK: - (void)printf("conn-ack %d", dst); + printf("conn-ack %d", dst); break; default: - (void)printf("reserved-acktype? %x %d > %d", flags, src, dst); + printf("reserved-acktype? %x %d > %d", flags, src, dst); break; } break; @@ -653,10 +649,10 @@ print_nsp(const u_char *nspp, u_int nsplen) case MFS_CI: case MFS_RCI: if ((flags & NSP_SUBMASK) == MFS_CI) - (void)printf("conn-initiate "); + printf("conn-initiate "); else - (void)printf("retrans-conn-initiate "); - (void)printf("%d>%d ", src, dst); + printf("retrans-conn-initiate "); + printf("%d>%d ", src, dst); { struct cimsg *cimp = (struct cimsg *)nspp; int services, info, segsize; @@ -675,30 +671,30 @@ print_nsp(const u_char *nspp, u_int nsplen) case COS_NONE: break; case COS_SEGMENT: - (void)printf("seg "); + printf("seg "); break; case COS_MESSAGE: - (void)printf("msg "); + printf("msg "); break; case COS_CRYPTSER: - (void)printf("crypt "); + printf("crypt "); break; } switch (info & COI_MASK) { case COI_32: - (void)printf("ver 3.2 "); + printf("ver 3.2 "); break; case COI_31: - (void)printf("ver 3.1 "); + printf("ver 3.1 "); break; case COI_40: - (void)printf("ver 4.0 "); + printf("ver 4.0 "); break; case COI_41: - (void)printf("ver 4.1 "); + printf("ver 4.1 "); break; } - (void)printf("segsize %d ", segsize); + printf("segsize %d ", segsize); #ifdef PRINT_NSPDATA if (nsplen > sizeof(struct cimsg)) { dp = &(nspp[sizeof(struct cimsg)]); @@ -709,7 +705,7 @@ print_nsp(const u_char *nspp, u_int nsplen) } break; case MFS_CC: - (void)printf("conn-confirm %d>%d ", src, dst); + printf("conn-confirm %d>%d ", src, dst); { struct ccmsg *ccmp = (struct ccmsg *)nspp; int services, info; @@ -730,32 +726,32 @@ print_nsp(const u_char *nspp, u_int nsplen) case COS_NONE: break; case COS_SEGMENT: - (void)printf("seg "); + printf("seg "); break; case COS_MESSAGE: - (void)printf("msg "); + printf("msg "); break; case COS_CRYPTSER: - (void)printf("crypt "); + printf("crypt "); break; } switch (info & COI_MASK) { case COI_32: - (void)printf("ver 3.2 "); + printf("ver 3.2 "); break; case COI_31: - (void)printf("ver 3.1 "); + printf("ver 3.1 "); break; case COI_40: - (void)printf("ver 4.0 "); + printf("ver 4.0 "); break; case COI_41: - (void)printf("ver 4.1 "); + printf("ver 4.1 "); break; } - (void)printf("segsize %d ", segsize); + printf("segsize %d ", segsize); if (optlen) { - (void)printf("optlen %d ", optlen); + printf("optlen %d ", optlen); #ifdef PRINT_NSPDATA if (optlen > nsplen - sizeof(struct ccmsg)) goto trunc; @@ -767,7 +763,7 @@ print_nsp(const u_char *nspp, u_int nsplen) } break; case MFS_DI: - (void)printf("disconn-initiate %d>%d ", src, dst); + printf("disconn-initiate %d>%d ", src, dst); { struct dimsg *dimp = (struct dimsg *)nspp; int reason; @@ -784,7 +780,7 @@ print_nsp(const u_char *nspp, u_int nsplen) print_reason(reason); if (optlen) { - (void)printf("optlen %d ", optlen); + printf("optlen %d ", optlen); #ifdef PRINT_NSPDATA if (optlen > nsplen - sizeof(struct dimsg)) goto trunc; @@ -796,7 +792,7 @@ print_nsp(const u_char *nspp, u_int nsplen) } break; case MFS_DC: - (void)printf("disconn-confirm %d>%d ", src, dst); + printf("disconn-confirm %d>%d ", src, dst); { struct dcmsg *dcmp = (struct dcmsg *)nspp; int reason; @@ -808,12 +804,12 @@ print_nsp(const u_char *nspp, u_int nsplen) } break; default: - (void)printf("reserved-ctltype? %x %d > %d", flags, src, dst); + printf("reserved-ctltype? %x %d > %d", flags, src, dst); break; } break; default: - (void)printf("reserved-type? %x %d > %d", flags, src, dst); + printf("reserved-type? %x %d > %d", flags, src, dst); break; } return (1); diff --git a/usr.sbin/tcpdump/print-domain.c b/usr.sbin/tcpdump/print-domain.c index 58f1e1c98c8..f5d74e8227c 100644 --- a/usr.sbin/tcpdump/print-domain.c +++ b/usr.sbin/tcpdump/print-domain.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-domain.c,v 1.26 2018/10/22 16:12:45 kn Exp $ */ +/* $OpenBSD: print-domain.c,v 1.27 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -353,7 +353,7 @@ ns_qprint(const u_char *cp, const u_char *bp, int is_mdns) if (is_mdns && (i & C_QU)) printf(" (QU)"); - fputs("? ", stdout); + printf("? "); cp = ns_nprint(np, bp); return(cp ? cp + 4 : NULL); } @@ -604,7 +604,7 @@ ns_print(const u_char *bp, u_int length, int is_mdns) if (qdcount < EXTRACT_16BITS(&np->qdcount) - 1) putchar(','); if (vflag > 1) { - fputs(" q:", stdout); + printf(" q:"); if ((cp = ns_qprint(cp, bp, is_mdns)) == NULL) goto trunc; } else { @@ -628,7 +628,7 @@ ns_print(const u_char *bp, u_int length, int is_mdns) /* Print NS and AR sections on -vv */ if (vflag > 1) { if (cp < snapend && nscount--) { - fputs(" ns:", stdout); + printf(" ns:"); if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL) goto trunc; while (cp < snapend && nscount--) { @@ -640,7 +640,7 @@ ns_print(const u_char *bp, u_int length, int is_mdns) if (nscount > 0) goto trunc; if (cp < snapend && arcount--) { - fputs(" ar:", stdout); + printf(" ar:"); if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL) goto trunc; while (cp < snapend && arcount--) { @@ -712,7 +712,7 @@ ns_print(const u_char *bp, u_int length, int is_mdns) if (ancount > 0) goto trunc; if (cp < snapend && nscount--) { - fputs(" ns:", stdout); + printf(" ns:"); if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL) goto trunc; while (nscount-- && cp < snapend) { @@ -724,7 +724,7 @@ ns_print(const u_char *bp, u_int length, int is_mdns) if (nscount > 0) goto trunc; if (cp < snapend && arcount--) { - fputs(" ar:", stdout); + printf(" ar:"); if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL) goto trunc; while (cp < snapend && arcount--) { diff --git a/usr.sbin/tcpdump/print-ether.c b/usr.sbin/tcpdump/print-ether.c index 46aef01cebe..773fbb828fa 100644 --- a/usr.sbin/tcpdump/print-ether.c +++ b/usr.sbin/tcpdump/print-ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ether.c,v 1.36 2019/12/03 01:43:33 dlg Exp $ */ +/* $OpenBSD: print-ether.c,v 1.37 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -60,17 +60,17 @@ ether_print(const u_char *bp, u_int length) ep = (const struct ether_header *)bp; if (qflag) { TCHECK2(*ep, 12); - (void)printf("%s %s %d: ", - etheraddr_string(ESRC(ep)), - etheraddr_string(EDST(ep)), - length); + printf("%s %s %d: ", + etheraddr_string(ESRC(ep)), + etheraddr_string(EDST(ep)), + length); } else { TCHECK2(*ep, 14); - (void)printf("%s %s %s %d: ", - etheraddr_string(ESRC(ep)), - etheraddr_string(EDST(ep)), - etherproto_string(ep->ether_type), - length); + printf("%s %s %s %d: ", + etheraddr_string(ESRC(ep)), + etheraddr_string(EDST(ep)), + etherproto_string(ep->ether_type), + length); } return; trunc: @@ -243,7 +243,7 @@ recurse: case ETHERTYPE_ATALK: if (vflag) - fputs("et1 ", stdout); + printf("et1 "); atalk_print_llap(p, length); return (1); diff --git a/usr.sbin/tcpdump/print-fddi.c b/usr.sbin/tcpdump/print-fddi.c index f8681f243a0..fce50ba944f 100644 --- a/usr.sbin/tcpdump/print-fddi.c +++ b/usr.sbin/tcpdump/print-fddi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-fddi.c,v 1.17 2015/11/16 00:16:39 mmcc Exp $ */ +/* $OpenBSD: print-fddi.c,v 1.18 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -229,15 +229,15 @@ fddi_print(const struct fddi_header *fddip, u_int length, dstname = etheraddr_string(fdst); if (vflag) - (void) printf("%02x %s %s %d: ", - fddip->fddi_fc, - srcname, dstname, - length); + printf("%02x %s %s %d: ", + fddip->fddi_fc, + srcname, dstname, + length); else if (qflag) printf("%s %s %d: ", srcname, dstname, length); else { (void) print_fddi_fc(fddip->fddi_fc); - (void) printf("%s %s %d: ", srcname, dstname, length); + printf("%s %s %d: ", srcname, dstname, length); } } diff --git a/usr.sbin/tcpdump/print-frag6.c b/usr.sbin/tcpdump/print-frag6.c index d608c9cda3c..e09cb2693d3 100644 --- a/usr.sbin/tcpdump/print-frag6.c +++ b/usr.sbin/tcpdump/print-frag6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-frag6.c,v 1.9 2018/10/22 16:12:45 kn Exp $ */ +/* $OpenBSD: print-frag6.c,v 1.10 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994 @@ -74,11 +74,11 @@ frag6_print(const u_char *bp, const u_char *bp2) return 65535; else { - fputs(" ", stdout); + printf(" "); return sizeof(struct ip6_frag); } trunc: - fputs("[|frag]", stdout); + printf("[|frag]"); return 65535; #undef TCHECK } diff --git a/usr.sbin/tcpdump/print-gre.c b/usr.sbin/tcpdump/print-gre.c index 8cec128aea2..35f32a9ddab 100644 --- a/usr.sbin/tcpdump/print-gre.c +++ b/usr.sbin/tcpdump/print-gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-gre.c,v 1.29 2019/12/03 01:43:33 dlg Exp $ */ +/* $OpenBSD: print-gre.c,v 1.30 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -415,7 +415,7 @@ gre_print_pptp(const u_char *p, u_int length, uint16_t flags) return; if (length < len) { - (void)printf(" truncated-pptp - %d bytes missing!", + printf(" truncated-pptp - %d bytes missing!", len - length); len = length; } @@ -467,7 +467,7 @@ gre_print_eoip(const u_char *p, u_int length, uint16_t flags) printf(" %u", id); if (length < len) { - (void)printf(" truncated-eoip - %d bytes missing!", + printf(" truncated-eoip - %d bytes missing!", len - length); len = length; } diff --git a/usr.sbin/tcpdump/print-icmp.c b/usr.sbin/tcpdump/print-icmp.c index fe967c5088b..7fed9496bd0 100644 --- a/usr.sbin/tcpdump/print-icmp.c +++ b/usr.sbin/tcpdump/print-icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-icmp.c,v 1.25 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: print-icmp.c,v 1.26 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996 @@ -178,9 +178,9 @@ icmp_print(const u_char *bp, u_int length, const u_char *bp2) ip = (struct ip *)bp2; str = buf; - (void)printf("%s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); + printf("%s > %s: ", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); TCHECK(dp->icmp_code); if (qflag) @@ -371,27 +371,27 @@ icmp_print(const u_char *bp, u_int length, const u_char *bp2) str = tok2str(icmp2str, "type-#%u", dp->icmp_type); break; } - (void)printf("icmp: %s", str); + printf("icmp: %s", str); if (vflag) { if (TTEST2(dp->icmp_type, length)) { u_int16_t sum, icmp_sum; sum = in_cksum((const u_short *)dp, length, 0); if (sum != 0) { icmp_sum = EXTRACT_16BITS(&dp->icmp_cksum); - (void)printf(" [bad icmp cksum %x! -> %x]", icmp_sum, + printf(" [bad icmp cksum %x! -> %x]", icmp_sum, in_cksum_shouldbe(icmp_sum, sum)); } else - (void)printf(" [icmp cksum ok]"); + printf(" [icmp cksum ok]"); } } if (vflag > 1 && !ICMP_INFOTYPE(dp->icmp_type) && TTEST(dp->icmp_ip)) { - (void)printf(" for "); + printf(" for "); oip = &dp->icmp_ip; ip_print((u_char *)oip, ntohs(oip->ip_len)); } return; trunc: - fputs("[|icmp]", stdout); + printf("[|icmp]"); } diff --git a/usr.sbin/tcpdump/print-icmp6.c b/usr.sbin/tcpdump/print-icmp6.c index b95e9fa297d..43f6dc21119 100644 --- a/usr.sbin/tcpdump/print-icmp6.c +++ b/usr.sbin/tcpdump/print-icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-icmp6.c,v 1.22 2018/10/22 16:12:45 kn Exp $ */ +/* $OpenBSD: print-icmp6.c,v 1.23 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994 @@ -151,9 +151,9 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) icmp6len = snapend - bp; #if 0 - (void)printf("%s > %s: ", - ip6addr_string(&ip->ip6_src), - ip6addr_string(&ip->ip6_dst)); + printf("%s > %s: ", + ip6addr_string(&ip->ip6_src), + ip6addr_string(&ip->ip6_dst)); #endif TCHECK(dp->icmp6_code); @@ -163,11 +163,11 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) switch (dp->icmp6_code) { case ICMP6_DST_UNREACH_NOROUTE: printf("icmp6: %s unreachable route", - ip6addr_string(&oip->ip6_dst)); + ip6addr_string(&oip->ip6_dst)); break; case ICMP6_DST_UNREACH_ADMIN: printf("icmp6: %s unreachable prohibited", - ip6addr_string(&oip->ip6_dst)); + ip6addr_string(&oip->ip6_dst)); break; #ifdef ICMP6_DST_UNREACH_BEYONDSCOPE case ICMP6_DST_UNREACH_BEYONDSCOPE: @@ -175,12 +175,12 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) case ICMP6_DST_UNREACH_NOTNEIGHBOR: #endif printf("icmp6: %s beyond scope of source address %s", - ip6addr_string(&oip->ip6_dst), - ip6addr_string(&oip->ip6_src)); + ip6addr_string(&oip->ip6_dst), + ip6addr_string(&oip->ip6_src)); break; case ICMP6_DST_UNREACH_ADDR: printf("icmp6: %s unreachable address", - ip6addr_string(&oip->ip6_dst)); + ip6addr_string(&oip->ip6_dst)); break; case ICMP6_DST_UNREACH_NOPORT: TCHECK(oip->ip6_nxt); @@ -191,25 +191,25 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) switch (oip->ip6_nxt) { case IPPROTO_TCP: printf("icmp6: %s tcp port %s unreachable", - ip6addr_string(&oip->ip6_dst), - tcpport_string(dport)); + ip6addr_string(&oip->ip6_dst), + tcpport_string(dport)); break; case IPPROTO_UDP: printf("icmp6: %s udp port %s unreachable", - ip6addr_string(&oip->ip6_dst), - udpport_string(dport)); + ip6addr_string(&oip->ip6_dst), + udpport_string(dport)); break; default: printf("icmp6: %s protocol %d port %d unreachable", - ip6addr_string(&oip->ip6_dst), - oip->ip6_nxt, dport); + ip6addr_string(&oip->ip6_dst), + oip->ip6_nxt, dport); break; } break; default: printf("icmp6: %s unreachable code-#%d", - ip6addr_string(&oip->ip6_dst), - dp->icmp6_code); + ip6addr_string(&oip->ip6_dst), + dp->icmp6_code); break; } break; @@ -222,14 +222,14 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) switch (dp->icmp6_code) { case ICMP6_TIME_EXCEED_TRANSIT: printf("icmp6: time exceeded in-transit for %s", - ip6addr_string(&oip->ip6_dst)); + ip6addr_string(&oip->ip6_dst)); break; case ICMP6_TIME_EXCEED_REASSEMBLY: printf("icmp6: ip6 reassembly time exceeded"); break; default: printf("icmp6: time exceeded code-#%d", - dp->icmp6_code); + dp->icmp6_code); break; } break; @@ -238,19 +238,19 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) switch (dp->icmp6_code) { case ICMP6_PARAMPROB_HEADER: printf("icmp6: parameter problem errorneous - octet %u", - (u_int32_t)ntohl(dp->icmp6_pptr)); + (u_int32_t)ntohl(dp->icmp6_pptr)); break; case ICMP6_PARAMPROB_NEXTHEADER: printf("icmp6: parameter problem next header - octet %u", - (u_int32_t)ntohl(dp->icmp6_pptr)); + (u_int32_t)ntohl(dp->icmp6_pptr)); break; case ICMP6_PARAMPROB_OPTION: printf("icmp6: parameter problem option - octet %u", - (u_int32_t)ntohl(dp->icmp6_pptr)); + (u_int32_t)ntohl(dp->icmp6_pptr)); break; default: printf("icmp6: parameter problem code-#%d", - dp->icmp6_code); + dp->icmp6_code); break; } break; @@ -287,8 +287,8 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) printf("icmp6: router solicitation "); if (vflag) { #define RTSOLLEN 8 - icmp6_opt_print((const u_char *)dp + RTSOLLEN, - icmp6len - RTSOLLEN); + icmp6_opt_print((const u_char *)dp + RTSOLLEN, + icmp6len - RTSOLLEN); } break; case ND_ROUTER_ADVERT: @@ -321,11 +321,12 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) printf("pref=rsv, "); break; } - printf("router_ltime=%d, ", ntohs(p->nd_ra_router_lifetime)); + printf("router_ltime=%d, ", + ntohs(p->nd_ra_router_lifetime)); printf("reachable_time=%u, ", - (u_int32_t)ntohl(p->nd_ra_reachable)); + (u_int32_t)ntohl(p->nd_ra_reachable)); printf("retrans_time=%u)", - (u_int32_t)ntohl(p->nd_ra_retransmit)); + (u_int32_t)ntohl(p->nd_ra_retransmit)); #define RTADVLEN 16 icmp6_opt_print((const u_char *)dp + RTADVLEN, icmp6len - RTADVLEN); @@ -340,8 +341,8 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) ip6addr_string(&p->nd_ns_target)); if (vflag) { #define NDSOLLEN 24 - icmp6_opt_print((const u_char *)dp + NDSOLLEN, - icmp6len - NDSOLLEN); + icmp6_opt_print((const u_char *)dp + NDSOLLEN, + icmp6len - NDSOLLEN); } } break; @@ -352,7 +353,7 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) p = (struct nd_neighbor_advert *)dp; TCHECK(p->nd_na_target); printf("icmp6: neighbor adv: tgt is %s", - ip6addr_string(&p->nd_na_target)); + ip6addr_string(&p->nd_na_target)); if (vflag) { #define ND_NA_FLAG_ALL \ (ND_NA_FLAG_ROUTER|ND_NA_FLAG_SOLICITED|ND_NA_FLAG_OVERRIDE) @@ -477,9 +478,9 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) else printf(",TTL=%d", ttl); if (buf[12] != ep - buf - 13) { - (void)printf(",invalid namelen:%d/%u", - buf[12], - (unsigned int)(ep - buf - 13)); + printf(",invalid namelen:%d/%u", + buf[12], + (unsigned int)(ep - buf - 13)); } } } @@ -509,7 +510,7 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2) } return; trunc: - fputs("[|icmp6]", stdout); + printf("[|icmp6]"); #if 0 #undef TCHECK #endif @@ -709,7 +710,7 @@ icmp6_opt_print(const u_char *bp, int resid) default: opts_len = op->nd_opt_len; printf("(unknown opt_type=%d, opt_len=%d)", - op->nd_opt_type, opts_len); + op->nd_opt_type, opts_len); if (opts_len == 0) opts_len = 1; /* XXX */ icmp6_opt_print((const u_char *)op + (opts_len << 3), @@ -718,7 +719,7 @@ icmp6_opt_print(const u_char *bp, int resid) } return; trunc: - fputs("[ndp opt]", stdout); + printf("[ndp opt]"); return; #if 0 #undef TCHECK @@ -786,7 +787,7 @@ mldv2_report_print(const u_char *bp, u_int len) printf(", %d source(s)", nsrcs); else { /* Print the sources */ - (void)printf(" {"); + printf(" {"); for (j = 0; j < nsrcs; j++) { TCHECK2(bp[group + MLDV2_REPORT_MINGRPLEN + @@ -796,7 +797,7 @@ mldv2_report_print(const u_char *bp, u_int len) MLDV2_REPORT_MINGRPLEN + j * sizeof(struct in6_addr)])); } - (void)printf(" }"); + printf(" }"); } /* Next group record */ group += MLDV2_REPORT_MINGRPLEN + nsrcs * @@ -806,7 +807,7 @@ mldv2_report_print(const u_char *bp, u_int len) } return; trunc: - (void)printf("[|icmp6]"); + printf("[|icmp6]"); return; } @@ -834,7 +835,7 @@ mldv2_query_print(const u_char *bp, u_int len) mrd = mrc; } if (vflag) { - (void)printf(" [max resp delay=%d]", mrd); + printf(" [max resp delay=%d]", mrd); } TCHECK2(bp[8], sizeof(struct in6_addr)); printf(" [gaddr %s", ip6addr_string(&bp[8])); @@ -880,6 +881,6 @@ mldv2_query_print(const u_char *bp, u_int len) printf("]"); return; trunc: - (void)printf("[|icmp6]"); + printf("[|icmp6]"); return; } diff --git a/usr.sbin/tcpdump/print-igrp.c b/usr.sbin/tcpdump/print-igrp.c index 1baab1b3f4d..810f4b648c1 100644 --- a/usr.sbin/tcpdump/print-igrp.c +++ b/usr.sbin/tcpdump/print-igrp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-igrp.c,v 1.8 2015/11/16 00:16:39 mmcc Exp $ */ +/* $OpenBSD: print-igrp.c,v 1.9 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1996, 1997 @@ -86,7 +86,7 @@ igrp_print(const u_char *bp, u_int length, const u_char *bp2) hdr = (struct igrphdr *)bp; ip = (struct ip *)bp2; cp = (u_char *)(hdr + 1); - (void)printf("%s > %s: igrp: ", + printf("%s > %s: igrp: ", ipaddr_string(&ip->ip_src), ipaddr_string(&ip->ip_dst)); @@ -96,7 +96,7 @@ igrp_print(const u_char *bp, u_int length, const u_char *bp2) nsys = EXTRACT_16BITS(&hdr->ig_ns); next = EXTRACT_16BITS(&hdr->ig_nx); - (void)printf(" %s V%d edit=%d AS=%d (%d/%d/%d)", + printf(" %s V%d edit=%d AS=%d (%d/%d/%d)", tok2str(op2str, "op-#%d", hdr->ig_op), hdr->ig_v, hdr->ig_ed, @@ -120,7 +120,7 @@ igrp_print(const u_char *bp, u_int length, const u_char *bp2) igrp_entry_print((struct igrprte *)cp, 0, 1); --next; } else { - (void)printf("[extra bytes %d]", length); + printf("[extra bytes %d]", length); break; } cp += IGRP_RTE_SIZE; @@ -129,5 +129,5 @@ igrp_print(const u_char *bp, u_int length, const u_char *bp2) if (nint == 0 && nsys == 0 && next == 0) return; trunc: - fputs("[|igrp]", stdout); + printf("[|igrp]"); } diff --git a/usr.sbin/tcpdump/print-ike.c b/usr.sbin/tcpdump/print-ike.c index 068943b3d06..1ca21b245d9 100644 --- a/usr.sbin/tcpdump/print-ike.c +++ b/usr.sbin/tcpdump/print-ike.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ike.c,v 1.38 2018/07/06 05:47:22 dlg Exp $ */ +/* $OpenBSD: print-ike.c,v 1.39 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 @@ -251,7 +251,7 @@ ike_print (const u_int8_t *cp, u_int length) return; trunc: - fputs(" [|isakmp]", stdout); + printf(" [|isakmp]"); } void @@ -951,7 +951,7 @@ ike_pl_print (u_int8_t type, u_int8_t *buf, u_int8_t doi) pltrunc: if (doi == ISAKMP_DOI) - fputs(" [|isakmp]", stdout); + printf(" [|isakmp]"); else - fputs(" [|ipsec]", stdout); + printf(" [|ipsec]"); } diff --git a/usr.sbin/tcpdump/print-ip.c b/usr.sbin/tcpdump/print-ip.c index b4e17f29b97..e7eb0fa1be6 100644 --- a/usr.sbin/tcpdump/print-ip.c +++ b/usr.sbin/tcpdump/print-ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ip.c,v 1.52 2019/09/19 23:23:58 dlg Exp $ */ +/* $OpenBSD: print-ip.c,v 1.53 2020/01/24 22:46:36 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -128,8 +128,8 @@ static void print_mtrace(const u_char *bp, u_int len) struct tr_query *tr = (struct tr_query *)(bp + 8); printf("mtrace %d: %s to %s reply-to %s", tr->tr_qid, - ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst), - ipaddr_string(&tr->tr_raddr)); + ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst), + ipaddr_string(&tr->tr_raddr)); if (IN_CLASSD(ntohl(tr->tr_raddr))) printf(" with-ttl %d", tr->tr_rttl); } @@ -139,8 +139,8 @@ static void print_mresp(const u_char *bp, u_int len) struct tr_query *tr = (struct tr_query *)(bp + 8); printf("mresp %d: %s to %s reply-to %s", tr->tr_qid, - ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst), - ipaddr_string(&tr->tr_raddr)); + ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst), + ipaddr_string(&tr->tr_raddr)); if (IN_CLASSD(ntohl(tr->tr_raddr))) printf(" with-ttl %d", tr->tr_rttl); } @@ -151,39 +151,39 @@ igmp_print(const u_char *bp, u_int len, const u_char *bp2) const struct ip *ip; ip = (const struct ip *)bp2; - (void)printf("%s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); + printf("%s > %s: ", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); TCHECK2(bp[0], 8); switch (bp[0]) { case 0x11: - (void)printf("igmp query"); + printf("igmp query"); if (*(int *)&bp[4]) - (void)printf(" [gaddr %s]", ipaddr_string(&bp[4])); + printf(" [gaddr %s]", ipaddr_string(&bp[4])); if (len != 8) - (void)printf(" [len %d]", len); + printf(" [len %d]", len); break; case 0x12: - (void)printf("igmp report %s", ipaddr_string(&bp[4])); + printf("igmp report %s", ipaddr_string(&bp[4])); if (len != 8) - (void)printf(" [len %d]", len); + printf(" [len %d]", len); break; case 0x16: - (void)printf("igmp nreport %s", ipaddr_string(&bp[4])); + printf("igmp nreport %s", ipaddr_string(&bp[4])); break; case 0x17: - (void)printf("igmp leave %s", ipaddr_string(&bp[4])); + printf("igmp leave %s", ipaddr_string(&bp[4])); break; case 0x13: - (void)printf("igmp dvmrp"); + printf("igmp dvmrp"); if (len < 8) - (void)printf(" [len %d]", len); + printf(" [len %d]", len); else dvmrp_print(bp, len); break; case 0x14: - (void)printf("igmp pim"); + printf("igmp pim"); pim_print(bp, len); break; case 0x1e: @@ -193,11 +193,11 @@ igmp_print(const u_char *bp, u_int len, const u_char *bp2) print_mtrace(bp, len); break; default: - (void)printf("igmp-%d", bp[0] & 0xf); + printf("igmp-%d", bp[0] & 0xf); break; } if ((bp[0] >> 4) != 1) - (void)printf(" [v%d]", bp[0] >> 4); + printf(" [v%d]", bp[0] >> 4); TCHECK2(bp[0], len); if (vflag) { @@ -218,7 +218,7 @@ igmp_print(const u_char *bp, u_int len, const u_char *bp2) } return; trunc: - fputs("[|igmp]", stdout); + printf("[|igmp]"); } /* @@ -356,20 +356,20 @@ ip_print(const u_char *bp, u_int length) TCHECK(*ip); if (ip->ip_v != IPVERSION) { - (void)printf("bad-ip-version %u", ip->ip_v); + printf("bad-ip-version %u", ip->ip_v); goto out; } len = ntohs(ip->ip_len); if (length < len) { - (void)printf("truncated-ip - %d bytes missing!", - len - length); + printf("truncated-ip - %d bytes missing!", + len - length); len = length; } hlen = ip->ip_hl * 4; if (hlen < sizeof(struct ip) || hlen > len) { - (void)printf("bad-hlen %d", hlen); + printf("bad-hlen %d", hlen); goto out; } @@ -406,9 +406,9 @@ ip_print(const u_char *bp, u_int length) break; case IPPROTO_ND: - (void)printf("%s > %s:", ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); - (void)printf(" nd %d", len); + printf("%s > %s:", ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); + printf(" nd %d", len); break; #ifndef IPPROTO_OSPF @@ -431,9 +431,9 @@ ip_print(const u_char *bp, u_int length) case IPPROTO_IPIP: /* ip-in-ip encapsulation */ if (vflag) - (void)printf("%s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); + printf("%s > %s: ", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); ip_print(cp, len); if (! vflag) { printf(" (encap)"); @@ -447,9 +447,9 @@ ip_print(const u_char *bp, u_int length) case IPPROTO_IPV6: /* ip6-in-ip encapsulation */ if (vflag) - (void)printf("%s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); + printf("%s > %s: ", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); ip6_print(cp, len); if (! vflag) { printf(" (encap)"); @@ -461,9 +461,9 @@ ip_print(const u_char *bp, u_int length) #define IPPROTO_GRE 47 #endif case IPPROTO_GRE: - (void)printf("%s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); + printf("%s > %s: ", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); /* do it */ gre_print(cp, len); break; @@ -472,7 +472,7 @@ ip_print(const u_char *bp, u_int length) #define IPPROTO_ESP 50 #endif case IPPROTO_ESP: - (void)printf("%s > %s: ", + printf("%s > %s: ", ipaddr_string(&ip->ip_src), ipaddr_string(&ip->ip_dst)); esp_print(cp, len, (const u_char *)ip); @@ -490,9 +490,9 @@ ip_print(const u_char *bp, u_int length) #endif case IPPROTO_MOBILE: if (vflag) - (void)printf("mobile %s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); + printf("mobile %s > %s: ", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); mobile_print(cp, len); if (! vflag) { printf(" (mobile encap)"); @@ -504,9 +504,9 @@ ip_print(const u_char *bp, u_int length) #define IPPROTO_ETHERIP 97 #endif case IPPROTO_ETHERIP: - (void)printf("%s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); + printf("%s > %s: ", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); etherip_print(cp, snapend - cp, len); break; @@ -523,15 +523,15 @@ ip_print(const u_char *bp, u_int length) case IPPROTO_CARP: if (packettype == PT_VRRP) { if (vflag) - (void)printf("vrrp %s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); + printf("vrrp %s > %s: ", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); vrrp_print(cp, len, ip->ip_ttl); } else { if (vflag) - (void)printf("carp %s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); + printf("carp %s > %s: ", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); carp_print(cp, len, ip->ip_ttl); } break; @@ -546,9 +546,10 @@ ip_print(const u_char *bp, u_int length) break; default: - (void)printf("%s > %s:", ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); - (void)printf(" ip-proto-%d %d", ip->ip_p, len); + printf("%s > %s:", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); + printf(" ip-proto-%d %d", ip->ip_p, len); break; } } @@ -563,19 +564,21 @@ ip_print(const u_char *bp, u_int length) * next level protocol header. print the ip addr. */ if (off & 0x1fff) - (void)printf("%s > %s:", ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); - (void)printf(" (frag %d:%d@%d%s)", ntohs(ip->ip_id), len, - (off & 0x1fff) * 8, - (off & IP_MF)? "+" : ""); + printf("%s > %s:", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); + printf(" (frag %d:%d@%d%s)", + ntohs(ip->ip_id), len, + (off & 0x1fff) * 8, + (off & IP_MF)? "+" : ""); } if (off & IP_DF) - (void)printf(" (DF)"); + printf(" (DF)"); if (ip->ip_tos) { - (void)printf(" [tos 0x%x", (int)ip->ip_tos); + printf(" [tos 0x%x", (int)ip->ip_tos); if (ip->ip_tos & (IPTOS_CE|IPTOS_ECT)) { - (void)printf(" ("); + printf(" ("); if (ip->ip_tos & IPTOS_ECT) { /* ECN-capable transport */ putchar('E'); @@ -584,41 +587,41 @@ ip_print(const u_char *bp, u_int length) /* _C_ongestion experienced (ECN) */ putchar('C'); } - (void)printf(")"); + printf(")"); } - (void)printf("]"); + printf("]"); } if (ip->ip_ttl <= 1) - (void)printf(" [ttl %d]", (int)ip->ip_ttl); + printf(" [ttl %d]", (int)ip->ip_ttl); if (vflag) { char *sep = ""; printf(" ("); if (ip->ip_ttl > 1) { - (void)printf("%sttl %d", sep, (int)ip->ip_ttl); + printf("%sttl %d", sep, (int)ip->ip_ttl); sep = ", "; } if ((off & 0x3fff) == 0) { - (void)printf("%sid %d", sep, (int)ntohs(ip->ip_id)); + printf("%sid %d", sep, (int)ntohs(ip->ip_id)); sep = ", "; } - (void)printf("%slen %u", sep, ntohs(ip->ip_len)); + printf("%slen %u", sep, ntohs(ip->ip_len)); sep = ", "; if ((u_char *)ip + hlen <= snapend) { u_int16_t sum, ip_sum; sum = in_cksum((const u_short *)ip, hlen, 0); if (sum != 0) { ip_sum = EXTRACT_16BITS(&ip->ip_sum); - (void)printf("%sbad ip cksum %x! -> %x", sep, ip_sum, - in_cksum_shouldbe(ip_sum, sum)); + printf("%sbad ip cksum %x! -> %x", sep, ip_sum, + in_cksum_shouldbe(ip_sum, sum)); sep = ", "; } } if (hlen > sizeof(struct ip)) { hlen -= sizeof(struct ip); - (void)printf("%soptlen=%d", sep, hlen); + printf("%soptlen=%d", sep, hlen); ip_optprint((u_char *)(ip + 1), hlen); } printf(")"); diff --git a/usr.sbin/tcpdump/print-ip6.c b/usr.sbin/tcpdump/print-ip6.c index b82128280c6..80d3bd3a5aa 100644 --- a/usr.sbin/tcpdump/print-ip6.c +++ b/usr.sbin/tcpdump/print-ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ip6.c,v 1.29 2019/09/19 23:23:58 dlg Exp $ */ +/* $OpenBSD: print-ip6.c,v 1.30 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 @@ -93,19 +93,19 @@ ip6_print(const u_char *bp, u_int length) } if (length < sizeof (struct ip6_hdr)) { - (void)printf("truncated-ip6 %d", length); + printf("truncated-ip6 %d", length); goto out; } if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { - (void)printf("bad-ip6-version %u", ip6->ip6_vfc >> 4); + printf("bad-ip6-version %u", ip6->ip6_vfc >> 4); goto out; } hlen = sizeof(struct ip6_hdr); len = ntohs(ip6->ip6_plen); if (length < len + hlen) - (void)printf("truncated-ip6 - %d bytes missing!", - len + hlen - length); + printf("truncated-ip6 - %d bytes missing!", + len + hlen - length); cp = (const u_char *)ip6; nh = ip6->ip6_nxt; @@ -119,8 +119,8 @@ ip6_print(const u_char *bp, u_int length) nh != IPPROTO_TCP && nh != IPPROTO_UDP && nh != IPPROTO_AH && (vflag || (nh != IPPROTO_IPV4 && nh != IPPROTO_IPV6))) { - (void)printf("%s > %s: ", ip6addr_string(&ip6->ip6_src), - ip6addr_string(&ip6->ip6_dst)); + printf("%s > %s: ", ip6addr_string(&ip6->ip6_src), + ip6addr_string(&ip6->ip6_dst)); } switch (nh) { @@ -163,7 +163,7 @@ ip6_print(const u_char *bp, u_int length) (const u_char *)ip6); goto end; case IPPROTO_PIM: - (void)printf("PIM"); + printf("PIM"); pim_print(cp, len); goto end; #ifndef IPPROTO_OSPF @@ -191,7 +191,7 @@ ip6_print(const u_char *bp, u_int length) goto end; case IPPROTO_NONE: - (void)printf("no next header"); + printf("no next header"); goto end; #ifndef IPPROTO_ETHERIP @@ -212,7 +212,7 @@ ip6_print(const u_char *bp, u_int length) break; default: - (void)printf("ip-proto-%d %d", ip6->ip6_nxt, len); + printf("ip-proto-%d %d", ip6->ip6_nxt, len); goto end; } if (hlen == 0) @@ -223,18 +223,18 @@ ip6_print(const u_char *bp, u_int length) flow = ntohl(ip6->ip6_flow); if (flow & 0x0ff00000) - (void)printf(" [class 0x%x]", (flow & 0x0ff00000) >> 20); + printf(" [class 0x%x]", (flow & 0x0ff00000) >> 20); if (flow & 0x000fffff) - (void)printf(" [flowlabel 0x%x]", flow & 0x000fffff); + printf(" [flowlabel 0x%x]", flow & 0x000fffff); if (ip6->ip6_hlim <= 1) - (void)printf(" [hlim %d]", (int)ip6->ip6_hlim); + printf(" [hlim %d]", (int)ip6->ip6_hlim); if (vflag) { printf(" ("); - (void)printf("len %d", len); + printf("len %d", len); if (ip6->ip6_hlim > 1) - (void)printf(", hlim %d", (int)ip6->ip6_hlim); + printf(", hlim %d", (int)ip6->ip6_hlim); printf(")"); } diff --git a/usr.sbin/tcpdump/print-ip6opts.c b/usr.sbin/tcpdump/print-ip6opts.c index 36036cfc365..8fbb0c04cc6 100644 --- a/usr.sbin/tcpdump/print-ip6opts.c +++ b/usr.sbin/tcpdump/print-ip6opts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ip6opts.c,v 1.6 2018/10/22 16:12:45 kn Exp $ */ +/* $OpenBSD: print-ip6opts.c,v 1.7 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -122,7 +122,7 @@ hbhopt_print(const u_char *bp) return(hbhlen); trunc: - fputs("[|HBH]", stdout); + printf("[|HBH]"); return(hbhlen); } @@ -147,6 +147,6 @@ dstopt_print(const u_char *bp) return(dstoptlen); trunc: - fputs("[|DSTOPT]", stdout); + printf("[|DSTOPT]"); return(dstoptlen); } diff --git a/usr.sbin/tcpdump/print-ipsec.c b/usr.sbin/tcpdump/print-ipsec.c index cee2fcaaed5..9a016309133 100644 --- a/usr.sbin/tcpdump/print-ipsec.c +++ b/usr.sbin/tcpdump/print-ipsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ipsec.c,v 1.25 2018/10/22 16:12:45 kn Exp $ */ +/* $OpenBSD: print-ipsec.c,v 1.26 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 @@ -251,12 +251,12 @@ ah_print (const u_char *bp, u_int len, const u_char *bp2) ntohl(ah->ah_spi), ntohl(ah->ah_seq), len); if (vflag) { - (void)printf(" [ "); + printf(" [ "); pl_len = (ah->ah_pl_len + 2) << 2; /* RFC2402, sec 2.2 */ if (len <= pl_len) { - (void)printf("truncated"); + printf("truncated"); goto out; } @@ -297,11 +297,11 @@ ah_print (const u_char *bp, u_int len, const u_char *bp2) break; default: - (void)printf("ip-proto-%d len %d", ah->ah_nxt_hdr, - len - pl_len); + printf("ip-proto-%d len %d", + ah->ah_nxt_hdr, len - pl_len); } out: - (void)printf(" ]"); + printf(" ]"); } } @@ -322,7 +322,8 @@ ipcomp_print (const u_char *bp, u_int len, const u_char *bp2) ip = (const struct ip *)bp2; printf("ipcomp %s > %s", - ipaddr_string(&ip->ip_src), ipaddr_string(&ip->ip_dst)); + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); if (plen < sizeof(struct ipcomp_hdr)) { printf("[|ipcomp]"); diff --git a/usr.sbin/tcpdump/print-ipx.c b/usr.sbin/tcpdump/print-ipx.c index 2a9f80449e7..92727d826f7 100644 --- a/usr.sbin/tcpdump/print-ipx.c +++ b/usr.sbin/tcpdump/print-ipx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ipx.c,v 1.15 2015/11/16 00:16:39 mmcc Exp $ */ +/* $OpenBSD: print-ipx.c,v 1.16 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1994, 1995, 1996 @@ -58,13 +58,13 @@ ipx_print(const u_char *p, u_int length) const struct ipxHdr *ipx = (const struct ipxHdr *)p; TCHECK(ipx->srcSkt); - (void)printf("%s.%x > ", - ipxaddr_string(EXTRACT_32BITS(ipx->srcNet), ipx->srcNode), - EXTRACT_16BITS(&ipx->srcSkt)); + printf("%s.%x > ", + ipxaddr_string(EXTRACT_32BITS(ipx->srcNet), ipx->srcNode), + EXTRACT_16BITS(&ipx->srcSkt)); - (void)printf("%s.%x:", - ipxaddr_string(EXTRACT_32BITS(ipx->dstNet), ipx->dstNode), - EXTRACT_16BITS(&ipx->dstSkt)); + printf("%s.%x:", + ipxaddr_string(EXTRACT_32BITS(ipx->dstNet), ipx->dstNode), + EXTRACT_16BITS(&ipx->dstSkt)); /* take length from ipx header */ TCHECK(ipx->length); @@ -95,7 +95,7 @@ ipx_decode(const struct ipxHdr *ipx, const u_char *datap, u_int length) dstSkt = EXTRACT_16BITS(&ipx->dstSkt); switch (dstSkt) { case IPX_SKT_NCP: - (void)printf(" ipx-ncp %d", length); + printf(" ipx-ncp %d", length); break; case IPX_SKT_SAP: ipx_sap_print((u_short *)datap, length); @@ -104,13 +104,13 @@ ipx_decode(const struct ipxHdr *ipx, const u_char *datap, u_int length) ipx_rip_print((u_short *)datap, length); break; case IPX_SKT_NETBIOS: - (void)printf(" ipx-netbios %d", length); + printf(" ipx-netbios %d", length); break; case IPX_SKT_DIAGNOSTICS: - (void)printf(" ipx-diags %d", length); + printf(" ipx-diags %d", length); break; default: - (void)printf(" ipx-#%x %d", dstSkt, length); + printf(" ipx-#%x %d", dstSkt, length); break; } } @@ -129,13 +129,13 @@ ipx_sap_print(const u_short *ipx, u_int length) case 1: case 3: if (command == 1) - (void)printf("ipx-sap-req"); + printf("ipx-sap-req"); else - (void)printf("ipx-sap-nearest-req"); + printf("ipx-sap-nearest-req"); if (length > 0) { TCHECK(ipx[1]); - (void)printf(" %x '", EXTRACT_16BITS(&ipx[0])); + printf(" %x '", EXTRACT_16BITS(&ipx[0])); fn_print((u_char *)&ipx[1], min(snapend, (u_char *)&ipx[1] + 48)); putchar('\''); } @@ -144,13 +144,13 @@ ipx_sap_print(const u_short *ipx, u_int length) case 2: case 4: if (command == 2) - (void)printf("ipx-sap-resp"); + printf("ipx-sap-resp"); else - (void)printf("ipx-sap-nearest-resp"); + printf("ipx-sap-nearest-resp"); for (i = 0; i < 8 && length > 0; i++) { TCHECK2(ipx[27], 1); - (void)printf(" %x '", EXTRACT_16BITS(&ipx[0])); + printf(" %x '", EXTRACT_16BITS(&ipx[0])); fn_print((u_char *)&ipx[1], min(snapend, (u_char *)&ipx[1] + 48)); printf("' addr %s", ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (u_char *)&ipx[27])); @@ -159,7 +159,7 @@ ipx_sap_print(const u_short *ipx, u_int length) } break; default: - (void)printf("ipx-sap-?%x", command); + printf("ipx-sap-?%x", command); break; } return; @@ -179,26 +179,26 @@ ipx_rip_print(const u_short *ipx, u_int length) switch (command) { case 1: - (void)printf("ipx-rip-req"); + printf("ipx-rip-req"); if (length > 0) { TCHECK(ipx[3]); - (void)printf(" %u/%d.%d", EXTRACT_32BITS(&ipx[0]), - EXTRACT_16BITS(&ipx[2]), EXTRACT_16BITS(&ipx[3])); + printf(" %u/%d.%d", EXTRACT_32BITS(&ipx[0]), + EXTRACT_16BITS(&ipx[2]), EXTRACT_16BITS(&ipx[3])); } break; case 2: - (void)printf("ipx-rip-resp"); + printf("ipx-rip-resp"); for (i = 0; i < 50 && length > 0; i++) { TCHECK(ipx[3]); - (void)printf(" %u/%d.%d", EXTRACT_32BITS(&ipx[0]), - EXTRACT_16BITS(&ipx[2]), EXTRACT_16BITS(&ipx[3])); + printf(" %u/%d.%d", EXTRACT_32BITS(&ipx[0]), + EXTRACT_16BITS(&ipx[2]), EXTRACT_16BITS(&ipx[3])); ipx += 4; length -= 8; } break; default: - (void)printf("ipx-rip-?%x", command); + printf("ipx-rip-?%x", command); } return; trunc: diff --git a/usr.sbin/tcpdump/print-isoclns.c b/usr.sbin/tcpdump/print-isoclns.c index 352508644d5..6ba8e4eb704 100644 --- a/usr.sbin/tcpdump/print-isoclns.c +++ b/usr.sbin/tcpdump/print-isoclns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-isoclns.c,v 1.13 2015/11/16 00:16:39 mmcc Exp $ */ +/* $OpenBSD: print-isoclns.c,v 1.14 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995, 1996 @@ -56,8 +56,8 @@ isoclns_print(const u_char *p, u_int length, u_int caplen, printf("[|iso-clns] "); if (!eflag) printf("%s > %s", - etheraddr_string(esrc), - etheraddr_string(edst)); + etheraddr_string(esrc), + etheraddr_string(edst)); return; } @@ -67,28 +67,28 @@ isoclns_print(const u_char *p, u_int length, u_int caplen, /* esis_print(&p, &length); */ printf("iso-clns"); if (!eflag) - (void)printf(" %s > %s", - etheraddr_string(esrc), - etheraddr_string(edst)); + printf(" %s > %s", + etheraddr_string(esrc), + etheraddr_string(edst)); break; case ESIS: printf("iso-esis"); if (!eflag) - (void)printf(" %s > %s", - etheraddr_string(esrc), - etheraddr_string(edst)); + printf(" %s > %s", + etheraddr_string(esrc), + etheraddr_string(edst)); esis_print(p, length); return; case ISIS: printf("iso-isis"); if (!eflag) - (void)printf(" %s > %s", - etheraddr_string(esrc), - etheraddr_string(edst)); + printf(" %s > %s", + etheraddr_string(esrc), + etheraddr_string(edst)); /* isis_print(&p, &length); */ - (void)printf(" len=%d ", length); + printf(" len=%d ", length); if (caplen > 1) default_print_unaligned(p, caplen); break; @@ -96,18 +96,18 @@ isoclns_print(const u_char *p, u_int length, u_int caplen, case NULLNS: printf("iso-nullns"); if (!eflag) - (void)printf(" %s > %s", - etheraddr_string(esrc), - etheraddr_string(edst)); + printf(" %s > %s", + etheraddr_string(esrc), + etheraddr_string(edst)); break; default: printf("iso-clns %02x", p[0]); if (!eflag) - (void)printf(" %s > %s", - etheraddr_string(esrc), - etheraddr_string(edst)); - (void)printf(" len=%d ", length); + printf(" %s > %s", + etheraddr_string(esrc), + etheraddr_string(edst)); + printf(" len=%d ", length); if (caplen > 1) default_print_unaligned(p, caplen); break; @@ -182,7 +182,7 @@ esis_print(const u_char *p, u_int length) off[1] = eh->cksum[1]; if (vflag && osi_cksum(p, li, eh->cksum, cksum, off)) { printf(" bad cksum (got %02x%02x want %02x%02x)", - eh->cksum[1], eh->cksum[0], cksum[1], cksum[0]); + eh->cksum[1], eh->cksum[0], cksum[1], cksum[0]); return; } if (eh->version != 1) { @@ -252,7 +252,7 @@ esis_print(const u_char *p, u_int length) } default: - (void)printf(" len=%d", length); + printf(" len=%d", length); if (length && p < snapend) { length = snapend - p; default_print(p, length); diff --git a/usr.sbin/tcpdump/print-krb.c b/usr.sbin/tcpdump/print-krb.c index 477814e04b4..50d37623d9c 100644 --- a/usr.sbin/tcpdump/print-krb.c +++ b/usr.sbin/tcpdump/print-krb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-krb.c,v 1.12 2018/07/06 05:47:22 dlg Exp $ */ +/* $OpenBSD: print-krb.c,v 1.13 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1995, 1996, 1997 @@ -166,7 +166,7 @@ krb4_print_hdr(const u_char *cp) return(cp); trunc: - fputs(tstr, stdout); + printf("%s", tstr); return (NULL); #undef PRINT @@ -187,7 +187,7 @@ krb4_print(const u_char *cp) kp = (struct krb *)cp; if ((&kp->type) >= snapend) { - fputs(tstr, stdout); + printf("%s", tstr); return; } @@ -245,13 +245,13 @@ krb4_print(const u_char *cp) break; default: - fputs("(unknown)", stdout); + printf("(unknown)"); break; } return; trunc: - fputs(tstr, stdout); + printf("%s", tstr); } void @@ -262,7 +262,7 @@ krb_print(const u_char *dat, u_int length) kp = (struct krb *)dat; if (dat >= snapend) { - fputs(tstr, stdout); + printf("%s", tstr); return; } @@ -281,7 +281,7 @@ krb_print(const u_char *dat, u_int length) case 106: case 107: - fputs("v5", stdout); + printf("v5"); /* Decode ASN.1 here "someday" */ break; } diff --git a/usr.sbin/tcpdump/print-llc.c b/usr.sbin/tcpdump/print-llc.c index a18e859930e..14829688033 100644 --- a/usr.sbin/tcpdump/print-llc.c +++ b/usr.sbin/tcpdump/print-llc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-llc.c,v 1.21 2019/04/05 00:57:59 dlg Exp $ */ +/* $OpenBSD: print-llc.c,v 1.22 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997 @@ -68,7 +68,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, int ret; if (caplen < 3) { - (void)printf("[|llc]"); + printf("[|llc]"); default_print((u_char *)p, caplen); return(0); } @@ -93,7 +93,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, if (llc.ssap == LLCSAP_SNAP && llc.dsap == LLCSAP_SNAP && llc.llcui == LLC_UI) { if (caplen < sizeof(llc)) { - (void)printf("[|llc-snap]"); + printf("[|llc-snap]"); default_print((u_char *)p, caplen); return (0); } @@ -110,7 +110,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, } if (vflag) - (void)printf("snap %s ", protoid_string(llc.llcpi)); + printf("snap %s ", protoid_string(llc.llcpi)); caplen -= sizeof(llc); length -= sizeof(llc); @@ -185,23 +185,23 @@ llc_print(const u_char *p, u_int length, u_int caplen, if ((llc.ssap & ~LLC_GSAP) == llc.dsap) { if (eflag) - (void)printf("%s ", llcsap_string(llc.dsap)); + printf("%s ", llcsap_string(llc.dsap)); else - (void)printf("%s > %s %s ", - etheraddr_string(esrc), - etheraddr_string(edst), - llcsap_string(llc.dsap)); + printf("%s > %s %s ", + etheraddr_string(esrc), + etheraddr_string(edst), + llcsap_string(llc.dsap)); } else { if (eflag) - (void)printf("%s > %s ", - llcsap_string(llc.ssap & ~LLC_GSAP), - llcsap_string(llc.dsap)); + printf("%s > %s ", + llcsap_string(llc.ssap & ~LLC_GSAP), + llcsap_string(llc.dsap)); else - (void)printf("%s %s > %s %s ", - etheraddr_string(esrc), - llcsap_string(llc.ssap & ~LLC_GSAP), - etheraddr_string(edst), - llcsap_string(llc.dsap)); + printf("%s %s > %s %s ", + etheraddr_string(esrc), + llcsap_string(llc.ssap & ~LLC_GSAP), + etheraddr_string(edst), + llcsap_string(llc.dsap)); } if ((llc.llcu & LLC_U_FMT) == LLC_U_FMT) { @@ -262,20 +262,20 @@ llc_print(const u_char *p, u_int length, u_int caplen, if ((llc.llcu & LLC_S_FMT) == LLC_S_FMT) { static char *llc_s[] = { "rr", "rej", "rnr", "03" }; - (void)printf("%s (r=%d,%c)", - llc_s[LLC_S_CMD(llc.llcis)], - LLC_IS_NR(llc.llcis), - f); + printf("%s (r=%d,%c)", + llc_s[LLC_S_CMD(llc.llcis)], + LLC_IS_NR(llc.llcis), + f); } else { - (void)printf("I (s=%d,r=%d,%c)", - LLC_I_NS(llc.llcis), - LLC_IS_NR(llc.llcis), - f); + printf("I (s=%d,r=%d,%c)", + LLC_I_NS(llc.llcis), + LLC_IS_NR(llc.llcis), + f); } p += 4; length -= 4; caplen -= 4; } - (void)printf(" len=%d", length); + printf(" len=%d", length); return(1); } diff --git a/usr.sbin/tcpdump/print-mobile.c b/usr.sbin/tcpdump/print-mobile.c index 867b737f324..d7056f1df93 100644 --- a/usr.sbin/tcpdump/print-mobile.c +++ b/usr.sbin/tcpdump/print-mobile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-mobile.c,v 1.5 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: print-mobile.c,v 1.6 2020/01/24 22:46:37 procter Exp $ */ /* $NetBSD: print-mobile.c,v 1.3 1999/07/26 06:11:57 itojun Exp $ */ /* @@ -71,7 +71,7 @@ mobile_print(const u_char *bp, u_int length) mob = (const struct mobile_ip *)bp; if (length < MOBILE_SIZE) { - fputs("[|mobile]", stdout); + printf("[|mobile]"); return; } @@ -83,18 +83,18 @@ mobile_print(const u_char *bp, u_int length) } if (osp) { - fputs("[S] ",stdout); + printf("[S] "); if (vflag) - (void)printf("%s ",ipaddr_string(&mob->osrc)); + printf("%s ",ipaddr_string(&mob->osrc)); } else { - fputs("[] ",stdout); + printf("[] "); } if (vflag) { - (void)printf("> %s ",ipaddr_string(&mob->odst)); - (void)printf("(oproto=%d)",proto>>8); + printf("> %s ",ipaddr_string(&mob->odst)); + printf("(oproto=%d)",proto>>8); } if (mob_in_cksum((u_short *)mob, osp ? 12 : 8)!=0) { - (void)printf(" (bad checksum %d)",crc); + printf(" (bad checksum %d)",crc); } return; diff --git a/usr.sbin/tcpdump/print-nfs.c b/usr.sbin/tcpdump/print-nfs.c index 774144ddefe..833bb6fa2d7 100644 --- a/usr.sbin/tcpdump/print-nfs.c +++ b/usr.sbin/tcpdump/print-nfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-nfs.c,v 1.23 2018/10/22 16:12:45 kn Exp $ */ +/* $OpenBSD: print-nfs.c,v 1.24 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -541,7 +541,7 @@ nfsreq_print(const u_char *bp, u_int length, const u_char *bp2) printf(" symlink"); if ((dp = parsereq(rp, length)) != 0 && (dp = parsefhn(dp, v3)) != 0) { - fputs(" ->", stdout); + printf(" ->"); if (v3 && (dp = parse_sattr3(dp, &sa3)) == 0) break; if (parsefn(dp) == 0) @@ -592,7 +592,7 @@ nfsreq_print(const u_char *bp, u_int length, const u_char *bp2) printf(" rename"); if ((dp = parsereq(rp, length)) != NULL && (dp = parsefhn(dp, v3)) != NULL) { - fputs(" ->", stdout); + printf(" ->"); if (parsefhn(dp, v3) != NULL) return; } @@ -602,7 +602,7 @@ nfsreq_print(const u_char *bp, u_int length, const u_char *bp2) printf(" link"); if ((dp = parsereq(rp, length)) != NULL && (dp = parsefh(dp, v3)) != NULL) { - fputs(" ->", stdout); + printf(" ->"); if (parsefhn(dp, v3) != NULL) return; } @@ -697,7 +697,7 @@ nfsreq_print(const u_char *bp, u_int length, const u_char *bp2) trunc: if (!nfserr) - fputs(" [|nfs]", stdout); + printf(" [|nfs]"); } /* @@ -729,9 +729,9 @@ nfs_printfh(const u_int32_t *dp, const u_int len) if (sfsname) *sfsname = 0; - (void)printf(" fh %s/%u", temp, (u_int32_t)ino); + printf(" fh %s/%u", temp, (u_int32_t)ino); } else { - (void)printf(" fh %u,%u/%u", + printf(" fh %u,%u/%u", fsid.Fsid_dev.Major, fsid.Fsid_dev.Minor, (u_int32_t)ino); } } @@ -1676,5 +1676,5 @@ interp_reply(const struct rpc_msg *rp, u_int32_t proc, u_int32_t vers, int lengt } trunc: if (!nfserr) - fputs(" [|nfs]", stdout); + printf(" [|nfs]"); } diff --git a/usr.sbin/tcpdump/print-ntp.c b/usr.sbin/tcpdump/print-ntp.c index f45f1a64ce3..ef3190b2843 100644 --- a/usr.sbin/tcpdump/print-ntp.c +++ b/usr.sbin/tcpdump/print-ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ntp.c,v 1.18 2018/07/06 05:47:22 dlg Exp $ */ +/* $OpenBSD: print-ntp.c,v 1.19 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -62,7 +62,7 @@ ntp_print(const u_char *cp, u_int length) bp = (struct ntpdata *)cp; /* Note funny sized packets */ if (length != sizeof(struct ntpdata)) - (void)printf(" [len=%d]", length); + printf(" [len=%d]", length); TCHECK(bp->status); @@ -76,15 +76,15 @@ ntp_print(const u_char *cp, u_int length) break; case ALARM: - fputs(" alarm", stdout); + printf(" alarm"); break; case PLUS_SEC: - fputs(" +1s", stdout); + printf(" +1s"); break; case MINUS_SEC: - fputs(" -1s", stdout); + printf(" -1s"); break; } @@ -92,35 +92,35 @@ ntp_print(const u_char *cp, u_int length) switch (mode) { case MODE_UNSPEC: /* unspecified */ - fputs(" unspec", stdout); + printf(" unspec"); break; case MODE_SYM_ACT: /* symmetric active */ - fputs(" sym_act", stdout); + printf(" sym_act"); break; case MODE_SYM_PAS: /* symmetric passive */ - fputs(" sym_pas", stdout); + printf(" sym_pas"); break; case MODE_CLIENT: /* client */ - fputs(" client", stdout); + printf(" client"); break; case MODE_SERVER: /* server */ - fputs(" server", stdout); + printf(" server"); break; case MODE_BROADCAST: /* broadcast */ - fputs(" bcast", stdout); + printf(" bcast"); break; case MODE_RES1: /* reserved */ - fputs(" res1", stdout); + printf(" res1"); break; case MODE_RES2: /* reserved */ - fputs(" res2", stdout); + printf(" res2"); break; } @@ -139,15 +139,15 @@ ntp_print(const u_char *cp, u_int length) return; TCHECK(bp->distance); - fputs(" dist ", stdout); + printf(" dist "); p_sfix(&bp->distance); TCHECK(bp->dispersion); - fputs(" disp ", stdout); + printf(" disp "); p_sfix(&bp->dispersion); TCHECK(bp->refid); - fputs(" ref ", stdout); + printf(" ref "); /* Interpretation depends on stratum */ switch (bp->stratum) { @@ -179,21 +179,21 @@ ntp_print(const u_char *cp, u_int length) p_ntp_time(&(bp->reftime)); TCHECK(bp->org); - fputs(" orig ", stdout); + printf(" orig "); p_ntp_time(&(bp->org)); TCHECK(bp->rec); - fputs(" rec ", stdout); + printf(" rec "); p_ntp_delta(&(bp->org), &(bp->rec)); TCHECK(bp->xmt); - fputs(" xmt ", stdout); + printf(" xmt "); p_ntp_delta(&(bp->org), &(bp->xmt)); return; trunc: - fputs(" [|ntp]", stdout); + printf(" [|ntp]"); } static void diff --git a/usr.sbin/tcpdump/print-ospf.c b/usr.sbin/tcpdump/print-ospf.c index 28b0716aeba..43068928a56 100644 --- a/usr.sbin/tcpdump/print-ospf.c +++ b/usr.sbin/tcpdump/print-ospf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ospf.c,v 1.21 2019/04/14 00:37:31 dlg Exp $ */ +/* $OpenBSD: print-ospf.c,v 1.22 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997 @@ -348,10 +348,10 @@ ospf_print_lsa(const struct lsa *lsap) } /* { (ctags) */ - fputs(" }", stdout); + printf(" }"); return (0); trunc: - fputs(" }", stdout); + printf(" }"); return (1); } @@ -501,7 +501,7 @@ ospf_print(const u_char *bp, u_int length, const u_char *bp2) op = (struct ospfhdr *)bp; ip = (struct ip *)bp2; /* Print the source and destination address */ - (void) printf("%s > %s:", + printf("%s > %s:", ipaddr_string(&ip->ip_src), ipaddr_string(&ip->ip_dst)); @@ -591,5 +591,5 @@ ospf_print(const u_char *bp, u_int length, const u_char *bp2) return; trunc: - fputs(tstr, stdout); + printf("%s", tstr); } diff --git a/usr.sbin/tcpdump/print-ospf6.c b/usr.sbin/tcpdump/print-ospf6.c index a683c01b0e1..9465c1378b6 100644 --- a/usr.sbin/tcpdump/print-ospf6.c +++ b/usr.sbin/tcpdump/print-ospf6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ospf6.c,v 1.10 2018/10/22 16:12:45 kn Exp $ */ +/* $OpenBSD: print-ospf6.c,v 1.11 2020/01/24 22:46:37 procter Exp $ */ /* @@ -458,10 +458,10 @@ ospf6_print_lsa(const struct lsa *lsap) } /* { (ctags) */ - fputs(" }", stdout); + printf(" }"); return (0); trunc: - fputs(" }", stdout); + printf(" }"); return (1); } @@ -653,5 +653,5 @@ ospf6_print(const u_char *bp, u_int length) return; trunc: - fputs(tstr, stdout); + printf("%s", tstr); } diff --git a/usr.sbin/tcpdump/print-pim.c b/usr.sbin/tcpdump/print-pim.c index 27d1cae6794..59e051270a0 100644 --- a/usr.sbin/tcpdump/print-pim.c +++ b/usr.sbin/tcpdump/print-pim.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-pim.c,v 1.8 2015/11/16 00:16:39 mmcc Exp $ */ +/* $OpenBSD: print-pim.c,v 1.9 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1995, 1996 @@ -52,43 +52,43 @@ pim_print(const u_char *bp, u_int len) switch (type) { case 0: - (void)printf(" Query"); + printf(" Query"); break; case 1: - (void)printf(" Register"); + printf(" Register"); break; case 2: - (void)printf(" Register-Stop"); + printf(" Register-Stop"); break; case 3: - (void)printf(" Join/Prune"); + printf(" Join/Prune"); break; case 4: - (void)printf(" RP-reachable"); + printf(" RP-reachable"); break; case 5: - (void)printf(" Assert"); + printf(" Assert"); break; case 6: - (void)printf(" Graft"); + printf(" Graft"); break; case 7: - (void)printf(" Graft-ACK"); + printf(" Graft-ACK"); break; case 8: - (void)printf(" Mode"); + printf(" Mode"); break; default: - (void)printf(" [type %d]", type); + printf(" [type %d]", type); break; } } diff --git a/usr.sbin/tcpdump/print-ppp.c b/usr.sbin/tcpdump/print-ppp.c index 78edc46a073..21f5d154847 100644 --- a/usr.sbin/tcpdump/print-ppp.c +++ b/usr.sbin/tcpdump/print-ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ppp.c,v 1.33 2019/04/05 00:57:59 dlg Exp $ */ +/* $OpenBSD: print-ppp.c,v 1.34 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 @@ -1224,7 +1224,7 @@ ppp_ether_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) } if (length < pppoe_len) { - (void)printf(" truncated-pppoe - %d bytes missing!", + printf(" truncated-pppoe - %d bytes missing!", pppoe_len - length); pppoe_len = length; } @@ -1285,7 +1285,7 @@ pppoe_if_print(u_short ethertype, const u_char *p, u_int length, u_int l) length -= sizeof(struct pppoe_header); if (length < pppoe_len) { - (void)printf(" truncated-pppoe - %d bytes missing!", + printf(" truncated-pppoe - %d bytes missing!", pppoe_len - length); pppoe_len = length; } diff --git a/usr.sbin/tcpdump/print-radius.c b/usr.sbin/tcpdump/print-radius.c index a89bae3702b..47887f87159 100644 --- a/usr.sbin/tcpdump/print-radius.c +++ b/usr.sbin/tcpdump/print-radius.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-radius.c,v 1.12 2018/07/06 05:47:22 dlg Exp $ */ +/* $OpenBSD: print-radius.c,v 1.13 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1997 Thomas H. Ptacek. All rights reserved. @@ -160,15 +160,15 @@ static void r_print_att(int code, int len, const u_char *data) { if(atp->code == -1) { if(vflag > 1) { - fprintf(stdout, " %d =", code); + printf(" %d =", code); atselector[RD_HEX](code, len, data); } else - fprintf(stdout, " %d", code); + printf(" %d", code); return; } - fprintf(stdout, " %s =", atp->name); + printf(" %s =", atp->name); if(atp->encoding == RD_INT && *atp->values) { u_int32_t k = ntohl((*(int *)data)); @@ -177,7 +177,7 @@ static void r_print_att(int code, int len, const u_char *data) { /* SHOOT ME */ ; if(k < i) { - fprintf(stdout, " %s", + printf(" %s", atp->values[k]); return; } @@ -188,27 +188,27 @@ static void r_print_att(int code, int len, const u_char *data) { static void r_print_int(int code, int len, const u_char *data) { if(len < 4) { - fputs(" ?", stdout); + printf(" ?"); return; } - fprintf(stdout, " %d", ntohl((*(int *)data))); + printf(" %d", ntohl((*(int *)data))); } static void r_print_address(int code, int len, const u_char *data) { if(len < 4) { - fputs(" ?", stdout); + printf(" ?"); return; } - fprintf(stdout, " %s", inet_ntoa((*(struct in_addr *)data))); + printf(" %s", inet_ntoa((*(struct in_addr *)data))); } static void r_print_string(int code, int len, const u_char *data) { char string[128]; if(!len) { - fputs(" ?", stdout); + printf(" ?"); return; } @@ -218,7 +218,7 @@ static void r_print_string(int code, int len, const u_char *data) { memset(string, 0, 128); memcpy(string, data, len); - fprintf(stdout, " "); + printf(" "); safeputs(string); } @@ -227,10 +227,10 @@ static void r_print_hex(int code, int len, const u_char *data) { /* excuse me */ - fputs(" [", stdout); + printf(" ["); for(i = 0; i < len; i++) - fprintf(stdout, "%02x", data[i]); + printf("%02x", data[i]); fputc(']', stdout); } @@ -241,7 +241,7 @@ void radius_print(const u_char *data, u_int len) { int first, l, ac, al; if(len < sizeof(struct radius_header)) { - fputs("[|radius]", stdout); + printf("[|radius]"); return; } @@ -249,15 +249,15 @@ void radius_print(const u_char *data, u_int len) { if(rhp->code > DEFINED_OPCODES || rhp->code < 1) - fprintf(stdout, "Code:%d id:%x [%d]", + printf("Code:%d id:%x [%d]", rhp->code, rhp->id, ntohs(rhp->len)); else - fprintf(stdout, "%s id:%x [%d]", + printf("%s id:%x [%d]", radius_codes[rhp->code].name, rhp->id, ntohs(rhp->len)); if(ntohs(rhp->len) > len) { - fputs("[|radius]", stdout); + printf("[|radius]"); return; } @@ -278,7 +278,7 @@ void radius_print(const u_char *data, u_int len) { al = *pp++; if(al > l || al < 2) { - fputs(" [|radius]", stdout); + printf(" [|radius]"); return; } diff --git a/usr.sbin/tcpdump/print-rip.c b/usr.sbin/tcpdump/print-rip.c index 4b77c14ecb8..601388e20fe 100644 --- a/usr.sbin/tcpdump/print-rip.c +++ b/usr.sbin/tcpdump/print-rip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-rip.c,v 1.17 2018/07/06 05:47:22 dlg Exp $ */ +/* $OpenBSD: print-rip.c,v 1.18 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1989, 1990, 1991, 1993, 1994, 1996 @@ -197,7 +197,7 @@ rip_print(const u_char *dat, u_int length) case RIPCMD_TRACEON: printf("RIPv%d-traceon %d: \"", rp->rip_vers, length); (void)fn_print((const u_char *)(rp + 1), snapend); - fputs("\"", stdout); + printf("\""); break; case RIPCMD_TRACEOFF: printf("RIPv%d-traceoff %d", rp->rip_vers, length); diff --git a/usr.sbin/tcpdump/print-rt6.c b/usr.sbin/tcpdump/print-rt6.c index 5f293811c8a..6300065d3b2 100644 --- a/usr.sbin/tcpdump/print-rt6.c +++ b/usr.sbin/tcpdump/print-rt6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-rt6.c,v 1.7 2018/10/22 16:12:45 kn Exp $ */ +/* $OpenBSD: print-rt6.c,v 1.8 2020/01/24 22:46:37 procter Exp $ */ /* @@ -104,6 +104,6 @@ rt6_print(const u_char *bp, const u_char *bp2) } trunc: - fputs(", [|srcrt]", stdout); + printf(", [|srcrt]"); return 65535; /* XXX */ } diff --git a/usr.sbin/tcpdump/print-snmp.c b/usr.sbin/tcpdump/print-snmp.c index 78c918f187b..ef5a6250de5 100644 --- a/usr.sbin/tcpdump/print-snmp.c +++ b/usr.sbin/tcpdump/print-snmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-snmp.c,v 1.24 2019/01/03 08:22:33 martijn Exp $ */ +/* $OpenBSD: print-snmp.c,v 1.25 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 @@ -388,9 +388,9 @@ asn1_parse(const u_char *p, u_int len, struct be *elem) elem->type = BE_ANY; if (len < 1) { if (truncated) - fputs("[|snmp]", stdout); + printf("[|snmp]"); else - fputs("[nothing to parse]", stdout); + printf("[nothing to parse]"); return -1; } @@ -425,9 +425,9 @@ asn1_parse(const u_char *p, u_int len, struct be *elem) } if (len == 0 && *p & ASN_BIT8) { if (truncated) - fputs("[|snmp]", stdout); + printf("[|snmp]"); else - fputs("[Xtagfield?]", stdout); + printf("[Xtagfield?]"); return -1; } elem->id = id = (id << 7) | *p; @@ -437,9 +437,9 @@ asn1_parse(const u_char *p, u_int len, struct be *elem) } if (len < 1) { if (truncated) - fputs("[|snmp]", stdout); + printf("[|snmp]"); else - fputs("[no asnlen]", stdout); + printf("[no asnlen]"); return -1; } elem->asnlen = *p; @@ -451,7 +451,7 @@ asn1_parse(const u_char *p, u_int len, struct be *elem) elem->asnlen = 0; if (len < noct) { if (truncated) - fputs("[|snmp]", stdout); + printf("[|snmp]"); else printf("[asnlen? %d<%d]", len, noct); return -1; @@ -472,21 +472,21 @@ asn1_parse(const u_char *p, u_int len, struct be *elem) } if (form >= sizeof(Form)/sizeof(Form[0])) { if (truncated) - fputs("[|snmp]", stdout); + printf("[|snmp]"); else printf("[form?%d]", form); return -1; } if (class >= sizeof(Class)/sizeof(Class[0])) { if (truncated) - fputs("[|snmp]", stdout); + printf("[|snmp]"); else printf("[class?%c/%d]", *Form[form], class); return -1; } if ((int)id >= Class[class].numIDs) { if (truncated) - fputs("[|snmp]", stdout); + printf("[|snmp]"); else printf("[id?%c/%s/%d]", *Form[form], Class[class].name, id); @@ -651,7 +651,7 @@ asn1_print(struct be *elem) objp = a->node->child; i -= strlen(a->oid); p += strlen(a->oid); - fputs(a->prefix, stdout); + printf("%s", a->prefix); first = 1; break; } @@ -725,10 +725,10 @@ asn1_print(struct be *elem) Class[CONTEXT].Id[elem->id], elem->asnlen); break; case BE_ANY: - fputs("[BE_ANY!?]", stdout); + printf("[BE_ANY!?]"); break; default: - fputs("[be!?]", stdout); + printf("[be!?]"); break; } } @@ -752,12 +752,12 @@ asn1_decode(u_char *p, u_int length) while (i >= 0 && length > 0) { i = asn1_parse(p, length, &elem); if (i >= 0) { - fputs(" ", stdout); + printf(" "); asn1_print(&elem); if (elem.type == BE_SEQ || elem.type == BE_PDU) { - fputs(" {", stdout); + printf(" {"); asn1_decode(elem.data.raw, elem.asnlen); - fputs(" }", stdout); + printf(" }"); } length -= i; p += i; @@ -812,7 +812,7 @@ varbind_print(u_char pduid, const u_char *np, u_int length, int error) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_SEQ) { - fputs("[!SEQ of varbind]", stdout); + printf("[!SEQ of varbind]"); asn1_print(&elem); return; } @@ -831,7 +831,7 @@ varbind_print(u_char pduid, const u_char *np, u_int length, int error) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_SEQ) { - fputs("[!varbind]", stdout); + printf("[!varbind]"); asn1_print(&elem); return; } @@ -845,7 +845,7 @@ varbind_print(u_char pduid, const u_char *np, u_int length, int error) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_OID) { - fputs("[objName!=OID]", stdout); + printf("[objName!=OID]"); asn1_print(&elem); return; } @@ -855,19 +855,19 @@ varbind_print(u_char pduid, const u_char *np, u_int length, int error) np += count; if (pduid != GETREQ && pduid != GETNEXTREQ && !error) - fputs("=", stdout); + printf("="); /* objVal (ANY) */ if ((count = asn1_parse(np, length, &elem)) < 0) return; if (pduid == GETREQ || pduid == GETNEXTREQ || pduid == GETBULKREQ) { if (elem.type != BE_NULL) { - fputs("[objVal!=NULL]", stdout); + printf("[objVal!=NULL]"); asn1_print(&elem); } } else { if (error && ind == error && elem.type != BE_NULL) - fputs("[err objVal!=NULL]", stdout); + printf("[err objVal!=NULL]"); if (!error || ind == error) asn1_print(&elem); } @@ -890,7 +890,7 @@ snmppdu_print(u_char pduid, const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_INT) { - fputs("[reqId!=INT]", stdout); + printf("[reqId!=INT]"); asn1_print(&elem); return; } @@ -903,7 +903,7 @@ snmppdu_print(u_char pduid, const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_INT) { - fputs("[errorStatus!=INT]", stdout); + printf("[errorStatus!=INT]"); asn1_print(&elem); return; } @@ -927,7 +927,7 @@ snmppdu_print(u_char pduid, const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_INT) { - fputs("[errorIndex!=INT]", stdout); + printf("[errorIndex!=INT]"); asn1_print(&elem); return; } @@ -945,7 +945,7 @@ snmppdu_print(u_char pduid, const u_char *np, u_int length) error = elem.data.integer; } } else if (error) { - fputs("[errorIndex==0]", stdout); + printf("[errorIndex==0]"); error = 0; } length -= count; @@ -970,7 +970,7 @@ trap_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_OID) { - fputs("[enterprise!=OID]", stdout); + printf("[enterprise!=OID]"); asn1_print(&elem); return; } @@ -984,7 +984,7 @@ trap_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_INETADDR) { - fputs("[agent-addr!=INETADDR]", stdout); + printf("[agent-addr!=INETADDR]"); asn1_print(&elem); return; } @@ -996,7 +996,7 @@ trap_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_INT) { - fputs("[generic-trap!=INT]", stdout); + printf("[generic-trap!=INT]"); asn1_print(&elem); return; } @@ -1012,7 +1012,7 @@ trap_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_INT) { - fputs("[specific-trap!=INT]", stdout); + printf("[specific-trap!=INT]"); asn1_print(&elem); return; } @@ -1030,7 +1030,7 @@ trap_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_UNS) { /* XXX */ - fputs("[time-stamp!=TIMETICKS]", stdout); + printf("[time-stamp!=TIMETICKS]"); asn1_print(&elem); return; } @@ -1055,7 +1055,7 @@ snmp12_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_STR) { - fputs("[comm!=STR]", stdout); + printf("[comm!=STR]"); asn1_print(&elem); return; } @@ -1071,7 +1071,7 @@ snmp12_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_PDU) { - fputs("[no PDU]", stdout); + printf("[no PDU]"); return; } if (count < length) @@ -1109,7 +1109,7 @@ snmp3_print_usmparams(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return -1; if (elem.type != BE_SEQ) { - fputs("[!usmSM SEQ]", stdout); + printf("[!usmSM SEQ]"); asn1_print(&elem); return -1; } @@ -1125,12 +1125,12 @@ snmp3_print_usmparams(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return -1; if (elem.type != BE_STR) { - fputs("[umsEID!=STR]", stdout); + printf("[umsEID!=STR]"); asn1_print(&elem); return -1; } if (vflag && elem.asnlen > 0) { - fputs("umsEID=0x", stdout); + printf("umsEID=0x"); for (i = 0; i < elem.asnlen; i++) printf("%02hhX", elem.data.str[i]); putchar(' '); @@ -1142,7 +1142,7 @@ snmp3_print_usmparams(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return -1; if (elem.type != BE_INT) { - fputs("[EBoots!=INT]", stdout); + printf("[EBoots!=INT]"); asn1_print(&elem); return -1; } @@ -1155,7 +1155,7 @@ snmp3_print_usmparams(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return -1; if (elem.type != BE_INT) { - fputs("[ETime!=INT]", stdout); + printf("[ETime!=INT]"); asn1_print(&elem); return -1; } @@ -1167,12 +1167,12 @@ snmp3_print_usmparams(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return -1; if (elem.type != BE_STR) { - fputs("[User!=STR]", stdout); + printf("[User!=STR]"); asn1_print(&elem); return -1; } if (elem.asnlen > 0) { - fputs("User=", stdout); + printf("User="); asn1_print(&elem); putchar(' '); } @@ -1183,7 +1183,7 @@ snmp3_print_usmparams(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return -1; if (elem.type != BE_STR) { - fputs("[AuthParam!=STR]", stdout); + printf("[AuthParam!=STR]"); asn1_print(&elem); return -1; } @@ -1195,7 +1195,7 @@ snmp3_print_usmparams(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return -1; if (elem.type != BE_STR) { - fputs("[PrivParam!=STR]", stdout); + printf("[PrivParam!=STR]"); asn1_print(&elem); return -1; } @@ -1222,7 +1222,7 @@ snmp3_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_SEQ) { - fputs("[!header SEQ]", stdout); + printf("[!header SEQ]"); asn1_print(&elem); return; } @@ -1235,7 +1235,7 @@ snmp3_print(const u_char *np, u_int length) if ((count = asn1_parse(subnp, sublen, &elem)) < 0) return; if (elem.type != BE_INT) { - fputs("[msgID!=INT]", stdout); + printf("[msgID!=INT]"); asn1_print(&elem); return; } @@ -1248,7 +1248,7 @@ snmp3_print(const u_char *np, u_int length) if ((count = asn1_parse(subnp, sublen, &elem)) < 0) return; if (elem.type != BE_INT) { - fputs("[msgMS!=INT]", stdout); + printf("[msgMS!=INT]"); asn1_print(&elem); return; } @@ -1261,7 +1261,7 @@ snmp3_print(const u_char *np, u_int length) if ((count = asn1_parse(subnp, sublen, &elem)) < 0) return; if (elem.type != BE_STR) { - fputs("[msgFl!=STR]", stdout); + printf("[msgFl!=STR]"); asn1_print(&elem); return; } @@ -1282,7 +1282,7 @@ snmp3_print(const u_char *np, u_int length) if ((count = asn1_parse(subnp, sublen, &elem)) < 0) return; if (elem.type != BE_INT) { - fputs("[msgSM!=INT]", stdout); + printf("[msgSM!=INT]"); asn1_print(&elem); return; } @@ -1307,7 +1307,7 @@ snmp3_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_STR) { - fputs("msgSP!=STR]", stdout); + printf("msgSP!=STR]"); asn1_print(&elem); return; } @@ -1319,7 +1319,7 @@ snmp3_print(const u_char *np, u_int length) np += count; if (SNMP3_PRIV(authpriv) != 0) { - fputs("[encrypted PDU]", stdout); + printf("[encrypted PDU]"); return; } @@ -1327,7 +1327,7 @@ snmp3_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_SEQ) { - fputs("[ScPDU!=SEQ]", stdout); + printf("[ScPDU!=SEQ]"); asn1_print(&elem); return; } @@ -1341,12 +1341,12 @@ snmp3_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_STR) { - fputs("ctxEID!=STR]", stdout); + printf("ctxEID!=STR]"); asn1_print(&elem); return; } if (vflag && elem.asnlen > 0) { - fputs("ctxEID=0x", stdout); + printf("ctxEID=0x"); for (i = 0; i < elem.asnlen; i++) printf("%02hhX", elem.data.str[i]); putchar(' '); @@ -1358,12 +1358,12 @@ snmp3_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_STR) { - fputs("[ctxEName!=STR]", stdout); + printf("[ctxEName!=STR]"); asn1_print(&elem); return; } if (vflag && elem.asnlen > 0) { - fputs("ctxName=", stdout); + printf("ctxName="); asn1_print(&elem); putchar(' '); } @@ -1374,7 +1374,7 @@ snmp3_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_PDU) { - fputs("[data!=PDU]", stdout); + printf("[data!=PDU]"); asn1_print(&elem); return; } @@ -1419,7 +1419,7 @@ snmp_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_SEQ) { - fputs("[!init SEQ]", stdout); + printf("[!init SEQ]"); asn1_print(&elem); return; } @@ -1432,7 +1432,7 @@ snmp_print(const u_char *np, u_int length) if ((count = asn1_parse(np, length, &elem)) < 0) return; if (elem.type != BE_INT) { - fputs("[version!=INT]", stdout); + printf("[version!=INT]"); asn1_print(&elem); return; } @@ -1448,7 +1448,7 @@ snmp_print(const u_char *np, u_int length) return; case SNMP_V3: if (vflag) - fputs("SNMPv3 ", stdout); + printf("SNMPv3 "); snmp3_print(np, length); return; default: diff --git a/usr.sbin/tcpdump/print-tcp.c b/usr.sbin/tcpdump/print-tcp.c index 6317cbc355f..ec6053e73c9 100644 --- a/usr.sbin/tcpdump/print-tcp.c +++ b/usr.sbin/tcpdump/print-tcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-tcp.c,v 1.38 2018/10/22 16:12:45 kn Exp $ */ +/* $OpenBSD: print-tcp.c,v 1.39 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -201,25 +201,25 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) ip6 = (struct ip6_hdr *)bp2; break; default: - (void)printf("invalid ip version"); + printf("invalid ip version"); return; } ch = '\0'; if (length < sizeof(*tp)) { - (void)printf("truncated-tcp %u", length); + printf("truncated-tcp %u", length); return; } if (!TTEST(tp->th_dport)) { if (ip6) { - (void)printf("%s > %s: [|tcp]", - ip6addr_string(&ip6->ip6_src), - ip6addr_string(&ip6->ip6_dst)); + printf("%s > %s: [|tcp]", + ip6addr_string(&ip6->ip6_src), + ip6addr_string(&ip6->ip6_dst)); } else { - (void)printf("%s > %s: [|tcp]", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); + printf("%s > %s: [|tcp]", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); } return; } @@ -229,30 +229,30 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) if (ip6) { if (ip6->ip6_nxt == IPPROTO_TCP) { - (void)printf("%s.%s > %s.%s: ", - ip6addr_string(&ip6->ip6_src), - tcpport_string(sport), - ip6addr_string(&ip6->ip6_dst), - tcpport_string(dport)); + printf("%s.%s > %s.%s: ", + ip6addr_string(&ip6->ip6_src), + tcpport_string(sport), + ip6addr_string(&ip6->ip6_dst), + tcpport_string(dport)); } else { - (void)printf("%s > %s: ", - tcpport_string(sport), tcpport_string(dport)); + printf("%s > %s: ", + tcpport_string(sport), tcpport_string(dport)); } } else { if (ip->ip_p == IPPROTO_TCP) { - (void)printf("%s.%s > %s.%s: ", - ipaddr_string(&ip->ip_src), - tcpport_string(sport), - ipaddr_string(&ip->ip_dst), - tcpport_string(dport)); + printf("%s.%s > %s.%s: ", + ipaddr_string(&ip->ip_src), + tcpport_string(sport), + ipaddr_string(&ip->ip_dst), + tcpport_string(dport)); } else { - (void)printf("%s > %s: ", - tcpport_string(sport), tcpport_string(dport)); + printf("%s > %s: ", + tcpport_string(sport), tcpport_string(dport)); } } if (!qflag && TTEST(tp->th_seq) && !TTEST(tp->th_ack)) - (void)printf("%u ", ntohl(tp->th_seq)); + printf("%u ", ntohl(tp->th_seq)); TCHECK(*tp); seq = ntohl(tp->th_seq); @@ -262,7 +262,7 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) hlen = tp->th_off * 4; if (qflag) { - (void)printf("tcp %d", length - tp->th_off * 4); + printf("tcp %d", length - tp->th_off * 4); return; } else if (packettype != PT_TCP) { @@ -376,7 +376,7 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) } hlen = tp->th_off * 4; if (hlen > length) { - (void)printf(" [bad hdr length]"); + printf(" [bad hdr length]"); return; } @@ -386,10 +386,10 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) sum = tcp_cksum(ip, tp, length); if (sum != 0) { tcp_sum = EXTRACT_16BITS(&tp->th_sum); - (void)printf(" [bad tcp cksum %x! -> %x]", tcp_sum, + printf(" [bad tcp cksum %x! -> %x]", tcp_sum, in_cksum_shouldbe(tcp_sum, sum)); } else - (void)printf(" [tcp sum ok]"); + printf(" [tcp sum ok]"); } } if (ip6 && ip6->ip6_plen && vflag) { @@ -398,10 +398,10 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) sum = tcp6_cksum(ip6, tp, length); if (sum != 0) { tcp_sum = EXTRACT_16BITS(&tp->th_sum); - (void)printf(" [bad tcp cksum %x! -> %x]", tcp_sum, + printf(" [bad tcp cksum %x! -> %x]", tcp_sum, in_cksum_shouldbe(tcp_sum, sum)); } else - (void)printf(" [tcp sum ok]"); + printf(" [tcp sum ok]"); } } @@ -440,14 +440,14 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) length -= hlen; if (vflag > 1 || length > 0 || flags & (TH_SYN | TH_FIN | TH_RST)) - (void)printf(" %u:%u(%u)", seq, seq + length, length); + printf(" %u:%u(%u)", seq, seq + length, length); if (flags & TH_ACK) - (void)printf(" ack %u", ack); + printf(" ack %u", ack); - (void)printf(" win %u", win); + printf(" win %u", win); if (flags & TH_URG) - (void)printf(" urg %u", urp); + printf(" urg %u", urp); /* * Handle any options. */ @@ -480,32 +480,32 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) switch (opt) { case TCPOPT_MAXSEG: - (void)printf("mss"); + printf("mss"); datalen = 2; LENCHECK(datalen); - (void)printf(" %u", EXTRACT_16BITS(cp)); + printf(" %u", EXTRACT_16BITS(cp)); break; case TCPOPT_EOL: - (void)printf("eol"); + printf("eol"); break; case TCPOPT_NOP: - (void)printf("nop"); + printf("nop"); break; case TCPOPT_WSCALE: - (void)printf("wscale"); + printf("wscale"); datalen = 1; LENCHECK(datalen); - (void)printf(" %u", *cp); + printf(" %u", *cp); break; case TCPOPT_SACKOK: - (void)printf("sackOK"); + printf("sackOK"); if (len != 2) - (void)printf("[len %d]", len); + printf("[len %d]", len); break; case TCPOPT_SACK: @@ -515,8 +515,8 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) datalen = len - 2; if ((datalen % TCPOLEN_SACK) != 0 || !(flags & TH_ACK)) { - (void)printf("malformed sack "); - (void)printf("[len %d] ", datalen); + printf("malformed sack "); + printf("[len %d] ", datalen); break; } printf("sack %d ", datalen/TCPOLEN_SACK); @@ -533,69 +533,69 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) e -= th->ack; } } - (void) printf("{%lu:%lu} ", s, e); + printf("{%lu:%lu} ", s, e); } break; } case TCPOPT_ECHO: - (void)printf("echo"); + printf("echo"); datalen = 4; LENCHECK(datalen); - (void)printf(" %u", EXTRACT_32BITS(cp)); + printf(" %u", EXTRACT_32BITS(cp)); break; case TCPOPT_ECHOREPLY: - (void)printf("echoreply"); + printf("echoreply"); datalen = 4; LENCHECK(datalen); - (void)printf(" %u", EXTRACT_32BITS(cp)); + printf(" %u", EXTRACT_32BITS(cp)); break; case TCPOPT_TIMESTAMP: - (void)printf("timestamp"); + printf("timestamp"); datalen = 8; LENCHECK(4); - (void)printf(" %u", EXTRACT_32BITS(cp)); + printf(" %u", EXTRACT_32BITS(cp)); LENCHECK(datalen); - (void)printf(" %u", EXTRACT_32BITS(cp + 4)); + printf(" %u", EXTRACT_32BITS(cp + 4)); break; case TCPOPT_CC: - (void)printf("cc"); + printf("cc"); datalen = 4; LENCHECK(datalen); - (void)printf(" %u", EXTRACT_32BITS(cp)); + printf(" %u", EXTRACT_32BITS(cp)); break; case TCPOPT_CCNEW: - (void)printf("ccnew"); + printf("ccnew"); datalen = 4; LENCHECK(datalen); - (void)printf(" %u", EXTRACT_32BITS(cp)); + printf(" %u", EXTRACT_32BITS(cp)); break; case TCPOPT_CCECHO: - (void)printf("ccecho"); + printf("ccecho"); datalen = 4; LENCHECK(datalen); - (void)printf(" %u", EXTRACT_32BITS(cp)); + printf(" %u", EXTRACT_32BITS(cp)); break; case TCPOPT_SIGNATURE: - (void)printf("tcpmd5:"); + printf("tcpmd5:"); datalen = len - 2; for (i = 0; i < datalen; ++i) { LENCHECK(i+1); - (void)printf("%02x", cp[i]); + printf("%02x", cp[i]); } break; default: - (void)printf("opt-%d:", opt); + printf("opt-%d:", opt); datalen = len - 2; for (i = 0; i < datalen; ++i) { LENCHECK(i+1); - (void)printf("%02x", cp[i]); + printf("%02x", cp[i]); } break; } @@ -609,7 +609,7 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) if (!ZEROLENOPT(opt)) ++datalen; /* size octet */ if (datalen != len) - (void)printf("[len %d]", len); + printf("[len %d]", len); ch = ','; if (opt == TCPOPT_EOL) break; @@ -640,12 +640,12 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2) } return; bad: - fputs("[bad opt]", stdout); + printf("[bad opt]"); if (ch != '\0') putchar('>'); return; trunc: - fputs("[|tcp]", stdout); + printf("[|tcp]"); if (ch != '\0') putchar('>'); } diff --git a/usr.sbin/tcpdump/print-tftp.c b/usr.sbin/tcpdump/print-tftp.c index 31a131c1dda..f3940ec5736 100644 --- a/usr.sbin/tcpdump/print-tftp.c +++ b/usr.sbin/tcpdump/print-tftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-tftp.c,v 1.13 2018/07/06 05:47:22 dlg Exp $ */ +/* $OpenBSD: print-tftp.c,v 1.14 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 @@ -101,7 +101,7 @@ tftp_print(const u_char *bp, u_int length) #else p = (u_char *)&tp->th_block; #endif - fputs(" \"", stdout); + printf(" \""); i = fn_print(p, snapend); putchar('"'); if (i) @@ -134,6 +134,6 @@ tftp_print(const u_char *bp, u_int length) } return; trunc: - fputs(tstr, stdout); + printf("%s", tstr); return; } diff --git a/usr.sbin/tcpdump/print-timed.c b/usr.sbin/tcpdump/print-timed.c index 196a1e35216..9e4803d6238 100644 --- a/usr.sbin/tcpdump/print-timed.c +++ b/usr.sbin/tcpdump/print-timed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-timed.c,v 1.7 2015/11/16 00:16:39 mmcc Exp $ */ +/* $OpenBSD: print-timed.c,v 1.8 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 2000 Ben Smithurst <ben@scientia.demon.co.uk> @@ -81,7 +81,7 @@ timed_print(const u_char *bp, u_int length) if (usec < 0) /* corrupt, skip the rest of the packet */ return; - fputs(" time ", stdout); + printf(" time "); if (sec < 0 && usec != 0) { sec++; if (sec == 0) @@ -92,10 +92,10 @@ timed_print(const u_char *bp, u_int length) } end = endof(tsp->tsp_name) > snapend ? snapend : endof(tsp->tsp_name); - fputs(" name ", stdout); + printf(" name "); if (fn_print(tsp->tsp_name, end)) goto trunc; return; trunc: - fputs(" [|timed]", stdout); + printf(" [|timed]"); } diff --git a/usr.sbin/tcpdump/print-udp.c b/usr.sbin/tcpdump/print-udp.c index fb4b2707772..81eb57283c4 100644 --- a/usr.sbin/tcpdump/print-udp.c +++ b/usr.sbin/tcpdump/print-udp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-udp.c,v 1.53 2019/12/02 22:32:01 dlg Exp $ */ +/* $OpenBSD: print-udp.c,v 1.54 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 @@ -115,17 +115,17 @@ vat_print(const void *hdr, u_int len, const struct udphdr *up) u_int ts = *(u_short *)hdr; if ((ts & 0xf060) != 0) { /* probably vt */ - (void)printf("udp/vt %u %d / %d", - (u_int32_t)(ntohs(up->uh_ulen) - sizeof(*up)), - ts & 0x3ff, ts >> 10); + printf("udp/vt %u %d / %d", + (u_int32_t)(ntohs(up->uh_ulen) - sizeof(*up)), + ts & 0x3ff, ts >> 10); } else { /* probably vat */ u_int i0 = ntohl(((u_int *)hdr)[0]); u_int i1 = ntohl(((u_int *)hdr)[1]); printf("udp/vat %u c%d %u%s", - (u_int32_t)(ntohs(up->uh_ulen) - sizeof(*up) - 8), - i0 & 0xffff, - i1, i0 & 0x800000? "*" : ""); + (u_int32_t)(ntohs(up->uh_ulen) - sizeof(*up) - 8), + i0 & 0xffff, + i1, i0 & 0x800000? "*" : ""); /* audio format */ if (i0 & 0x1f0000) printf(" f%d", (i0 >> 16) & 0x1f); @@ -167,13 +167,8 @@ rtp_print(const void *hdr, u_int len, const struct udphdr *up) len -= 1; } printf(" udp/%s %d c%d %s%s %d %u", - ptype, - dlen, - contype, - (hasopt || hasext)? "+" : "", - hasmarker? "*" : "", - i0 & 0xffff, - i1); + ptype, dlen, contype, (hasopt || hasext)? "+" : "", + hasmarker? "*" : "", i0 & 0xffff, i1); if (vflag) { printf(" %u", i1); if (hasopt) { @@ -229,7 +224,7 @@ rtcp_print(const u_char *hdr, const u_char *ep) if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh)) printf(" [%d]", len); if (vflag) - printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc)); + printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc)); if ((u_char *)(sr + 1) > ep) { printf(" [|rtcp]"); return (ep); @@ -247,18 +242,18 @@ rtcp_print(const u_char *hdr, const u_char *ep) printf(" [%d]", len); rr = (struct rtcp_rr *)(rh + 1); if (vflag) - printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc)); + printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc)); break; case RTCP_PT_SDES: printf(" sdes %d", len); if (vflag) - printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc)); + printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc)); cnt = 0; break; case RTCP_PT_BYE: printf(" bye %d", len); if (vflag) - printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc)); + printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc)); cnt = 0; break; default: @@ -507,7 +502,7 @@ udp_print(const u_char *bp, u_int length, const void *iph) ((struct LAP *)cp)->type == lapDDP && (atalk_port(sport) || atalk_port(dport))) { if (vflag) - fputs("kip ", stdout); + printf("kip "); atalk_print_llap(cp, length); return; } diff --git a/usr.sbin/tcpdump/print-udpencap.c b/usr.sbin/tcpdump/print-udpencap.c index 2dc9948e6ce..4b296bf019e 100644 --- a/usr.sbin/tcpdump/print-udpencap.c +++ b/usr.sbin/tcpdump/print-udpencap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-udpencap.c,v 1.6 2018/07/06 05:47:22 dlg Exp $ */ +/* $OpenBSD: print-udpencap.c,v 1.7 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 2003 Markus Friedl. All rights reserved. @@ -36,15 +36,15 @@ udpencap_print(const u_char *bp, u_int len, const u_char *bp2) /* Recognize NAT-T Keepalive msgs. (draft-ietf-ipsec-udp-encaps-nn) */ if (len == 1 && *bp == 0xFF) { - fputs("NAT-T Keepalive", stdout); + printf("NAT-T Keepalive"); return; } if (len < sizeof(u_int32_t)) { - fputs("[|udpencap]", stdout); + printf("[|udpencap]"); return; } - fputs("udpencap: ", stdout); + printf("udpencap: "); spi = (u_int32_t *)(bp); if (*spi == 0) ike_print(bp + sizeof(u_int32_t), len - sizeof(u_int32_t)); diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c index 7664d8c4b3c..34d7de738ad 100644 --- a/usr.sbin/tcpdump/tcpdump.c +++ b/usr.sbin/tcpdump/tcpdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcpdump.c,v 1.91 2019/06/28 13:32:51 deraadt Exp $ */ +/* $OpenBSD: tcpdump.c,v 1.92 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -656,14 +656,14 @@ default_print_unaligned(const u_char *cp, u_int length) i = 0; while (--nshorts >= 0) { if ((i++ % 8) == 0) - (void)printf("\n\t\t\t"); + printf("\n\t\t\t"); s = *cp++; - (void)printf(" %02x%02x", s, *cp++); + printf(" %02x%02x", s, *cp++); } if (length & 1) { if ((i % 8) == 0) - (void)printf("\n\t\t\t"); - (void)printf(" %02x", *cp); + printf("\n\t\t\t"); + printf(" %02x", *cp); } } } @@ -692,13 +692,13 @@ default_print(const u_char *bp, u_int length) i = 0; while (--nshorts >= 0) { if ((i++ % 8) == 0) - (void)printf("\n\t\t\t"); - (void)printf(" %04x", ntohs(*sp++)); + printf("\n\t\t\t"); + printf(" %04x", ntohs(*sp++)); } if (length & 1) { if ((i % 8) == 0) - (void)printf("\n\t\t\t"); - (void)printf(" %02x", *(u_char *)sp); + printf("\n\t\t\t"); + printf(" %02x", *(u_char *)sp); } } } diff --git a/usr.sbin/tcpdump/util.c b/usr.sbin/tcpdump/util.c index 082ae5236aa..2c7703776ae 100644 --- a/usr.sbin/tcpdump/util.c +++ b/usr.sbin/tcpdump/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.29 2019/06/28 13:32:51 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.30 2020/01/24 22:46:37 procter Exp $ */ /* * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 @@ -123,31 +123,31 @@ ts_print(const struct bpf_timeval *tvp) time_t t; if (Iflag && device) - (void)printf("%s ", device); + printf("%s ", device); switch(tflag){ case 0: break; case -1: /* Unix timeval style */ - (void)printf("%u.%06u ", tvp->tv_sec, tvp->tv_usec); + printf("%u.%06u ", tvp->tv_sec, tvp->tv_usec); break; case -2: t = tvp->tv_sec; strftime(buf, TSBUFLEN, "%b %d %T", priv_localtime(&t)); - (void)printf("%s.%06u ", buf, tvp->tv_usec); + printf("%s.%06u ", buf, tvp->tv_usec); break; case -3: /* last frame time delta */ case -4: /* first frame time delta */ cur.tv_sec = tvp->tv_sec; cur.tv_usec = tvp->tv_usec; timersub(&cur, &last, &diff); - (void)printf("%lld.%06ld ", diff.tv_sec, diff.tv_usec); + printf("%lld.%06ld ", diff.tv_sec, diff.tv_usec); if (!timerisset(&last) || tflag == -3) last = cur; break; default: s = (tvp->tv_sec + thiszone) % 86400; - (void)printf("%02d:%02d:%02d.%06u ", + printf("%02d:%02d:%02d.%06u ", s / 3600, (s % 3600) / 60, s % 60, tvp->tv_usec); break; } @@ -167,12 +167,12 @@ relts_print(int secs) int *s = seconds; if (secs <= 0) { - (void)printf("0s"); + printf("0s"); return; } while (secs > 0) { if (secs >= *s) { - (void)printf("%d%s", secs / *s, *l); + printf("%d%s", secs / *s, *l); secs -= (secs / *s) * *s; } s++; |