summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/header/gre.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip/header/gre.go')
-rw-r--r--pkg/tcpip/header/gre.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/tcpip/header/gre.go b/pkg/tcpip/header/gre.go
new file mode 100644
index 000000000..3d1cc97d9
--- /dev/null
+++ b/pkg/tcpip/header/gre.go
@@ -0,0 +1,19 @@
+package header
+
+import (
+ "encoding/binary"
+
+ "gvisor.dev/gvisor/pkg/tcpip"
+)
+
+const (
+ greProtocolType = 2
+)
+
+// GRE represents a GRE header stored in a byte array.
+type GRE []byte
+
+// SetLength sets the "length" field of the udp header.
+func (b GRE) SetProtocolType(protocol tcpip.NetworkProtocolNumber) {
+ binary.BigEndian.PutUint16(b[greProtocolType:], uint16(protocol))
+}