summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/header
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip/header')
-rw-r--r--pkg/tcpip/header/gre.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/tcpip/header/gre.go b/pkg/tcpip/header/gre.go
index 65f5c1894..326d03ba8 100644
--- a/pkg/tcpip/header/gre.go
+++ b/pkg/tcpip/header/gre.go
@@ -1,8 +1,8 @@
package header
import (
- "encoding/binary"
-
+ "encoding/binary"
+
"gvisor.dev/gvisor/pkg/tcpip"
)
@@ -18,6 +18,11 @@ const (
GREProtocolNumber tcpip.TransportProtocolNumber = 47
)
+func (b GRE) ProtocolType() tcpip.NetworkProtocolNumber {
+ proto := binary.BigEndian.Uint16(b[greProtocolType:])
+ return tcpip.NetworkProtocolNumber(proto)
+}
+
// SetLength sets the "length" field of the udp header.
func (b GRE) SetProtocolType(protocol tcpip.NetworkProtocolNumber) {
binary.BigEndian.PutUint16(b[greProtocolType:], uint16(protocol))