summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2004-09-16 11:29:52 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2004-09-16 11:29:52 +0000
commit187c498a64350d94f6d7e6b5ccce16846ba17cc6 (patch)
tree57df6e76c17af1f10afff862146e5826ddc5fb34
parent4dac3d3209fe626d76e421427eecb510c76e8b4a (diff)
add -T tcp to enforce interpretation as TCP
-rw-r--r--usr.sbin/tcpdump/interface.h5
-rw-r--r--usr.sbin/tcpdump/print-tcp.c7
-rw-r--r--usr.sbin/tcpdump/tcpdump.84
-rw-r--r--usr.sbin/tcpdump/tcpdump.c6
4 files changed, 14 insertions, 8 deletions
diff --git a/usr.sbin/tcpdump/interface.h b/usr.sbin/tcpdump/interface.h
index 16c47e04063..7d0ca560229 100644
--- a/usr.sbin/tcpdump/interface.h
+++ b/usr.sbin/tcpdump/interface.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.h,v 1.46 2004/06/20 17:51:55 avsm Exp $ */
+/* $OpenBSD: interface.h,v 1.47 2004/09/16 11:29:51 markus Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -20,7 +20,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/interface.h,v 1.46 2004/06/20 17:51:55 avsm Exp $ (LBL)
+ * @(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/interface.h,v 1.47 2004/09/16 11:29:51 markus Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -58,6 +58,7 @@ extern int packettype; /* as specified by -T */
#define PT_RTCP 5 /* Real-Time Applications control protocol */
#define PT_CNFP 6 /* Cisco NetFlow protocol */
#define PT_VRRP 7 /* Virtual Router Redundancy protocol */
+#define PT_TCP 8 /* TCP */
#ifndef min
#define min(a,b) ((a)>(b)?(b):(a))
diff --git a/usr.sbin/tcpdump/print-tcp.c b/usr.sbin/tcpdump/print-tcp.c
index 117b9e625a9..6313372d992 100644
--- a/usr.sbin/tcpdump/print-tcp.c
+++ b/usr.sbin/tcpdump/print-tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-tcp.c,v 1.21 2004/08/10 19:55:07 markus Exp $ */
+/* $OpenBSD: print-tcp.c,v 1.22 2004/09/16 11:29:51 markus Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-tcp.c,v 1.21 2004/08/10 19:55:07 markus Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-tcp.c,v 1.22 2004/09/16 11:29:51 markus Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -264,7 +264,8 @@ tcp_print(register const u_char *bp, register u_int length,
if (qflag) {
(void)printf("tcp %d", length - tp->th_off * 4);
return;
- } else {
+ } else if (packettype != PT_TCP) {
+
/*
* If data present and NFS port used, assume NFS.
* Pass offset of data plus 4 bytes for RPC TCP msg length
diff --git a/usr.sbin/tcpdump/tcpdump.8 b/usr.sbin/tcpdump/tcpdump.8
index 8920bcc428d..de23b776ec6 100644
--- a/usr.sbin/tcpdump/tcpdump.8
+++ b/usr.sbin/tcpdump/tcpdump.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tcpdump.8,v 1.48 2004/07/28 09:37:26 markus Exp $
+.\" $OpenBSD: tcpdump.8,v 1.49 2004/09/16 11:29:51 markus Exp $
.\"
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996
.\" The Regents of the University of California. All rights reserved.
@@ -215,6 +215,8 @@ Currently known types are
.Pq Real-Time Applications control protocol ,
.Cm sack
.Pq RFC 2018 TCP Selective Acknowledgements Options ,
+.Cm tcp
+.Pq Transmission Control Protocol ,
.Cm vat
.Pq Visual Audio Tool ,
and
diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c
index 86086e5c1fd..2038e6e496d 100644
--- a/usr.sbin/tcpdump/tcpdump.c
+++ b/usr.sbin/tcpdump/tcpdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcpdump.c,v 1.38 2004/06/20 17:51:55 avsm Exp $ */
+/* $OpenBSD: tcpdump.c,v 1.39 2004/09/16 11:29:51 markus Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -26,7 +26,7 @@ static const char copyright[] =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.38 2004/06/20 17:51:55 avsm Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.39 2004/09/16 11:29:51 markus Exp $ (LBL)";
#endif
/*
@@ -284,6 +284,8 @@ main(int argc, char **argv)
packettype = PT_CNFP;
else if (strcasecmp(optarg, "vrrp") == 0)
packettype = PT_VRRP;
+ else if (strcasecmp(optarg, "tcp") == 0)
+ packettype = PT_TCP;
else if (strcasecmp(optarg, "sack") == 0)
snaplen = SACK_SNAPLEN;
else