summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ovsienko <infrastation@yandex.ru>2013-12-26 18:08:06 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2013-12-26 18:19:50 +0400
commitd8acd8f5d0d7cac4881b5552eca5dc40a5d3c0d1 (patch)
tree5aeac16d418b595a76270d00a2cfb12ebcd31c6c
parentae1fdebb647a437fbec8d3d4845da190da180dd8 (diff)
downloadtcpdump-d8acd8f5d0d7cac4881b5552eca5dc40a5d3c0d1.tar.gz
make consistent use of the "tstr" idiom
For each decoder that has more than one instance of truncation signaling and prints the same string in each instance make sure that the string is declared as "static const char tstr[]" right after the initial includes block. Where necessary, replace fputs(s, stdout) with equivalent printf("%s", s).
-rw-r--r--print-802_11.c32
-rw-r--r--print-ahcp.c40
-rw-r--r--print-arp.c10
-rw-r--r--print-atalk.c4
-rw-r--r--print-atm.c8
-rw-r--r--print-babel.c8
-rw-r--r--print-bootp.c4
-rw-r--r--print-cdp.c6
-rw-r--r--print-dccp.c6
-rw-r--r--print-decnet.c14
-rw-r--r--print-forces.c37
-rw-r--r--print-gre.c8
-rw-r--r--print-igmp.c12
-rw-r--r--print-ip.c6
-rw-r--r--print-krb.c4
-rw-r--r--print-l2tp.c2
-rw-r--r--print-nfs.c12
-rw-r--r--print-openflow-1.0.c79
-rw-r--r--print-openflow.c7
-rw-r--r--print-ospf.c4
-rw-r--r--print-ospf6.c4
-rw-r--r--print-pflog.c8
-rw-r--r--print-pptp.c2
-rw-r--r--print-radius.c24
-rw-r--r--print-rip.c8
-rw-r--r--print-sl.c6
-rw-r--r--print-smb.c26
-rw-r--r--print-snmp.c8
-rw-r--r--print-syslog.c8
-rw-r--r--print-tftp.c3
-rw-r--r--print-timed.c14
-rw-r--r--print-tipc.c10
-rw-r--r--print-token.c8
-rw-r--r--print-usb.c6
-rw-r--r--print-zeromq.c6
35 files changed, 249 insertions, 195 deletions
diff --git a/print-802_11.c b/print-802_11.c
index 8a9a1a66..c9d60a27 100644
--- a/print-802_11.c
+++ b/print-802_11.c
@@ -46,6 +46,8 @@ static const char rcsid[] _U_ =
#include "ieee802_11.h"
#include "ieee802_11_radio.h"
+static const char tstr[] = "[|802.11]";
+
/* Radiotap state */
/* This is used to save state when parsing/processing parameters */
struct radiotap_state
@@ -1718,7 +1720,7 @@ ieee802_11_print(const u_char *p, u_int length, u_int orig_caplen, int pad,
caplen = orig_caplen;
/* Remove FCS, if present */
if (length < fcslen) {
- printf("[|802.11]");
+ printf("%s", tstr);
return caplen;
}
length -= fcslen;
@@ -1730,7 +1732,7 @@ ieee802_11_print(const u_char *p, u_int length, u_int orig_caplen, int pad,
}
if (caplen < IEEE802_11_FC_LEN) {
- printf("[|802.11]");
+ printf("%s", tstr);
return orig_caplen;
}
@@ -1747,7 +1749,7 @@ ieee802_11_print(const u_char *p, u_int length, u_int orig_caplen, int pad,
if (caplen < hdrlen) {
- printf("[|802.11]");
+ printf("%s", tstr);
return hdrlen;
}
@@ -1764,13 +1766,13 @@ ieee802_11_print(const u_char *p, u_int length, u_int orig_caplen, int pad,
case T_MGMT:
if (!mgmt_body_print(fc,
(const struct mgmt_header_t *)(p - hdrlen), p, length)) {
- printf("[|802.11]");
+ printf("%s", tstr);
return hdrlen;
}
break;
case T_CTRL:
if (!ctrl_body_print(fc, p - hdrlen)) {
- printf("[|802.11]");
+ printf("%s", tstr);
return hdrlen;
}
break;
@@ -1780,7 +1782,7 @@ ieee802_11_print(const u_char *p, u_int length, u_int orig_caplen, int pad,
/* There may be a problem w/ AP not having this bit set */
if (FC_WEP(fc)) {
if (!wep_print(p)) {
- printf("[|802.11]");
+ printf("%s", tstr);
return hdrlen;
}
} else if (llc_print(p, length, caplen, dst, src,
@@ -1998,7 +2000,7 @@ print_radiotap_field(struct cpack_state *s, u_int32_t bit, u_int8_t *flags,
}
if (rc != 0) {
- printf("[|802.11]");
+ printf("%s", tstr);
return rc;
}
@@ -2221,7 +2223,7 @@ ieee802_11_radio_print(const u_char *p, u_int length, u_int caplen)
struct radiotap_state state;
if (caplen < sizeof(*hdr)) {
- printf("[|802.11]");
+ printf("%s", tstr);
return caplen;
}
@@ -2230,7 +2232,7 @@ ieee802_11_radio_print(const u_char *p, u_int length, u_int caplen)
len = EXTRACT_LE_16BITS(&hdr->it_len);
if (caplen < len) {
- printf("[|802.11]");
+ printf("%s", tstr);
return caplen;
}
cpack_init(&cpacker, (u_int8_t *)hdr, len); /* align against header start */
@@ -2243,7 +2245,7 @@ ieee802_11_radio_print(const u_char *p, u_int length, u_int caplen)
/* are there more bitmap extensions than bytes in header? */
if (IS_EXTENDED(last_presentp)) {
- printf("[|802.11]");
+ printf("%s", tstr);
return caplen;
}
@@ -2295,7 +2297,7 @@ ieee802_11_avs_radio_print(const u_char *p, u_int length, u_int caplen)
u_int32_t caphdr_len;
if (caplen < 8) {
- printf("[|802.11]");
+ printf("%s", tstr);
return caplen;
}
@@ -2306,12 +2308,12 @@ ieee802_11_avs_radio_print(const u_char *p, u_int length, u_int caplen)
* to be large enough to include even the version
* cookie or capture header length!
*/
- printf("[|802.11]");
+ printf("%s", tstr);
return caplen;
}
if (caplen < caphdr_len) {
- printf("[|802.11]");
+ printf("%s", tstr);
return caplen;
}
@@ -2346,7 +2348,7 @@ prism_if_print(const struct pcap_pkthdr *h, const u_char *p)
u_int32_t msgcode;
if (caplen < 4) {
- printf("[|802.11]");
+ printf("%s", tstr);
return caplen;
}
@@ -2356,7 +2358,7 @@ prism_if_print(const struct pcap_pkthdr *h, const u_char *p)
return ieee802_11_avs_radio_print(p, length, caplen);
if (caplen < PRISM_HDR_LEN) {
- printf("[|802.11]");
+ printf("%s", tstr);
return caplen;
}
diff --git a/print-ahcp.c b/print-ahcp.c
index 738625e1..b3abaa7b 100644
--- a/print-ahcp.c
+++ b/print-ahcp.c
@@ -39,8 +39,8 @@
#include "extract.h"
#include "addrtoname.h"
-static const char *corrupt_str = "(corrupt)";
-static const char *trunc_str = "[|ahcp]";
+static const char tstr[] = " [|ahcp]";
+static const char cstr[] = "(corrupt)";
#define AHCP_MAGIC_NUMBER 43
#define AHCP_VERSION_1 1
@@ -117,11 +117,11 @@ ahcp_time_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -134,11 +134,11 @@ ahcp_seconds_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -163,11 +163,11 @@ ahcp_ipv6_addresses_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -186,11 +186,11 @@ ahcp_ipv4_addresses_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -215,11 +215,11 @@ ahcp_ipv6_prefixes_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -238,11 +238,11 @@ ahcp_ipv4_prefixes_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -298,11 +298,11 @@ ahcp1_options_print(const u_char *cp, const u_char *ep) {
return;
corrupt:
- printf(" %s", corrupt_str);
+ printf(" %s", cstr);
TCHECK2(*cp, ep - cp);
return;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
}
static void
@@ -342,11 +342,11 @@ ahcp1_body_print(const u_char *cp, const u_char *ep) {
return;
corrupt:
- printf(" %s", corrupt_str);
+ printf(" %s", cstr);
TCHECK2(*cp, ep - cp);
return;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
}
void
@@ -407,10 +407,10 @@ ahcp_print(const u_char *cp, const u_int len) {
return;
corrupt:
- printf(" %s", corrupt_str);
+ printf(" %s", cstr);
TCHECK2(*cp, ep - cp);
return;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
}
diff --git a/print-arp.c b/print-arp.c
index b5047a0d..e53c58ca 100644
--- a/print-arp.c
+++ b/print-arp.c
@@ -39,6 +39,8 @@ static const char rcsid[] _U_ =
#include "ethertype.h"
#include "extract.h" /* must come after interface.h */
+static const char tstr[] = "[|ARP]";
+
/*
* Address Resolution Protocol.
*
@@ -211,7 +213,7 @@ atmarp_print(netdissect_options *ndo,
op = ATMOP(ap);
if (!ND_TTEST2(*aar_tpa(ap), ATMTPROTO_LEN(ap))) {
- ND_PRINT((ndo, "[|ARP]"));
+ ND_PRINT((ndo, "%s", tstr));
ND_DEFAULTPRINT((const u_char *)ap, length);
return;
}
@@ -289,7 +291,7 @@ atmarp_print(netdissect_options *ndo,
return;
trunc:
- ND_PRINT((ndo, "[|ARP]"));
+ ND_PRINT((ndo, "%s", tstr));
}
void
@@ -325,7 +327,7 @@ arp_print(netdissect_options *ndo,
}
if (!ND_TTEST2(*ar_tpa(ap), PROTO_LEN(ap))) {
- ND_PRINT((ndo, "[|ARP]"));
+ ND_PRINT((ndo, "%s", tstr));
ND_DEFAULTPRINT((const u_char *)ap, length);
return;
}
@@ -406,7 +408,7 @@ arp_print(netdissect_options *ndo,
return;
trunc:
- ND_PRINT((ndo, "[|ARP]"));
+ ND_PRINT((ndo, "%s", tstr));
}
/*
diff --git a/print-atalk.c b/print-atalk.c
index be1c154f..bc2003b1 100644
--- a/print-atalk.c
+++ b/print-atalk.c
@@ -43,6 +43,8 @@ static const char rcsid[] _U_ =
#include "extract.h" /* must come after interface.h */
#include "appletalk.h"
+static const char tstr[] = "[|atalk]";
+
static const struct tok type2str[] = {
{ ddpRTMP, "rtmp" },
{ ddpRTMPrequest, "rtmpReq" },
@@ -63,8 +65,6 @@ struct aarp {
u_int8_t pdaddr[4];
};
-static char tstr[] = "[|atalk]";
-
static void atp_print(const struct atATP *, u_int);
static void atp_bitmap_print(u_char);
static void nbp_print(const struct atNBP *, u_int, u_short, u_char, u_char);
diff --git a/print-atm.c b/print-atm.c
index b132a6de..0327b0d4 100644
--- a/print-atm.c
+++ b/print-atm.c
@@ -43,6 +43,8 @@ static const char rcsid[] _U_ =
#include "ether.h"
+static const char tstr[] = "[|atm]";
+
#define OAM_CRC10_MASK 0x3ff
#define OAM_PAYLOAD_LEN 48
#define OAM_FUNCTION_SPECIFIC_LEN 45 /* this excludes crc10 and cell-type/function-type */
@@ -172,7 +174,7 @@ atm_if_print(const struct pcap_pkthdr *h, const u_char *p)
u_int hdrlen = 0;
if (caplen < 8) {
- printf("[|atm]");
+ printf("%s", tstr);
return (caplen);
}
@@ -254,7 +256,7 @@ sig_print(const u_char *p, int caplen)
bpf_u_int32 call_ref;
if (caplen < PROTO_POS) {
- printf("[|atm]");
+ printf("%s", tstr);
return;
}
if (p[PROTO_POS] == Q2931) {
@@ -264,7 +266,7 @@ sig_print(const u_char *p, int caplen)
*/
printf("Q.2931");
if (caplen < MSG_TYPE_POS) {
- printf(" [|atm]");
+ printf(" %s", tstr);
return;
}
printf(":%s ",
diff --git a/print-babel.c b/print-babel.c
index 4c77a0cb..4f128b32 100644
--- a/print-babel.c
+++ b/print-babel.c
@@ -39,6 +39,8 @@
#include "interface.h"
#include "extract.h"
+static const char tstr[] = "[|babel]";
+
static void babel_print_v2(const u_char *cp, u_int length);
void
@@ -66,7 +68,7 @@ babel_print(const u_char *cp, u_int length) {
return;
trunc:
- printf(" [|babel]");
+ printf(" %s", tstr);
return;
}
@@ -396,7 +398,7 @@ babel_print_v2(const u_char *cp, u_int length) {
txcost = EXTRACT_16BITS(message + 4);
interval = EXTRACT_16BITS(message + 6);
rc = network_address(message[2], message + 8, len - 6, address);
- if(rc < 0) { printf("[|babel]"); break; }
+ if(rc < 0) { printf("%s", tstr); break; }
printf("%s txcost %u interval %s",
format_address(address), txcost, format_interval(interval));
}
@@ -547,7 +549,7 @@ babel_print_v2(const u_char *cp, u_int length) {
return;
trunc:
- printf(" [|babel]");
+ printf(" %s", tstr);
return;
corrupt:
diff --git a/print-bootp.c b/print-bootp.c
index c9e7a11e..97a39c05 100644
--- a/print-bootp.c
+++ b/print-bootp.c
@@ -40,12 +40,12 @@ static const char rcsid[] _U_ =
#include "ether.h"
#include "bootp.h"
+static const char tstr[] = " [|bootp]";
+
static void rfc1048_print(const u_char *);
static void cmu_print(const u_char *);
static char *client_fqdn_flags(u_int flags);
-static char tstr[] = " [|bootp]";
-
static const struct tok bootp_flag_values[] = {
{ 0x8000, "Broadcast" },
{ 0, NULL}
diff --git a/print-cdp.c b/print-cdp.c
index 50c1d9da..da3f10b4 100644
--- a/print-cdp.c
+++ b/print-cdp.c
@@ -43,6 +43,8 @@ static const char rcsid[] _U_ =
#include "extract.h" /* must come after interface.h */
#include "nlpid.h"
+static const char tstr[] = "[|cdp]";
+
#define CDP_HEADER_LEN 4
static const struct tok cdp_tlv_values[] = {
@@ -92,7 +94,7 @@ cdp_print(const u_char *pptr, u_int length, u_int caplen)
const u_char *tptr;
if (caplen < CDP_HEADER_LEN) {
- (void)printf("[|cdp]");
+ printf("%s", tstr);
return;
}
@@ -232,7 +234,7 @@ cdp_print(const u_char *pptr, u_int length, u_int caplen)
return;
trunc:
- printf("[|cdp]");
+ printf("%s", tstr);
}
/*
diff --git a/print-dccp.c b/print-dccp.c
index 79ea5f72..adf4577d 100644
--- a/print-dccp.c
+++ b/print-dccp.c
@@ -32,6 +32,8 @@ static const char rcsid[] _U_ =
#endif
#include "ipproto.h"
+static const char tstr[] = "[|dccp]";
+
static const char *dccp_reset_codes[] = {
"unspecified",
"closed",
@@ -340,7 +342,7 @@ void dccp_print(const u_char *bp, const u_char *data2, u_int len)
}
return;
trunc:
- printf("[|dccp]");
+ printf("%s", tstr);
trunc2:
return;
}
@@ -459,6 +461,6 @@ static int dccp_print_option(const u_char *option)
return optlen;
trunc:
- printf("[|dccp]");
+ printf("%s", tstr);
return 0;
}
diff --git a/print-decnet.c b/print-decnet.c
index 5b9dcfb5..f7d59283 100644
--- a/print-decnet.c
+++ b/print-decnet.c
@@ -46,6 +46,8 @@ struct rtentry;
#include "interface.h"
#include "addrtoname.h"
+static const char tstr[] = "[|decnet]";
+
/* Forwards */
static int print_decnet_ctlmsg(const union routehdr *, u_int, u_int);
static void print_t_info(int);
@@ -74,18 +76,18 @@ decnet_print(register const u_char *ap, register u_int length,
const u_char *nspp;
if (length < sizeof(struct shorthdr)) {
- (void)printf("[|decnet]");
+ (void)printf("%s", tstr);
return;
}
TCHECK2(*ap, sizeof(short));
pktlen = EXTRACT_LE_16BITS(ap);
if (pktlen < sizeof(struct shorthdr)) {
- (void)printf("[|decnet]");
+ (void)printf("%s", tstr);
return;
}
if (pktlen > length) {
- (void)printf("[|decnet]");
+ (void)printf("%s", tstr);
return;
}
length = pktlen;
@@ -100,7 +102,7 @@ decnet_print(register const u_char *ap, register u_int length,
if (vflag)
(void) printf("[pad:%d] ", padlen);
if (length < padlen + 2) {
- (void)printf("[|decnet]");
+ (void)printf("%s", tstr);
return;
}
TCHECK2(ap[sizeof(short)], padlen);
@@ -127,7 +129,7 @@ decnet_print(register const u_char *ap, register u_int length,
switch (mflags & RMF_MASK) {
case RMF_LONG:
if (length < sizeof(struct longhdr)) {
- (void)printf("[|decnet]");
+ (void)printf("%s", tstr);
return;
}
TCHECK(rhp->rh_long);
@@ -170,7 +172,7 @@ decnet_print(register const u_char *ap, register u_int length,
return;
trunc:
- (void)printf("[|decnet]");
+ (void)printf("%s", tstr);
return;
}
diff --git a/print-forces.c b/print-forces.c
index 73912095..0778a340 100644
--- a/print-forces.c
+++ b/print-forces.c
@@ -26,6 +26,7 @@
#include "interface.h"
#include "extract.h"
+static const char tstr[] = "[|forces]";
/*
* Per draft-ietf-forces-protocol-22
@@ -691,7 +692,7 @@ prestlv_print(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -725,7 +726,7 @@ fdatatlv_print(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -770,7 +771,7 @@ sdatailv_print(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -798,7 +799,7 @@ sdatatlv_print(register const u_char * pptr, register u_int len,
return sdatailv_print(tdp, rlen, op_msk, indent);
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -838,7 +839,7 @@ pkeyitlv_print(register const u_char * pptr, register u_int len,
return fdatatlv_print(dp, tll, op_msk, indent);
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -999,7 +1000,7 @@ pd_err:
return len;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1062,7 +1063,7 @@ pdata_print(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1107,7 +1108,7 @@ genoptlv_print(register const u_char * pptr, register u_int len,
}
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1161,7 +1162,7 @@ recpdoptlv_print(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1221,7 +1222,7 @@ otlv_print(const struct forces_tlv *otlv, u_int16_t op_msk _U_, int indent)
return rc;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1278,7 +1279,7 @@ asttlv_print(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1330,7 +1331,7 @@ asrtlv_print(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1379,7 +1380,7 @@ print_metailv(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1419,7 +1420,7 @@ print_metatlv(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1506,7 +1507,7 @@ redirect_print(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1587,7 +1588,7 @@ lfbselect_print(register const u_char * pptr, register u_int len,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1676,7 +1677,7 @@ forces_type_print(register const u_char * pptr, const struct forcesh *fhdr _U_,
return 0;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -1752,5 +1753,5 @@ error:
return;
trunc:
- fputs("[|forces]", stdout);
+ printf("%s", tstr);
}
diff --git a/print-gre.c b/print-gre.c
index b4ad09a4..66a40f94 100644
--- a/print-gre.c
+++ b/print-gre.c
@@ -57,6 +57,8 @@ static const char rcsid[] _U_ =
#include "ip.h"
#include "ethertype.h"
+static const char tstr[] = "[|gre]";
+
#define GRE_CP 0x8000 /* checksum present */
#define GRE_RP 0x4000 /* routing present */
#define GRE_KP 0x2000 /* key present */
@@ -94,7 +96,7 @@ gre_print(const u_char *bp, u_int length)
u_int len = length, vers;
if (len < 2) {
- printf("[|gre]");
+ printf("%s", tstr);
return;
}
vers = EXTRACT_16BITS(bp) & GRE_VERS_MASK;
@@ -234,7 +236,7 @@ gre_print_0(const u_char *bp, u_int length)
return;
trunc:
- printf("[|gre]");
+ printf("%s", tstr);
}
void
@@ -314,7 +316,7 @@ gre_print_1(const u_char *bp, u_int length)
return;
trunc:
- printf("[|gre]");
+ printf("%s", tstr);
}
void
diff --git a/print-igmp.c b/print-igmp.c
index bc431026..b7a22f8c 100644
--- a/print-igmp.c
+++ b/print-igmp.c
@@ -41,6 +41,8 @@ static const char rcsid[] _U_ =
#define IN_CLASSD(i) (((int32_t)(i) & 0xf0000000) == 0xe0000000)
#endif
+static const char tstr[] = "[|igmp]";
+
/* (following from ipmulti/mrouted/prune.h) */
/*
@@ -124,7 +126,7 @@ print_mtrace(register const u_char *bp, register u_int len)
printf(" with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid)));
return;
trunc:
- (void)printf("[|igmp]");
+ printf("%s", tstr);
return;
}
@@ -146,7 +148,7 @@ print_mresp(register const u_char *bp, register u_int len)
printf(" with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid)));
return;
trunc:
- (void)printf("[|igmp]");
+ printf("%s", tstr);
return;
}
@@ -200,7 +202,7 @@ print_igmpv3_report(register const u_char *bp, register u_int len)
}
return;
trunc:
- (void)printf("[|igmp]");
+ (void)printf("%s", tstr);
return;
}
@@ -256,7 +258,7 @@ print_igmpv3_query(register const u_char *bp, register u_int len)
(void)printf("]");
return;
trunc:
- (void)printf("[|igmp]");
+ (void)printf("%s", tstr);
return;
}
@@ -340,5 +342,5 @@ igmp_print(register const u_char *bp, register u_int len)
}
return;
trunc:
- fputs("[|igmp]", stdout);
+ (void)printf("%s", tstr);
}
diff --git a/print-ip.c b/print-ip.c
index c74bdae1..8a2fa2e3 100644
--- a/print-ip.c
+++ b/print-ip.c
@@ -41,6 +41,8 @@ static const char rcsid[] _U_ =
#include "ip.h"
#include "ipproto.h"
+static const char tstr[] = "[|ip]";
+
static const struct tok ip_option_values[] = {
{ IPOPT_EOL, "EOL" },
{ IPOPT_NOP, "NOP" },
@@ -298,7 +300,7 @@ ip_optprint(register const u_char *cp, u_int length)
return;
trunc:
- printf("[|ip]");
+ printf("%s", tstr);
}
#define IP_RES 0x8000
@@ -536,7 +538,7 @@ ip_print(netdissect_options *ndo,
printf("IP ");
if ((u_char *)(ipds->ip + 1) > ndo->ndo_snapend) {
- printf("[|ip]");
+ printf("%s", tstr);
return;
}
if (length < sizeof (struct ip)) {
diff --git a/print-krb.c b/print-krb.c
index 733334bf..2cf9c989 100644
--- a/print-krb.c
+++ b/print-krb.c
@@ -38,6 +38,8 @@ static const char rcsid[] _U_ =
#include "addrtoname.h"
#include "extract.h"
+static const char tstr[] = " [|kerberos]";
+
static const u_char *c_print(register const u_char *, register const u_char *);
static const u_char *krb4_print_hdr(const u_char *);
static void krb4_print(const u_char *);
@@ -69,8 +71,6 @@ struct krb {
u_int8_t type; /* Type+B */
};
-static char tstr[] = " [|kerberos]";
-
static const struct tok type2str[] = {
{ AUTH_MSG_KDC_REQUEST, "KDC_REQUEST" },
{ AUTH_MSG_KDC_REPLY, "KDC_REPLY" },
diff --git a/print-l2tp.c b/print-l2tp.c
index 840239cd..ebb10a98 100644
--- a/print-l2tp.c
+++ b/print-l2tp.c
@@ -38,7 +38,7 @@ static const char rcsid[] _U_ =
#include "interface.h"
#include "extract.h"
-static char tstr[] = " [|l2tp]";
+static const char tstr[] = " [|l2tp]";
#define L2TP_MSGTYPE_SCCRQ 1 /* Start-Control-Connection-Request */
#define L2TP_MSGTYPE_SCCRP 2 /* Start-Control-Connection-Reply */
diff --git a/print-nfs.c b/print-nfs.c
index 5cd1adf3..eeb00c28 100644
--- a/print-nfs.c
+++ b/print-nfs.c
@@ -48,6 +48,8 @@ static const char rcsid[] _U_ =
#include "rpc_auth.h"
#include "rpc_msg.h"
+static const char tstr[] = " [|nfs]";
+
static void nfs_printfh(const u_int32_t *, const u_int);
static int xid_map_enter(const struct sunrpc_msg *, const u_char *);
static int xid_map_find(const struct sunrpc_msg *, const u_char *,
@@ -309,7 +311,7 @@ nfsreply_print(register const u_char *bp, u_int length,
trunc:
if (!nfserr)
- fputs(" [|nfs]", stdout);
+ printf("%s", tstr);
}
void
@@ -411,7 +413,7 @@ nfsreply_print_noaddr(register const u_char *bp, u_int length,
trunc:
if (!nfserr)
- fputs(" [|nfs]", stdout);
+ printf("%s", tstr);
}
/*
@@ -545,7 +547,7 @@ nfsreq_print(register const u_char *bp, u_int length,
trunc:
if (!nfserr)
- fputs(" [|nfs]", stdout);
+ printf("%s", tstr);
}
void
@@ -872,7 +874,7 @@ nfsreq_print_noaddr(register const u_char *bp, u_int length,
trunc:
if (!nfserr)
- fputs(" [|nfs]", stdout);
+ printf("%s", tstr);
}
/*
@@ -1882,5 +1884,5 @@ interp_reply(const struct sunrpc_msg *rp, u_int32_t proc, u_int32_t vers, int le
}
trunc:
if (!nfserr)
- fputs(" [|nfs]", stdout);
+ printf("%s", tstr);
}
diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c
index 435b424b..73a9fd88 100644
--- a/print-openflow-1.0.c
+++ b/print-openflow-1.0.c
@@ -56,6 +56,9 @@
#include "ipproto.h"
#include "openflow.h"
+static const char tstr[] = " [|openflow]";
+static const char cstr[] = " (corrupt)";
+
#define OFPT_HELLO 0x00
#define OFPT_ERROR 0x01
#define OFPT_ECHO_REQUEST 0x02
@@ -623,7 +626,7 @@ of10_data_print(const u_char *cp, const u_char *ep, const u_int len) {
return cp + len;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -640,11 +643,11 @@ of10_vendor_data_print(const u_char *cp, const u_char *ep, const u_int len) {
return of10_data_print(cp, ep, len - 4);
corrupt: /* skip the undersized data */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp, len);
return cp + len;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -664,7 +667,7 @@ of10_packet_data_print(const u_char *cp, const u_char *ep, const u_int len) {
return cp + len;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -733,11 +736,11 @@ next_port:
return cp;
corrupt: /* skip the undersized trailing data */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp0, len0);
return cp0 + len0;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -807,11 +810,11 @@ next_property:
return cp;
corrupt: /* skip the rest of queue properties */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp0, len0);
return cp0 + len0;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -853,11 +856,11 @@ next_queue:
return cp;
corrupt: /* skip the rest of queues */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp0, len0);
return cp0 + len0;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -959,7 +962,7 @@ of10_match_print(const char *pfx, const u_char *cp, const u_char *ep) {
return cp + 2;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1120,11 +1123,11 @@ next_action:
return cp;
corrupt: /* skip the rest of actions */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp0, len0);
return cp0 + len0;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1160,7 +1163,7 @@ of10_features_reply_print(const u_char *cp, const u_char *ep, const u_int len) {
return of10_phy_ports_print(cp, ep, len - OF_SWITCH_FEATURES_LEN);
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1216,7 +1219,7 @@ of10_flow_mod_print(const u_char *cp, const u_char *ep, const u_int len) {
return of10_actions_print("\n\t ", cp, ep, len - OF_FLOW_MOD_LEN);
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1251,7 +1254,7 @@ of10_port_mod_print(const u_char *cp, const u_char *ep) {
return cp + 4;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1329,11 +1332,11 @@ of10_stats_request_print(const u_char *cp, const u_char *ep, u_int len) {
return cp;
corrupt: /* skip the message body */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp0, len0);
return cp0 + len0;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1374,11 +1377,11 @@ of10_desc_stats_reply_print(const u_char *cp, const u_char *ep, const u_int len)
return cp + DESC_STR_LEN;
corrupt: /* skip the message body */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp, len);
return cp + len;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1453,11 +1456,11 @@ of10_flow_stats_reply_print(const u_char *cp, const u_char *ep, u_int len) {
return cp;
corrupt: /* skip the rest of flow statistics entries */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp0, len0);
return cp0 + len0;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1484,11 +1487,11 @@ of10_aggregate_stats_reply_print(const u_char *cp, const u_char *ep,
return cp + 4;
corrupt: /* skip the message body */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp, len);
return cp + len;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1541,11 +1544,11 @@ of10_table_stats_reply_print(const u_char *cp, const u_char *ep, u_int len) {
return cp;
corrupt: /* skip the undersized trailing data */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp0, len0);
return cp0 + len0;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1624,11 +1627,11 @@ next_port:
return cp;
corrupt: /* skip the undersized trailing data */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp0, len0);
return cp0 + len0;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1670,11 +1673,11 @@ of10_queue_stats_reply_print(const u_char *cp, const u_char *ep, u_int len) {
return cp;
corrupt: /* skip the undersized trailing data */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp0, len0);
return cp0 + len0;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1712,7 +1715,7 @@ of10_stats_reply_print(const u_char *cp, const u_char *ep, const u_int len) {
return cp0 + len;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1744,11 +1747,11 @@ of10_packet_out_print(const u_char *cp, const u_char *ep, const u_int len) {
return of10_packet_data_print(cp, ep, len - OF_PACKET_OUT_LEN - actions_len);
corrupt: /* skip the rest of the message body */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp0, len0);
return cp0 + len0;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1779,7 +1782,7 @@ of10_packet_in_print(const u_char *cp, const u_char *ep, const u_int len) {
return of10_packet_data_print(cp, ep, len - (OF_PACKET_IN_LEN - 2));
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1831,7 +1834,7 @@ of10_flow_removed_print(const u_char *cp, const u_char *ep) {
return cp + 8;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -1862,7 +1865,7 @@ of10_error_print(const u_char *cp, const u_char *ep, const u_int len) {
return of10_data_print(cp, ep, len - OF_ERROR_MSG_LEN);
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
@@ -2039,11 +2042,11 @@ of10_header_body_print(const u_char *cp, const u_char *ep, const uint8_t type,
goto next_message;
corrupt: /* skip the message body */
- printf(" (corrupt)");
+ printf("%s", cstr);
next_message:
TCHECK2(*cp0, len0 - OF_HEADER_LEN);
return cp0 + len0 - OF_HEADER_LEN;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
diff --git a/print-openflow.c b/print-openflow.c
index 5dbefac0..d37f7ba3 100644
--- a/print-openflow.c
+++ b/print-openflow.c
@@ -40,6 +40,9 @@
#include "extract.h"
#include "openflow.h"
+static const char tstr[] = " [|openflow]";
+static const char cstr[] = " (corrupt)";
+
#define OF_VER_1_0 0x01
static void
@@ -95,11 +98,11 @@ of_header_body_print(const u_char *cp, const u_char *ep) {
}
corrupt: /* fail current packet */
- printf(" (corrupt)");
+ printf("%s", cstr);
TCHECK2(*cp, ep - cp);
return ep;
trunc:
- printf(" [|openflow]");
+ printf("%s", tstr);
return ep;
}
diff --git a/print-ospf.c b/print-ospf.c
index 9533cb63..0841c096 100644
--- a/print-ospf.c
+++ b/print-ospf.c
@@ -43,6 +43,8 @@ static const char rcsid[] _U_ =
#include "ip.h"
+static const char tstr[] = " [|ospf2]";
+
static const struct tok ospf_option_values[] = {
{ OSPF_OPTION_T, "MultiTopology" }, /* draft-ietf-ospf-mt-09 */
{ OSPF_OPTION_E, "External" },
@@ -185,8 +187,6 @@ static const struct tok ospf_lls_eo_options[] = {
{ 0, NULL }
};
-static char tstr[] = " [|ospf2]";
-
static int ospf_print_lshdr(const struct lsa_hdr *);
static const u_char *ospf_print_lsa(const struct lsa *);
static int ospf_decode_v2(const struct ospfhdr *, const u_char *);
diff --git a/print-ospf6.c b/print-ospf6.c
index 0b28248f..e95e4371 100644
--- a/print-ospf6.c
+++ b/print-ospf6.c
@@ -42,6 +42,8 @@ static const char rcsid[] _U_ =
#include "ospf.h"
#include "ospf6.h"
+static const char tstr[] = " [|ospf3]";
+
static const struct tok ospf6_option_values[] = {
{ OSPF6_OPTION_V6, "V6" },
{ OSPF6_OPTION_E, "External" },
@@ -118,8 +120,6 @@ static const struct tok ospf6_lsa_prefix_option_values[] = {
{ 0, NULL }
};
-static char tstr[] = " [|ospf3]";
-
/* Forwards */
static void ospf6_print_ls_type(u_int, const rtrid_t *);
static int ospf6_print_lshdr(const struct lsa6_hdr *);
diff --git a/print-pflog.c b/print-pflog.c
index 8a3b66aa..0798d941 100644
--- a/print-pflog.c
+++ b/print-pflog.c
@@ -46,6 +46,8 @@ static const char rcsid[] _U_ =
#include "interface.h"
#include "addrtoname.h"
+static const char tstr[] = "[|pflog]";
+
static const struct tok pf_reasons[] = {
{ 0, "0(match)" },
{ 1, "1(bad-offset)" },
@@ -120,7 +122,7 @@ pflog_if_print(const struct pcap_pkthdr *h, register const u_char *p)
/* check length */
if (caplen < sizeof(u_int8_t)) {
- printf("[|pflog]");
+ printf("%s", pflog);
return (caplen);
}
@@ -133,7 +135,7 @@ pflog_if_print(const struct pcap_pkthdr *h, register const u_char *p)
hdrlen = BPF_WORDALIGN(hdr->length);
if (caplen < hdrlen) {
- printf("[|pflog]");
+ printf("%s", pflog);
return (hdrlen); /* XXX: true? */
}
@@ -176,7 +178,7 @@ pflog_if_print(const struct pcap_pkthdr *h, register const u_char *p)
return (hdrlen);
trunc:
- printf("[|pflog]");
+ printf("%s", pflog);
return (hdrlen);
}
diff --git a/print-pptp.c b/print-pptp.c
index 2fbba621..ce39b6d2 100644
--- a/print-pptp.c
+++ b/print-pptp.c
@@ -38,7 +38,7 @@ static const char rcsid[] _U_ =
#include "interface.h"
#include "extract.h"
-static char tstr[] = " [|pptp]";
+static const char tstr[] = " [|pptp]";
#define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
#define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
diff --git a/print-radius.c b/print-radius.c
index 74fd72d1..a1efa446 100644
--- a/print-radius.c
+++ b/print-radius.c
@@ -62,6 +62,8 @@ static const char rcsid[] _U_ =
#include "extract.h"
#include "oui.h"
+static const char tstr[] = " [|radius]";
+
#define TAM_SIZE(x) (sizeof(x)/sizeof(x[0]) )
#define PRINT_HEX(bytes_len, ptr_data) \
@@ -456,7 +458,7 @@ print_attr_string(register u_char *data, u_int length, u_short attr_code )
case TUNNEL_PASS:
if (length < 3)
{
- printf(" [|radius]");
+ printf("%s", tstr);
return;
}
if (*data && (*data <=0x1F) )
@@ -477,7 +479,7 @@ print_attr_string(register u_char *data, u_int length, u_short attr_code )
{
if (length < 1)
{
- printf(" [|radius]");
+ printf("%s", tstr);
return;
}
printf("Tag %u",*data);
@@ -493,7 +495,7 @@ print_attr_string(register u_char *data, u_int length, u_short attr_code )
return;
trunc:
- printf(" [|radius]");
+ printf("%s", tstr);
}
/*
@@ -554,7 +556,7 @@ print_vendor_attr(register u_char *data, u_int length, u_short attr_code _U_)
return;
trunc:
- printf(" [|radius]");
+ printf("%s", tstr);
}
@@ -671,7 +673,7 @@ print_attr_num(register u_char *data, u_int length, u_short attr_code )
return;
trunc:
- printf(" [|radius]");
+ printf("%s", tstr);
}
@@ -714,7 +716,7 @@ print_attr_address(register u_char *data, u_int length, u_short attr_code )
return;
trunc:
- printf(" [|radius]");
+ printf("%s", tstr);
}
@@ -747,7 +749,7 @@ static void print_attr_time(register u_char *data, u_int length, u_short attr_co
return;
trunc:
- printf(" [|radius]");
+ printf("%s", tstr);
}
@@ -824,7 +826,7 @@ static void print_attr_strange(register u_char *data, u_int length, u_short attr
return;
trunc:
- printf(" [|radius]");
+ printf("%s", tstr);
}
@@ -886,7 +888,7 @@ radius_attrs_print(register const u_char *attr, u_int length)
return;
trunc:
- printf(" [|radius]");
+ printf("%s", tstr);
}
@@ -902,7 +904,7 @@ radius_print(const u_char *dat, u_int length)
if (len < MIN_RADIUS_LEN)
{
- printf(" [|radius]");
+ printf("%s", tstr);
return;
}
@@ -933,5 +935,5 @@ radius_print(const u_char *dat, u_int length)
return;
trunc:
- printf(" [|radius]");
+ printf("%s", tstr);
}
diff --git a/print-rip.c b/print-rip.c
index e941947d..bd17d5f1 100644
--- a/print-rip.c
+++ b/print-rip.c
@@ -39,6 +39,8 @@ static const char rcsid[] _U_ =
#include "af.h"
+static const char tstr[] = "[|rip]";
+
struct rip {
u_int8_t rip_cmd; /* request/response */
u_int8_t rip_vers; /* protocol version # */
@@ -182,14 +184,14 @@ rip_print(const u_char *dat, u_int length)
register u_int i, j;
if (snapend < dat) {
- printf(" [|rip]");
+ printf(" %s", tstr);
return;
}
i = snapend - dat;
if (i > length)
i = length;
if (i < sizeof(*rp)) {
- printf(" [|rip]");
+ printf(" %s", tstr);
return;
}
i -= sizeof(*rp);
@@ -244,7 +246,7 @@ rip_print(const u_char *dat, u_int length)
break;
}
if (i)
- printf("[|rip]");
+ printf("%s", tstr);
break;
case RIPCMD_TRACEOFF:
diff --git a/print-sl.c b/print-sl.c
index 91dbaadc..2b61f28d 100644
--- a/print-sl.c
+++ b/print-sl.c
@@ -42,6 +42,8 @@ static const char rcsid[] _U_ =
#include "slip.h"
#include "slcompress.h"
+static const char tstr[] = "[|slip]";
+
static u_int lastlen[2][256];
static u_int lastconn = 255;
@@ -56,7 +58,7 @@ sl_if_print(const struct pcap_pkthdr *h, const u_char *p)
register const struct ip *ip;
if (caplen < SLIP_HDRLEN) {
- printf("[|slip]");
+ printf("%s", tstr);
return (caplen);
}
@@ -91,7 +93,7 @@ sl_bsdos_if_print(const struct pcap_pkthdr *h, const u_char *p)
register const struct ip *ip;
if (caplen < SLIP_HDRLEN) {
- printf("[|slip]");
+ printf("%s", tstr);
return (caplen);
}
diff --git a/print-smb.c b/print-smb.c
index cc7bd6fd..e1c2f799 100644
--- a/print-smb.c
+++ b/print-smb.c
@@ -24,6 +24,8 @@ static const char rcsid[] _U_ =
#include "extract.h"
#include "smb.h"
+static const char tstr[] = "[|SMB]";
+
static int request = 0;
static int unicodestr = 0;
@@ -140,7 +142,7 @@ trans2_qfsinfo(const u_char *param, const u_char *data, int pcnt, int dcnt)
}
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -234,7 +236,7 @@ print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_
}
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -316,7 +318,7 @@ print_browse(const u_char *param, int paramlen, const u_char *data, int datalen)
}
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -389,7 +391,7 @@ print_trans(const u_char *words, const u_char *data1, const u_char *buf, const u
}
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -431,7 +433,7 @@ print_negprot(const u_char *words, const u_char *data, const u_char *buf _U_, co
}
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -475,7 +477,7 @@ print_sesssetup(const u_char *words, const u_char *data, const u_char *buf _U_,
}
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -515,7 +517,7 @@ print_lockingandx(const u_char *words, const u_char *data, const u_char *buf _U_
}
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -914,7 +916,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
printf("\n");
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -1078,7 +1080,7 @@ nbt_tcp_print(const u_char *data, int length)
}
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -1240,7 +1242,7 @@ out:
fflush(stdout);
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -1282,7 +1284,7 @@ smb_tcp_print (const u_char * data, int length)
printf("SMB-over-TCP packet:(raw data or continuation?)\n");
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
@@ -1471,7 +1473,7 @@ out:
printf("\n");
return;
trunc:
- printf("[|SMB]");
+ printf("%s", tstr);
return;
}
diff --git a/print-snmp.c b/print-snmp.c
index 85005669..1fd34eab 100644
--- a/print-snmp.c
+++ b/print-snmp.c
@@ -79,6 +79,8 @@ static const char rcsid[] _U_ =
#undef OPAQUE /* defined in <wingdi.h> */
+static const char tstr[] = "[|snmp]";
+
/*
* Universal ASN.1 types
* (we only care about the tag values for those allowed in the Internet SMI)
@@ -653,7 +655,7 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
return elem->asnlen + hdr;
trunc:
- fputs("[|snmp]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -834,7 +836,7 @@ asn1_print(struct be *elem)
return 0;
trunc:
- fputs("[|snmp]", stdout);
+ printf("%s", tstr);
return -1;
}
@@ -930,7 +932,7 @@ smi_decode_oid(struct be *elem, unsigned int *oid,
return 0;
trunc:
- fputs("[|snmp]", stdout);
+ printf("%s", tstr);
return -1;
}
diff --git a/print-syslog.c b/print-syslog.c
index f213cf27..07ba2059 100644
--- a/print-syslog.c
+++ b/print-syslog.c
@@ -31,6 +31,8 @@ static const char rcsid[] _U_ =
#include "interface.h"
#include "extract.h"
+static const char tstr[] = "[|syslog]";
+
/*
* tokenlists and #defines taken from Ethereal - Network traffic analyzer
* by Gerald Combs <gerald@ethereal.com>
@@ -105,12 +107,12 @@ syslog_print(register const u_char *pptr, register u_int len)
TCHECK2(*(pptr+msg_off), 1);
}
if (*(pptr+msg_off) != '>') {
- printf("[|syslog]");
+ printf("%s", tstr);
return;
}
msg_off++;
} else {
- printf("[|syslog]");
+ printf("%s", tstr);
return;
}
@@ -145,5 +147,5 @@ syslog_print(register const u_char *pptr, register u_int len)
return;
trunc:
- printf("[|syslog]");
+ printf("%s", tstr);
}
diff --git a/print-tftp.c b/print-tftp.c
index 62e2c998..fcd009d9 100644
--- a/print-tftp.c
+++ b/print-tftp.c
@@ -44,6 +44,8 @@ static const char rcsid[] _U_ =
#include "extract.h"
#include "tftp.h"
+static const char tstr[] = " [|tftp]";
+
/* op code to string mapping */
static const struct tok op2str[] = {
{ RRQ, "RRQ" }, /* read request */
@@ -78,7 +80,6 @@ tftp_print(register const u_char *bp, u_int length)
register const char *cp;
register const u_char *p;
register int opcode, i;
- static char tstr[] = " [|tftp]";
tp = (const struct tftphdr *)bp;
diff --git a/print-timed.c b/print-timed.c
index 55fbb39e..f3cf6bc5 100644
--- a/print-timed.c
+++ b/print-timed.c
@@ -37,6 +37,8 @@ static const char rcsid[] _U_ =
#include "interface.h"
#include "extract.h"
+static const char tstr[] = "[|timed]";
+
static const char *tsptype[TSPTYPENUMBER] =
{ "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
"SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT",
@@ -52,7 +54,7 @@ timed_print(register const u_char *bp)
const u_char *end;
if (endof(tsp->tsp_type) > snapend) {
- fputs("[|timed]", stdout);
+ printf("%s", tstr);
return;
}
if (tsp->tsp_type < TSPTYPENUMBER)
@@ -61,20 +63,20 @@ timed_print(register const u_char *bp)
printf("(tsp_type %#x)", tsp->tsp_type);
if (endof(tsp->tsp_vers) > snapend) {
- fputs(" [|timed]", stdout);
+ printf(" %s", tstr);
return;
}
printf(" vers %d", tsp->tsp_vers);
if (endof(tsp->tsp_seq) > snapend) {
- fputs(" [|timed]", stdout);
+ printf(" %s", tstr);
return;
}
printf(" seq %d", tsp->tsp_seq);
if (tsp->tsp_type == TSP_LOOP) {
if (endof(tsp->tsp_hopcnt) > snapend) {
- fputs(" [|timed]", stdout);
+ printf(" %s", tstr);
return;
}
printf(" hopcnt %d", tsp->tsp_hopcnt);
@@ -83,7 +85,7 @@ timed_print(register const u_char *bp)
tsp->tsp_type == TSP_SETDATE ||
tsp->tsp_type == TSP_SETDATEREQ) {
if (endof(tsp->tsp_time) > snapend) {
- fputs(" [|timed]", stdout);
+ printf(" %s", tstr);
return;
}
sec = EXTRACT_32BITS(&tsp->tsp_time.tv_sec);
@@ -103,7 +105,7 @@ timed_print(register const u_char *bp)
end = memchr(tsp->tsp_name, '\0', snapend - (u_char *)tsp->tsp_name);
if (end == NULL)
- fputs(" [|timed]", stdout);
+ printf(" %s", tstr);
else {
fputs(" name ", stdout);
fwrite(tsp->tsp_name, end - (u_char *)tsp->tsp_name, 1, stdout);
diff --git a/print-tipc.c b/print-tipc.c
index 8f2f7691..8dc3abbc 100644
--- a/print-tipc.c
+++ b/print-tipc.c
@@ -39,6 +39,8 @@ static const char rcsid[] _U_ =
#include "ethertype.h"
#include "extract.h" /* must come after interface.h */
+static const char tstr[] = "[|TIPC]";
+
/*
* Transparent Inter-Process Communication (TIPC) protocol.
*
@@ -223,7 +225,7 @@ print_payload(netdissect_options *ndo, const struct payload_tipc_pkthdr *ap)
return;
trunc:
- ND_PRINT((ndo, "[|TIPC]"));
+ ND_PRINT((ndo, "%s", tstr));
}
static void
@@ -291,7 +293,7 @@ print_internal(netdissect_options *ndo, const struct internal_tipc_pkthdr *ap)
return;
trunc:
- ND_PRINT((ndo, "[|TIPC]"));
+ ND_PRINT((ndo, "%s", tstr));
}
static void
@@ -338,7 +340,7 @@ print_link_conf(netdissect_options *ndo, const struct link_conf_tipc_pkthdr *ap)
return;
trunc:
- ND_PRINT((ndo, "[|TIPC]"));
+ ND_PRINT((ndo, "%s", tstr));
}
void
@@ -381,7 +383,7 @@ tipc_print(netdissect_options *ndo, const u_char *bp, u_int length _U_,
return;
trunc:
- ND_PRINT((ndo, "[|TIPC]"));
+ ND_PRINT((ndo, "%s", tstr));
}
/*
diff --git a/print-token.c b/print-token.c
index 4f8422b5..1fee3d38 100644
--- a/print-token.c
+++ b/print-token.c
@@ -46,6 +46,8 @@ static const char rcsid[] _U_ =
#include "ether.h"
#include "token.h"
+static const char tstr[] = "[|token-ring]";
+
/* Extract src, dst addresses */
static inline void
extract_token_addrs(const struct token_header *trp, char *fsrc, char *fdst)
@@ -110,7 +112,7 @@ token_print(const u_char *p, u_int length, u_int caplen)
trp = (const struct token_header *)p;
if (caplen < TOKEN_HDRLEN) {
- printf("[|token-ring]");
+ printf("%s", tstr);
return hdr_len;
}
@@ -128,13 +130,13 @@ token_print(const u_char *p, u_int length, u_int caplen)
token_hdr_print(trp, length, ESRC(&ehdr), EDST(&ehdr));
if (caplen < TOKEN_HDRLEN + 2) {
- printf("[|token-ring]");
+ printf("%s", tstr);
return hdr_len;
}
route_len = RIF_LENGTH(trp);
hdr_len += route_len;
if (caplen < hdr_len) {
- printf("[|token-ring]");
+ printf("%s", tstr);
return hdr_len;
}
if (vflag) {
diff --git a/print-usb.c b/print-usb.c
index 8e15e7bf..425e35d4 100644
--- a/print-usb.c
+++ b/print-usb.c
@@ -35,6 +35,8 @@
#if defined(HAVE_PCAP_USB_H) && defined(DLT_USB_LINUX)
#include <pcap/usb.h>
+static const char tstr[] = "[|usb]";
+
/* returns direction: 1=inbound 2=outbound -1=invalid */
static int
get_direction(int transfer_type, int event_type)
@@ -138,7 +140,7 @@ u_int
usb_linux_48_byte_print(const struct pcap_pkthdr *h, register const u_char *p)
{
if (h->caplen < sizeof(pcap_usb_header)) {
- printf("[|usb]");
+ printf("%s", tstr);
return(sizeof(pcap_usb_header));
}
@@ -160,7 +162,7 @@ u_int
usb_linux_64_byte_print(const struct pcap_pkthdr *h, register const u_char *p)
{
if (h->caplen < sizeof(pcap_usb_header_mmapped)) {
- printf("[|usb]");
+ printf("%s", tstr);
return(sizeof(pcap_usb_header_mmapped));
}
diff --git a/print-zeromq.c b/print-zeromq.c
index b957b9b8..c40ed3b8 100644
--- a/print-zeromq.c
+++ b/print-zeromq.c
@@ -39,6 +39,8 @@
#include "interface.h"
#include "extract.h"
+static const char tstr[] = " [|zmtp1]";
+
/* Maximum number of ZMTP/1.0 frame body bytes (without the flags) to dump in
* hex and ASCII under a single "-v" flag.
*/
@@ -133,7 +135,7 @@ zmtp1_print_frame(const u_char *cp, const u_char *ep) {
return cp + header_len + body_len_declared;
trunc:
- printf(" [|zmtp1]");
+ printf("%s", tstr);
return ep;
}
@@ -200,7 +202,7 @@ zmtp1_print_intermediate_part(const u_char *cp, const u_int len) {
return cp + frame_offset;
trunc:
- printf(" [|zmtp1]");
+ printf("%s", tstr);
return cp + len;
}