MTU selection closer to weave script
Note that if initFastdp sets the MTU for the datapath then the same value is used for the bridge also.
This commit is contained in:
1 parent
8e5384ee01
commit
2d037d874c
1 file changed
+12
@@ -225,6 +225,9 @@ func initBridgePrep(config *BridgeConfig) error {
|
||||
linkAttrs := netlink.NewLinkAttrs()
|
||||
linkAttrs.Name = config.WeaveBridgeName
|
||||
linkAttrs.HardwareAddr = mac
|
||||
if config.MTU == 0 {
|
||||
config.MTU = 65535
|
||||
}
|
||||
linkAttrs.MTU = config.MTU // TODO this probably doesn't work - see weave script
|
||||
if err = netlink.LinkAdd(&netlink.Bridge{LinkAttrs: linkAttrs}); err != nil {
|
||||
return err
|
||||
@@ -251,6 +254,15 @@ func initFastdp(config *BridgeConfig) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if config.MTU == 0 {
|
||||
/* GCE has the lowest underlay network MTU we're likely to encounter on
|
||||
a local network, at 1460 bytes. To get the overlay MTU from that we
|
||||
subtract 20 bytes for the outer IPv4 header, 8 bytes for the outer
|
||||
UDP header, 8 bytes for the vxlan header, and 14 bytes for the inner
|
||||
ethernet header. In addition, we subtract 34 bytes for the ESP overhead
|
||||
which is needed for the vxlan encryption. */
|
||||
config.MTU = 1376
|
||||
}
|
||||
return netlink.LinkSetMTU(datapath, config.MTU)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user