]> The Tcpdump Group git mirrors - tcpdump/commitdiff
From Ben Byer <[email protected]>: add a "-K" flag to suppress the
authorguy <guy>
Fri, 5 May 2006 23:13:00 +0000 (23:13 +0000)
committerguy <guy>
Fri, 5 May 2006 23:13:00 +0000 (23:13 +0000)
checking of TCP checksums.

Sort the argument processing code alphabetically.

CREDITS
interface.h
netdissect.h
print-tcp.c
tcpdump.1
tcpdump.c

diff --git a/CREDITS b/CREDITS
index 0d1194074244e627b1fcc18c135e52bd0215456d..e38eaf4c9969d8d70a21ad7209dc8ec325669e5f 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -22,6 +22,7 @@ Additional people who have contributed patches:
        Arkadiusz Miskiewicz            <[email protected]>
        Armando L. Caro Jr.             <[email protected]>
        Arnaldo Carvalho de Melo        <[email protected]>
+       Ben Byer                        <[email protected]>
        Atsushi Onoe                    <[email protected]>
        Ben Smithurst                   <[email protected]>
        Brent L. Bates                  <[email protected]>
index 73a49700093f70d7c1ef0e306dcbfed903a7ad48..8f347b07d61db9301450ccb508bc089d1dc5314a 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.269 2006-03-03 22:31:16 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.270 2006-05-05 23:13:00 guy Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -346,6 +346,7 @@ extern netdissect_options *gndo;
 
 #define eflag gndo->ndo_eflag 
 #define fflag gndo->ndo_fflag 
+#define Kflag gndo->ndo_Kflag 
 #define nflag gndo->ndo_nflag 
 #define Nflag gndo->ndo_Nflag 
 #define Oflag gndo->ndo_Oflag 
index 1f1c1bbe092e7e132d13d36a401b5dda9af6dc92..cfe086e36f90b89c9ba05f83930134fbb89a30e4 100644 (file)
@@ -21,7 +21,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.21 2006-02-08 01:38:17 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.22 2006-05-05 23:13:00 guy Exp $ (LBL)
  */
 
 #ifndef netdissect_h
@@ -85,6 +85,7 @@ struct netdissect_options {
   int ndo_aflag;               /* translate network and broadcast addresses */
   int ndo_eflag;               /* print ethernet header */
   int ndo_fflag;               /* don't translate "foreign" IP address */
+  int ndo_Kflag;               /* don't check TCP checksums */
   int ndo_nflag;               /* leave addresses as numbers */
   int ndo_Nflag;               /* remove domains from printed host names */
   int ndo_qflag;               /* quick (shorter) output */
index b5d70c82f66f2c80989e0a7e27d73de7fcdc15ee..8a3e293aee810703eca955c7a48dd94be962a311 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.124 2005-11-29 09:07:47 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.125 2006-05-05 23:13:00 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -420,7 +420,7 @@ tcp_print(register const u_char *bp, register u_int length,
                return;
        }
 
-       if (IP_V(ip) == 4 && vflag && !fragmented) {
+       if (IP_V(ip) == 4 && vflag && !Kflag && !fragmented) {
                u_int16_t sum, tcp_sum;
                if (TTEST2(tp->th_sport, length)) {
                        sum = tcp_cksum(ip, tp, length);
@@ -434,7 +434,7 @@ tcp_print(register const u_char *bp, register 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) {
                u_int16_t sum,tcp_sum;
                if (TTEST2(tp->th_sport, length)) {
                        sum = tcp6_cksum(ip6, tp, length);
index 0697588f9619f3cb0ba84c5a0cb8bb052d24c042..7077cf3bd93328f3ce4ac516f3bcc57008b29d5a 100644 (file)
--- a/tcpdump.1
+++ b/tcpdump.1
@@ -1,4 +1,4 @@
-.\" @(#) $Header: /tcpdump/master/tcpdump/Attic/tcpdump.1,v 1.181 2006-03-23 17:33:02 hannes Exp $ (LBL)
+.\" @(#) $Header: /tcpdump/master/tcpdump/Attic/tcpdump.1,v 1.182 2006-05-05 23:13:00 guy Exp $ (LBL)
 .\"
 .\"    $NetBSD: tcpdump.8,v 1.9 2003/03/31 00:18:17 perry Exp $
 .\"
@@ -29,7 +29,7 @@ tcpdump \- dump traffic on a network
 .na
 .B tcpdump
 [
-.B \-AdDeflLnNOpqRStuUvxX
+.B \-AdDefKlLnNOpqRStuUvxX
 ] [
 .B \-c
 .I count
@@ -396,6 +396,11 @@ used as the
 .I interface
 argument.
 .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.
+.TP
 .B \-l
 Make stdout line buffered.
 Useful if you want to see the data
index 918121a8e023a4c4847b5eba79dac24fe71d2d2f..7e1f129947e5053c0c7a9d844c1cf8a142c030a3 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.268 2006-03-23 17:33:01 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.269 2006-05-05 23:13:01 guy Exp $ (LBL)";
 #endif
 
 /*
@@ -523,7 +523,7 @@ main(int argc, char **argv)
 
        opterr = 0;
        while (
-           (op = getopt(argc, argv, "aA" B_FLAG "c:C:d" D_FLAG "eE:fF:G:i:lLm:M:nNOpqr:Rs:StT:u" U_FLAG "vw:W:xXy:Yz:Z:")) != -1)
+           (op = getopt(argc, argv, "aA" B_FLAG "c:C:d" D_FLAG "eE:fF:G:i:KlLm:M:nNOpqr:Rs:StT:u" U_FLAG "vw:W:xXy:Yz:Z:")) != -1)
                switch (op) {
 
                case 'a':
@@ -668,12 +668,8 @@ main(int argc, char **argv)
 #endif /* WIN32 */
                        break;
 
-               case 'n':
-                       ++nflag;
-                       break;
-
-               case 'N':
-                       ++Nflag;
+               case 'K':
+                       ++Kflag;
                        break;
 
                case 'm':
@@ -697,6 +693,14 @@ main(int argc, char **argv)
                        tcpmd5secret = optarg;
                        break;
 
+               case 'n':
+                       ++nflag;
+                       break;
+
+               case 'N':
+                       ++Nflag;
+                       break;
+
                case 'O':
                        Oflag = 0;
                        break;
@@ -1567,7 +1571,7 @@ usage(void)
 #endif /* WIN32 */
 #endif /* HAVE_PCAP_LIB_VERSION */
        (void)fprintf(stderr,
-"Usage: %s [-aAd" D_FLAG "eflLnNOpqRStu" U_FLAG "vxX]" B_FLAG_USAGE " [-c count] [ -C file_size ]\n", program_name);
+"Usage: %s [-aAd" D_FLAG "efKlLnNOpqRStu" U_FLAG "vxX]" B_FLAG_USAGE " [-c count] [ -C file_size ]\n", program_name);
        (void)fprintf(stderr,
 "\t\t[ -E algo:secret ] [ -F file ] [ -G seconds ] [ -i interface ]\n");
        (void)fprintf(stderr,