summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/sample
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip/sample')
-rw-r--r--pkg/tcpip/sample/tun_tcp_connect/main.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/tcpip/sample/tun_tcp_connect/main.go b/pkg/tcpip/sample/tun_tcp_connect/main.go
index 138941afd..06ee5110b 100644
--- a/pkg/tcpip/sample/tun_tcp_connect/main.go
+++ b/pkg/tcpip/sample/tun_tcp_connect/main.go
@@ -156,7 +156,7 @@ func (info *GreHandlerInfo) greRead(ep *channel.Endpoint) {
for {
pi, err := ep.ReadContext(context.Background());
linkHdr := pi.Pkt.LinkHeader()
- greHdr := header.GRE(linkHdr.Push(4)) //header.IPv4MinimumSize + 4)
+ greHdr := header.GRE(linkHdr.Push(header.GREHeaderSize))
greHdr.SetProtocolType(pi.Proto)
log.Printf("greRead %d %v %v %v", pi.Proto, pi, err, greHdr)
opts := tcpip.WriteOptions{
@@ -253,7 +253,8 @@ func main() {
// Create GRE
greEP := grelink.New(mtu - 24)
chEP := greEP.GetChannel()
- greEP.NMaxHeaderLength = 4 + 20
+ // TODO detect IPv4/IPv6
+ greEP.NMaxHeaderLength = header.IPv6FixedHeaderSize + header.GREHeaderSize
greInfo := GreHandlerInfo{
// Ep: loEP,