summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2018-07-06 06:18:04 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2018-07-06 06:18:04 +0000
commit5e1ab8b0ed3cbeea695be3662d1d1fd08451c49d (patch)
tree406c7673e491abffa698a16c203e180fbc19cb2f /usr.sbin
parente19c28f1db826244140d75296023d58b91bc4a02 (diff)
Add "gre" as a type to use with -T
This allows arbitrary UDP packets to be parsed as GRE packets.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/tcpdump/interface.h5
-rw-r--r--usr.sbin/tcpdump/print-udp.c5
-rw-r--r--usr.sbin/tcpdump/tcpdump.810
-rw-r--r--usr.sbin/tcpdump/tcpdump.c4
4 files changed, 16 insertions, 8 deletions
diff --git a/usr.sbin/tcpdump/interface.h b/usr.sbin/tcpdump/interface.h
index bfa8e80d442..286f067c8ba 100644
--- a/usr.sbin/tcpdump/interface.h
+++ b/usr.sbin/tcpdump/interface.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.h,v 1.74 2018/07/06 05:47:22 dlg Exp $ */
+/* $OpenBSD: interface.h,v 1.75 2018/07/06 06:18:03 dlg 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.
*
- * @(#) $Id: interface.h,v 1.74 2018/07/06 05:47:22 dlg Exp $ (LBL)
+ * @(#) $Id: interface.h,v 1.75 2018/07/06 06:18:03 dlg Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -60,6 +60,7 @@ extern char *device; /* as specified by -i */
#define PT_CNFP 6 /* Cisco NetFlow protocol */
#define PT_VRRP 7 /* Virtual Router Redundancy protocol */
#define PT_TCP 8 /* TCP */
+#define PT_GRE 9 /* Generic Routing Encapsulation (over UDP) */
#ifndef min
#define min(a,b) ((a)>(b)?(b):(a))
diff --git a/usr.sbin/tcpdump/print-udp.c b/usr.sbin/tcpdump/print-udp.c
index 327b1df53d6..e12b5156376 100644
--- a/usr.sbin/tcpdump/print-udp.c
+++ b/usr.sbin/tcpdump/print-udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-udp.c,v 1.43 2018/07/06 05:47:22 dlg Exp $ */
+/* $OpenBSD: print-udp.c,v 1.44 2018/07/06 06:18:03 dlg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
@@ -469,6 +469,9 @@ udp_print(const u_char *bp, u_int length, const void *iph)
case PT_CNFP:
cnfp_print(cp, length);
break;
+ case PT_GRE:
+ gre_print(cp, length);
+ break;
}
return;
}
diff --git a/usr.sbin/tcpdump/tcpdump.8 b/usr.sbin/tcpdump/tcpdump.8
index d5861ea99bd..1d99aedc7e0 100644
--- a/usr.sbin/tcpdump/tcpdump.8
+++ b/usr.sbin/tcpdump/tcpdump.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tcpdump.8,v 1.94 2018/04/28 16:22:08 schwarze Exp $
+.\" $OpenBSD: tcpdump.8,v 1.95 2018/07/06 06:18:03 dlg Exp $
.\"
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996
.\" The Regents of the University of California. All rights reserved.
@@ -19,7 +19,7 @@
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
-.Dd $Mdocdate: April 28 2018 $
+.Dd $Mdocdate: July 6 2018 $
.Dt TCPDUMP 8
.Os
.Sh NAME
@@ -227,9 +227,11 @@ Currently known types are
.Pq Transmission Control Protocol ,
.Cm vat
.Pq Visual Audio Tool ,
-and
.Cm wb
-.Pq distributed White Board .
+.Pq distributed White Board ,
+and
+.Cm gre
+.Pq Generic Routing Encapsulation over UDP .
.It Fl t
Do not print a timestamp on each dump line.
.It Fl tt
diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c
index 4fd60fc152e..54186aba5fb 100644
--- a/usr.sbin/tcpdump/tcpdump.c
+++ b/usr.sbin/tcpdump/tcpdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcpdump.c,v 1.83 2018/02/06 03:07:51 dlg Exp $ */
+/* $OpenBSD: tcpdump.c,v 1.84 2018/07/06 06:18:03 dlg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -347,6 +347,8 @@ main(int argc, char **argv)
packettype = PT_VRRP;
else if (strcasecmp(optarg, "tcp") == 0)
packettype = PT_TCP;
+ else if (strcasecmp(optarg, "gre") == 0)
+ packettype = PT_GRE;
else if (strcasecmp(optarg, "sack") == 0)
/*
* kept for compatibility; DEFAULT_SNAPLEN