aboutsummaryrefslogtreecommitdiffstats
path: root/print-icmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'print-icmp.c')
-rw-r--r--print-icmp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/print-icmp.c b/print-icmp.c
index c33f83a691a4..170d5438f20f 100644
--- a/print-icmp.c
+++ b/print-icmp.c
@@ -400,7 +400,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
default:
(void)snprintf(buf, sizeof(buf),
- "%s protocol %d port %d unreachable",
+ "%s protocol %u port %u unreachable",
ipaddr_string(ndo, &oip->ip_dst),
oip->ip_p, dport);
break;
@@ -506,7 +506,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
break;
default:
- (void)snprintf(buf, sizeof(buf), "time exceeded-#%d",
+ (void)snprintf(buf, sizeof(buf), "time exceeded-#%u",
dp->icmp_code);
break;
}
@@ -515,11 +515,11 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
case ICMP_PARAMPROB:
if (dp->icmp_code)
(void)snprintf(buf, sizeof(buf),
- "parameter problem - code %d", dp->icmp_code);
+ "parameter problem - code %u", dp->icmp_code);
else {
ND_TCHECK(dp->icmp_pptr);
(void)snprintf(buf, sizeof(buf),
- "parameter problem - octet %d", dp->icmp_pptr);
+ "parameter problem - octet %u", dp->icmp_pptr);
}
break;
@@ -557,13 +557,15 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
}
ND_PRINT((ndo, "ICMP %s, length %u", str, plen));
if (ndo->ndo_vflag && !fragmented) { /* don't attempt checksumming if this is a frag */
- uint16_t sum, icmp_sum;
-
if (ND_TTEST2(*bp, plen)) {
+ uint16_t sum;
+
vec[0].ptr = (const uint8_t *)(const void *)dp;
vec[0].len = plen;
sum = in_cksum(vec, 1);
if (sum != 0) {
+ uint16_t icmp_sum;
+ ND_TCHECK_16BITS(&dp->icmp_cksum);
icmp_sum = EXTRACT_16BITS(&dp->icmp_cksum);
ND_PRINT((ndo, " (wrong icmp cksum %x (->%x)!)",
icmp_sum,