mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-23 18:14:29 +08:00
(unsigned) casts in printf to make gcc happy
This commit is contained in:
parent
b41d5b1c87
commit
cf77b46229
36
print-cnfp.c
36
print-cnfp.c
@ -34,7 +34,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.4 2000-04-28 11:17:36 itojun Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.5 2000-05-15 00:37:34 assar Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -103,11 +103,12 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp)
|
||||
/* (p = ctime(&t))[24] = '\0'; */
|
||||
|
||||
printf("NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver,
|
||||
ntohl(nh->msys_uptime)/1000, ntohl(nh->msys_uptime)%1000,
|
||||
ntohl(nh->utc_sec), ntohl(nh->utc_nsec));
|
||||
(unsigned)ntohl(nh->msys_uptime)/1000,
|
||||
(unsigned)ntohl(nh->msys_uptime)%1000,
|
||||
(unsigned)ntohl(nh->utc_sec), (unsigned)ntohl(nh->utc_nsec));
|
||||
|
||||
if (ver == 5) {
|
||||
printf("#%u, ", htonl(nh->sequence));
|
||||
printf("#%u, ", (unsigned)htonl(nh->sequence));
|
||||
nr = (struct nfrec *)&nh[1];
|
||||
snaplen -= 24;
|
||||
} else {
|
||||
@ -122,33 +123,36 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp)
|
||||
char asbuf[20];
|
||||
|
||||
printf("\n started %u.%03u, last %u.%03u",
|
||||
ntohl(nr->start_time)/1000, ntohl(nr->start_time)%1000,
|
||||
ntohl(nr->last_time)/1000, ntohl(nr->last_time)%1000);
|
||||
(unsigned)ntohl(nr->start_time)/1000,
|
||||
(unsigned)ntohl(nr->start_time)%1000,
|
||||
(unsigned)ntohl(nr->last_time)/1000,
|
||||
(unsigned)ntohl(nr->last_time)%1000);
|
||||
|
||||
asbuf[0] = buf[0] = '\0';
|
||||
if (ver == 5) {
|
||||
snprintf(buf, sizeof(buf), "/%u",
|
||||
(ntohl(nr->masks) >> 24) & 0xff);
|
||||
(unsigned)(ntohl(nr->masks) >> 24) & 0xff);
|
||||
snprintf(asbuf, sizeof(asbuf), "%u:",
|
||||
(ntohl(nr->asses) >> 16) & 0xffff);
|
||||
(unsigned)(ntohl(nr->asses) >> 16) & 0xffff);
|
||||
}
|
||||
printf("\n %s%s%s:%u ", inet_ntoa(nr->src_ina), buf, asbuf,
|
||||
ntohl(nr->ports) >> 16);
|
||||
(unsigned)ntohl(nr->ports) >> 16);
|
||||
|
||||
if (ver == 5) {
|
||||
snprintf(buf, sizeof(buf), "/%d",
|
||||
(ntohl(nr->masks) >> 16) & 0xff);
|
||||
(unsigned)(ntohl(nr->masks) >> 16) & 0xff);
|
||||
snprintf(asbuf, sizeof(asbuf), "%u:",
|
||||
ntohl(nr->asses) & 0xffff);
|
||||
(unsigned)ntohl(nr->asses) & 0xffff);
|
||||
}
|
||||
printf("> %s%s%s:%u ", inet_ntoa(nr->dst_ina), buf, asbuf,
|
||||
ntohl(nr->ports) & 0xffff);
|
||||
(unsigned)ntohl(nr->ports) & 0xffff);
|
||||
|
||||
printf(">> %s\n ", inet_ntoa(nr->nhop_ina));
|
||||
|
||||
pent = getprotobynumber((ntohl(nr->proto_tos) >> 8) & 0xff);
|
||||
if (!pent || nflag)
|
||||
printf("%u ", (ntohl(nr->proto_tos) >> 8) & 0xff);
|
||||
printf("%u ",
|
||||
(unsigned)(ntohl(nr->proto_tos) >> 8) & 0xff);
|
||||
else
|
||||
printf("%s ", pent->p_name);
|
||||
|
||||
@ -168,7 +172,9 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp)
|
||||
if (flags)
|
||||
putchar(' ');
|
||||
}
|
||||
printf("tos %u, %u (%u octets)", ntohl(nr->proto_tos) & 0xff,
|
||||
ntohl(nr->packets), ntohl(nr->octets));
|
||||
printf("tos %u, %u (%u octets)",
|
||||
(unsigned)ntohl(nr->proto_tos) & 0xff,
|
||||
(unsigned)ntohl(nr->packets),
|
||||
(unsigned)ntohl(nr->octets));
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/Attic/print-lcp.c,v 1.4 2000-04-24 12:59:39 itojun Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/Attic/print-lcp.c,v 1.5 2000-05-15 00:38:37 assar Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -181,7 +181,7 @@ lcp_print(register const u_char *bp, u_int length)
|
||||
case LCP_ASYNCMAP:
|
||||
case LCP_MAGICNUM:
|
||||
if (snapend < p+4) return;
|
||||
printf("%#x",ntohl(*(u_long*)p));
|
||||
printf("%#x", (unsigned)ntohl(*(u_long*)p));
|
||||
if (lcpopt_length != 6) printf(" len=%d!",lcpopt_length);
|
||||
break;
|
||||
case LCP_PCOMP:
|
||||
@ -202,7 +202,7 @@ lcp_print(register const u_char *bp, u_int length)
|
||||
case LCP_ECHOREP:
|
||||
case LCP_DISCARD:
|
||||
if (snapend < lcp_data+4) return;
|
||||
printf(" magic=%#x", ntohl(*(u_long *) lcp_data));
|
||||
printf(" magic=%#x", (unsigned)ntohl(*(u_long *) lcp_data));
|
||||
lcp_data +=4;
|
||||
break;
|
||||
case LCP_PROTREJ:
|
||||
|
18
print-nfs.c
18
print-nfs.c
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.70 2000-01-28 00:04:19 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.71 2000-05-15 00:40:26 assar Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -434,7 +434,7 @@ nfsreq_print(register const u_char *bp, u_int length,
|
||||
if ((dp = parsereq(rp, length)) != NULL &&
|
||||
(dp = parsefh(dp, v3)) != NULL) {
|
||||
TCHECK(dp[0]);
|
||||
printf(" %04x", ntohl(dp[0]));
|
||||
printf(" %04x", (unsigned)ntohl(dp[0]));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -532,7 +532,9 @@ nfsreq_print(register const u_char *bp, u_int length,
|
||||
printf(" %s", tok2str(type2str, "unk-ft %d", type));
|
||||
if (vflag && (type == NFCHR || type == NFBLK)) {
|
||||
TCHECK(dp[1]);
|
||||
printf(" %u/%u", ntohl(dp[0]), ntohl(dp[1]));
|
||||
printf(" %u/%u",
|
||||
(unsigned)ntohl(dp[0]),
|
||||
(unsigned)ntohl(dp[1]));
|
||||
dp += 2;
|
||||
}
|
||||
if (vflag)
|
||||
@ -1059,7 +1061,8 @@ parserddires(const u_int32_t *dp)
|
||||
return (1);
|
||||
|
||||
TCHECK(dp[2]);
|
||||
printf(" offset %x size %d ", ntohl(dp[0]), ntohl(dp[1]));
|
||||
printf(" offset %x size %d ",
|
||||
(unsigned)ntohl(dp[0]), (unsigned)ntohl(dp[1]));
|
||||
if (dp[2] != 0)
|
||||
printf(" eof");
|
||||
|
||||
@ -1073,8 +1076,9 @@ parse_wcc_attr(const u_int32_t *dp)
|
||||
{
|
||||
printf(" sz ");
|
||||
print_int64(dp, UNSIGNED);
|
||||
printf(" mtime %u.%06u ctime %u.%06u", ntohl(dp[2]), ntohl(dp[3]),
|
||||
ntohl(dp[4]), ntohl(dp[5]));
|
||||
printf(" mtime %u.%06u ctime %u.%06u",
|
||||
(unsigned)ntohl(dp[2]), (unsigned)ntohl(dp[3]),
|
||||
(unsigned)ntohl(dp[4]), (unsigned)ntohl(dp[5]));
|
||||
return (dp + 6);
|
||||
}
|
||||
|
||||
@ -1341,7 +1345,7 @@ interp_reply(const struct rpc_msg *rp, u_int32_t proc, u_int32_t vers, int lengt
|
||||
if (!(dp = parse_post_op_attr(dp, vflag)))
|
||||
break;
|
||||
if (!er)
|
||||
printf(" c %04x", ntohl(dp[0]));
|
||||
printf(" c %04x", (unsigned)ntohl(dp[0]));
|
||||
return;
|
||||
|
||||
case NFSPROC_READLINK:
|
||||
|
Loading…
Reference in New Issue
Block a user