diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-01-23 01:14:51 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-01-23 21:43:01 +0100 |
commit | 2ce080f581556f9512a481e7fcddecaed0ae7be7 (patch) | |
tree | 13e32a386e0fbddd21aa22f07fd1b841a51e2099 /pkg/tcpip/header/parse | |
parent | 0627e26831c8c58a5fab619d127587dc1ad8a19b (diff) |
WIP GRE tunnel
Diffstat (limited to 'pkg/tcpip/header/parse')
-rw-r--r-- | pkg/tcpip/header/parse/parse.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/tcpip/header/parse/parse.go b/pkg/tcpip/header/parse/parse.go index 2042f214a..3e5336c04 100644 --- a/pkg/tcpip/header/parse/parse.go +++ b/pkg/tcpip/header/parse/parse.go @@ -169,3 +169,13 @@ func TCP(pkt *stack.PacketBuffer) bool { pkt.TransportProtocolNumber = header.TCPProtocolNumber return ok } + +// GRE parses a GRE packet found in pkt.Data and populates pkt's transport +// header with the GRE header. +// +// Returns true if the header was successfully parsed. +func GRE(pkt *stack.PacketBuffer) bool { + _, ok := pkt.TransportHeader().Consume(4) + pkt.TransportProtocolNumber = 47 + return ok +} |