]> The Tcpdump Group git mirrors - tcpdump/commitdiff
gre: move the header flags to a gre.h header.
authorGuy Harris <[email protected]>
Fri, 20 Oct 2023 06:04:26 +0000 (23:04 -0700)
committerGuy Harris <[email protected]>
Fri, 20 Oct 2023 06:04:26 +0000 (23:04 -0700)
That allows dissectors such as the ERSPAN dissector to check individual
flags without having their own definitions of the flags.

INSTALL.md
Makefile.in
gre.h [new file with mode: 0644]
print-erspan.c
print-gre.c

index df5c303ac4cd34f3d256ff29bd5d333ec26ef67d..e5cda6560bae31f1e6e4083e5ce59e6333d79f7d 100644 (file)
@@ -94,6 +94,7 @@ ethertype.h   - Ethernet type value definitions
 extract.h      - alignment definitions
 gmpls.c                - GMPLS definitions
 gmpls.h                - GMPLS declarations
+gre.h          - GRE definitions
 install-sh     - BSD style install script
 interface.h    - globals, prototypes and definitions
 ip.h           - IP definitions
index 052f0074b9f3561e63a7f12ce94b2076ddd6e12b..114fc2e8423fa7e999e120cc5955ceb87cac069f 100644 (file)
@@ -286,6 +286,7 @@ HDR = \
        funcattrs.h \
        getservent.h \
        gmpls.h \
+       gre.h \
        interface.h \
        ip.h \
        ip6.h \
diff --git a/gre.h b/gre.h
new file mode 100644 (file)
index 0000000..0717c43
--- /dev/null
+++ b/gre.h
@@ -0,0 +1,36 @@
+/*     $OpenBSD: print-gre.c,v 1.6 2002/10/30 03:04:04 fgsch Exp $     */
+
+/*
+ * Copyright (c) 2002 Jason L. Wright ([email protected])
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* \summary: Header flags for Generic Routing Encapsulation (GRE) */
+
+#define        GRE_CP          0x8000          /* checksum present */
+#define        GRE_RP          0x4000          /* routing present */
+#define        GRE_KP          0x2000          /* key present */
+#define        GRE_SP          0x1000          /* sequence# present */
+#define        GRE_sP          0x0800          /* source routing */
+#define        GRE_AP          0x0080          /* acknowledgment# present */
index 3bcf0acd749832545fd73c0aef5378ade07a7f05..68387c5b989b417a0eb28341cd7be760f308574f 100644 (file)
@@ -41,6 +41,7 @@
 #define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 #include "extract.h"
+#include "gre.h"
 
 #define ERSPAN2_VER_SHIFT      28
 #define ERSPAN2_VER_MASK       (0xfU << ERSPAN2_VER_SHIFT)
 #define ERSPAN2_INDEX_SHIFT    0
 #define ERSPAN2_INDEX_MASK     (0xfffffU << ERSPAN2_INDEX_SHIFT)
 
-/*
- * XXX - eh?
- */
-#define        GRE_SP          0x1000          /* sequence# present */
-
 void
 erspan_print(netdissect_options *ndo, uint16_t flags, const u_char *bp, u_int len)
 {
index 732903f84fbeebc79ae21cdac3fd276936f10336..368bf8bb9e0666058d99f91717a81a6606012122 100644 (file)
 #include "addrtostr.h"
 #include "extract.h"
 #include "ethertype.h"
-
-
-#define        GRE_CP          0x8000          /* checksum present */
-#define        GRE_RP          0x4000          /* routing present */
-#define        GRE_KP          0x2000          /* key present */
-#define        GRE_SP          0x1000          /* sequence# present */
-#define        GRE_sP          0x0800          /* source routing */
-#define        GRE_AP          0x0080          /* acknowledgment# present */
+#include "gre.h"
 
 static const struct tok gre_flag_values[] = {
     { GRE_CP, "checksum present"},