mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-24 10:33:28 +08:00
Handle ICMP6 checksums more like TCP checksums.
Instead of printing the result of icmp6_cksum() if it's non-zero, print the checksum field value and the value it should have had. That means that what we print is the same regardless of whether we're running on a big-endian or little-endian machine.
This commit is contained in:
parent
d9b4befd18
commit
879217e502
@ -319,12 +319,15 @@ icmp6_print(netdissect_options *ndo,
|
||||
TCHECK(dp->icmp6_cksum);
|
||||
|
||||
if (vflag && !fragmented) {
|
||||
int sum = dp->icmp6_cksum;
|
||||
u_int16_t sum, udp_sum;
|
||||
|
||||
if (TTEST2(bp[0], length)) {
|
||||
udp_sum = EXTRACT_16BITS(&dp->icmp6_cksum);
|
||||
sum = icmp6_cksum(ip, dp, length);
|
||||
if (sum != 0)
|
||||
(void)printf("[bad icmp6 cksum %x!] ", sum);
|
||||
(void)printf("[bad icmp6 cksum 0x%04x -> 0x%04x!] ",
|
||||
udp_sum,
|
||||
in_cksum_shouldbe(udp_sum, sum));
|
||||
else
|
||||
(void)printf("[icmp6 sum ok] ");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user