fix: noudpsum for vxlan.

This commit is contained in:
Daniel Ding
2025-04-18 15:10:00 +08:00
parent 28026c15df
commit d6ea77dd71

View File

@@ -3,6 +3,7 @@ package cswitch
import ( import (
"fmt" "fmt"
"net" "net"
"strconv"
"strings" "strings"
"time" "time"
@@ -184,20 +185,20 @@ func (w *WorkerImpl) addOutput(bridge string, port *co.Output) {
mtu = 1450 mtu = 1450
link := &LinuxLink{ link := &LinuxLink{
link: &nl.Vxlan{ link: &nl.Vxlan{
VxlanId: port.Segment,
LinkAttrs: nl.LinkAttrs{ LinkAttrs: nl.LinkAttrs{
TxQLen: -1, Name: port.Link,
Name: port.Link,
MTU: mtu,
}, },
Group: libol.ParseAddr(port.Remote),
Port: dport,
}, },
} }
if err := link.Start(); err != nil { opts := []string{"type", "vxlan",
w.out.Error("WorkerImpl.LinkStart %s %s", port.Id(), err) "id", strconv.Itoa(port.Segment), "remote", port.Remote,
"dstport", strconv.Itoa(dport), "noudpcsum"}
_, err := libol.IpLinkAdd(port.Link, opts...)
if err != nil {
w.out.Error("WorkerImpl.LinkStart %s %v", port.Id(), opts)
return return
} }
libol.IpLinkSet(port.Link, "mtu", strconv.Itoa(mtu))
port.Linker = link port.Linker = link
} else if port.Protocol == "tcp" || port.Protocol == "tls" || } else if port.Protocol == "tcp" || port.Protocol == "tls" ||
port.Protocol == "wss" { port.Protocol == "wss" {