From Ben Byer <bushing@sourceforge.net>: add a "-K" flag to suppress the

checking of TCP checksums.

Sort the argument processing code alphabetically.
This commit is contained in:
guy 2006-05-05 23:13:00 +00:00
parent 47ac6d9c3d
commit 90c94a8265
6 changed files with 28 additions and 16 deletions

View File

@ -22,6 +22,7 @@ Additional people who have contributed patches:
Arkadiusz Miskiewicz <misiek@pld.org.pl>
Armando L. Caro Jr. <acaro@mail.eecis.udel.edu>
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Ben Byer <bushing@sourceforge.net>
Atsushi Onoe <onoe@netbsd.org>
Ben Smithurst <ben@scientia.demon.co.uk>
Brent L. Bates <blbates@vigyan.com>

View 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

View 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 */

View 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);

View File

@ -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

View File

@ -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,