]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Make the -K flag suppress IP and UDP checksum checking as well.
authorGuy Harris <[email protected]>
Thu, 5 Mar 2009 09:17:53 +0000 (01:17 -0800)
committerGuy Harris <[email protected]>
Thu, 5 Mar 2009 09:17:53 +0000 (01:17 -0800)
print-ip.c
print-udp.c
tcpdump.1.in

index 8bdf5ebce3e2948bd29baa05120c96aebca919f3..3dd1edb9b0c5b0d2cf1cec7c04022430f4c970ae 100644 (file)
@@ -657,7 +657,7 @@ ip_print(netdissect_options *ndo,
                 printf(")");
             }
 
-           if ((u_char *)ipds->ip + hlen <= snapend) {
+           if (!Kflag && (u_char *)ipds->ip + hlen <= snapend) {
                sum = in_cksum((const u_short *)ipds->ip, hlen, 0);
                if (sum != 0) {
                    ip_sum = EXTRACT_16BITS(&ipds->ip->ip_sum);
index f534c1bb459e708bbe5dc392412804d6554dde08..f4517feed6465022c90247ff565e8aaec7d5e9b1 100644 (file)
@@ -568,7 +568,7 @@ udp_print(register const u_char *bp, u_int length,
        }
        udpipaddr_print(ip, sport, dport);
 
-       if (IP_V(ip) == 4 && (vflag > 1) && !fragmented) {
+       if (IP_V(ip) == 4 && vflag && !Kflag && !fragmented) {
                int sum = up->uh_sum;
                if (sum == 0) {
                        (void)printf("[no cksum] ");
@@ -581,7 +581,7 @@ udp_print(register const u_char *bp, u_int length,
                }
        }
 #ifdef INET6
-       if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !fragmented) {
+       if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !Kflag && !fragmented) {
                int sum = up->uh_sum;
                /* for IPv6, UDP checksum is mandatory */
                if (TTEST2(cp[0], length)) {
index 2be95d2e9387b75778b7d936922391892a37d725..f0f7ce05282806b14ff19eff5aae7684b85b3c83 100644 (file)
@@ -356,9 +356,9 @@ is specified, only those link-layer types available when in monitor mode
 will be shown.
 .TP
 .B \-K
-Don't attempt to verify TCP checksums.  This is useful for interfaces
-that perform the TCP checksum calculation in hardware; otherwise,
-all outgoing TCP checksums will be flagged as bad.
+Don't attempt to verify IP, TCP, or UDP checksums.  This is useful for
+interfaces that perform some or all of those checksum calculation in
+hardware; otherwise, all outgoing TCP checksums will be flagged as bad.
 .TP
 .B \-l
 Make stdout line buffered.