hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/net/erspan.h
....@@ -2,7 +2,19 @@
22 #define __LINUX_ERSPAN_H
33
44 /*
5
- * GRE header for ERSPAN encapsulation (8 octets [34:41]) -- 8 bytes
5
+ * GRE header for ERSPAN type I encapsulation (4 octets [34:37])
6
+ * 0 1 2 3
7
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
8
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
9
+ * |0|0|0|0|0|00000|000000000|00000| Protocol Type for ERSPAN |
10
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
11
+ *
12
+ * The Type I ERSPAN frame format is based on the barebones IP + GRE
13
+ * encapsulation (as described above) on top of the raw mirrored frame.
14
+ * There is no extra ERSPAN header.
15
+ *
16
+ *
17
+ * GRE header for ERSPAN type II and II encapsulation (8 octets [34:41])
618 * 0 1 2 3
719 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
820 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
....@@ -43,7 +55,7 @@
4355 * | Platform Specific Info |
4456 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4557 *
46
- * GRE proto ERSPAN type II = 0x88BE, type III = 0x22EB
58
+ * GRE proto ERSPAN type I/II = 0x88BE, type III = 0x22EB
4759 */
4860
4961 #include <uapi/linux/erspan.h>
....@@ -139,6 +151,9 @@
139151
140152 static inline int erspan_hdr_len(int version)
141153 {
154
+ if (version == 0)
155
+ return 0;
156
+
142157 return sizeof(struct erspan_base_hdr) +
143158 (version == 1 ? ERSPAN_V1_MDSIZE : ERSPAN_V2_MDSIZE);
144159 }