hotfix: ipv6 skip checksum verification (#682)

This commit is contained in:
naison
2025-08-04 21:16:53 +08:00
committed by GitHub
parent c4d28fd497
commit 2d5653ee2b
2 changed files with 8 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import (
"gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/link/channel" "gvisor.dev/gvisor/pkg/tcpip/link/channel"
"gvisor.dev/gvisor/pkg/tcpip/link/sniffer" "gvisor.dev/gvisor/pkg/tcpip/link/sniffer"
"gvisor.dev/gvisor/pkg/tcpip/stack"
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp" "gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
"github.com/wencaiwulue/kubevpn/v2/pkg/config" "github.com/wencaiwulue/kubevpn/v2/pkg/config"
@@ -32,6 +33,9 @@ func handleGvisorPacket(gvisorInbound <-chan *Packet, outbound chan<- *Packet) *
func (h *gvisorLocalTCPHandler) Run(ctx context.Context) { func (h *gvisorLocalTCPHandler) Run(ctx context.Context) {
endpoint := channel.New(tcp.DefaultReceiveBufferSize, uint32(config.DefaultMTU), tcpip.GetRandMacAddr()) endpoint := channel.New(tcp.DefaultReceiveBufferSize, uint32(config.DefaultMTU), tcpip.GetRandMacAddr())
// for support ipv6 skip checksum
// vendor/gvisor.dev/gvisor/pkg/tcpip/stack/nic.go:763
endpoint.LinkEPCapabilities = stack.CapabilityRXChecksumOffload
go func() { go func() {
defer util.HandleCrash() defer util.HandleCrash()
readFromGvisorInboundWriteToEndpoint(ctx, h.gvisorInbound, endpoint) readFromGvisorInboundWriteToEndpoint(ctx, h.gvisorInbound, endpoint)

View File

@@ -10,6 +10,7 @@ import (
"gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/link/channel" "gvisor.dev/gvisor/pkg/tcpip/link/channel"
"gvisor.dev/gvisor/pkg/tcpip/link/sniffer" "gvisor.dev/gvisor/pkg/tcpip/link/sniffer"
"gvisor.dev/gvisor/pkg/tcpip/stack"
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp" "gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
"github.com/wencaiwulue/kubevpn/v2/pkg/config" "github.com/wencaiwulue/kubevpn/v2/pkg/config"
@@ -38,6 +39,9 @@ func (h *gvisorTCPHandler) Handle(ctx context.Context, tcpConn net.Conn) {
func (h *gvisorTCPHandler) handle(ctx context.Context, tcpConn net.Conn) { func (h *gvisorTCPHandler) handle(ctx context.Context, tcpConn net.Conn) {
endpoint := channel.New(tcp.DefaultReceiveBufferSize, uint32(config.DefaultMTU), tcpip.GetRandMacAddr()) endpoint := channel.New(tcp.DefaultReceiveBufferSize, uint32(config.DefaultMTU), tcpip.GetRandMacAddr())
// for support ipv6 skip checksum
// vendor/gvisor.dev/gvisor/pkg/tcpip/stack/nic.go:763
endpoint.LinkEPCapabilities = stack.CapabilityRXChecksumOffload
errChan := make(chan error, 2) errChan := make(chan error, 2)
go func() { go func() {
defer util.HandleCrash() defer util.HandleCrash()