Skip to content

Commit

Permalink
Merge pull request #897 from tomdee/fix-vxlan-mtu
Browse files Browse the repository at this point in the history
backend/vxlan: Return correct MTU value
  • Loading branch information
gunjan5 authored Dec 11, 2017
2 parents 7257bcc + f72fa98 commit 1cea4d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 0 additions & 4 deletions backend/vxlan/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ func (dev *vxlanDevice) MACAddr() net.HardwareAddr {
return dev.link.HardwareAddr
}

func (dev *vxlanDevice) MTU() int {
return dev.link.MTU
}

type neighbor struct {
MAC net.HardwareAddr
IP ip.IP4
Expand Down
7 changes: 5 additions & 2 deletions backend/vxlan/vxlan_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ import (

type network struct {
backend.SimpleNetwork
extIface *backend.ExternalInterface
dev *vxlanDevice
subnetMgr subnet.Manager
}

const (
encapOverhead = 50
)

func newNetwork(subnetMgr subnet.Manager, extIface *backend.ExternalInterface, dev *vxlanDevice, _ ip.IP4Net, lease *subnet.Lease) (*network, error) {
nw := &network{
SimpleNetwork: backend.SimpleNetwork{
Expand Down Expand Up @@ -77,7 +80,7 @@ func (nw *network) Run(ctx context.Context) {
}

func (nw *network) MTU() int {
return nw.dev.MTU()
return nw.ExtIface.Iface.MTU - encapOverhead
}

type vxlanLeaseAttrs struct {
Expand Down

0 comments on commit 1cea4d1

Please sign in to comment.