Skip to content

Commit

Permalink
Make VXLAN checksum configurable
Browse files Browse the repository at this point in the history
Seems that some kernel versions have issues with VXLAN checksum
offloading, causing that flannel stop to work on some scenarios
where the traffic is encapsulated, but the checksum is wrong and is
discarded by the receiver.

A known workaround that works is disabling offloading on the flannel
interface:

ethtool --offload flannel.1 rx off tx off

Adding the option to flannel to disable the checksum will make it
easier for the user.
  • Loading branch information
aojea committed Apr 13, 2020
1 parent 4ff77dc commit aa95bdd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
16 changes: 9 additions & 7 deletions backend/vxlan/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ import (
)

type vxlanDeviceAttrs struct {
vni uint32
name string
vtepIndex int
vtepAddr net.IP
vtepPort int
gbp bool
learning bool
vni uint32
name string
vtepIndex int
vtepAddr net.IP
vtepPort int
gbp bool
learning bool
udpChecksum bool
}

type vxlanDevice struct {
Expand All @@ -54,6 +55,7 @@ func newVXLANDevice(devAttrs *vxlanDeviceAttrs) (*vxlanDevice, error) {
Port: devAttrs.vtepPort,
Learning: devAttrs.learning,
GBP: devAttrs.gbp,
UDPCSum: devAttrs.udpChecksum,
}

link, err := ensureLink(link)
Expand Down
21 changes: 12 additions & 9 deletions backend/vxlan/vxlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ package vxlan
import (
"encoding/json"
"fmt"
log "github.com/golang/glog"
"net"
"sync"

log "github.com/golang/glog"

"golang.org/x/net/context"

"github.com/coreos/flannel/backend"
Expand Down Expand Up @@ -109,6 +110,7 @@ func (be *VXLANBackend) RegisterNetwork(ctx context.Context, wg sync.WaitGroup,
GBP bool
Learning bool
DirectRouting bool
UDPChecksum bool
}{
VNI: defaultVNI,
}
Expand All @@ -118,16 +120,17 @@ func (be *VXLANBackend) RegisterNetwork(ctx context.Context, wg sync.WaitGroup,
return nil, fmt.Errorf("error decoding VXLAN backend config: %v", err)
}
}
log.Infof("VXLAN config: VNI=%d Port=%d GBP=%v Learning=%v DirectRouting=%v", cfg.VNI, cfg.Port, cfg.GBP, cfg.Learning, cfg.DirectRouting)
log.Infof("VXLAN config: VNI=%d Port=%d GBP=%v Learning=%v DirectRouting=%v Checksum=%v", cfg.VNI, cfg.Port, cfg.GBP, cfg.Learning, cfg.DirectRouting, cfg.UDPChecksum)

devAttrs := vxlanDeviceAttrs{
vni: uint32(cfg.VNI),
name: fmt.Sprintf("flannel.%v", cfg.VNI),
vtepIndex: be.extIface.Iface.Index,
vtepAddr: be.extIface.IfaceAddr,
vtepPort: cfg.Port,
gbp: cfg.GBP,
learning: cfg.Learning,
vni: uint32(cfg.VNI),
name: fmt.Sprintf("flannel.%v", cfg.VNI),
vtepIndex: be.extIface.Iface.Index,
vtepAddr: be.extIface.IfaceAddr,
vtepPort: cfg.Port,
gbp: cfg.GBP,
learning: cfg.Learning,
udpChecksum: cfg.UDPChecksum,
}

dev, err := newVXLANDevice(&devAttrs)
Expand Down

0 comments on commit aa95bdd

Please sign in to comment.