Skip to content

Commit f87b25d

Browse files
authored
Merge pull request microsoft#117 from Microsoft/mtu
Sets the MTU when a non-default value is specified
2 parents a311679 + cd355b5 commit f87b25d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

service/gcs/prot/protocol.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ type NetworkAdapter struct {
438438
HostDNSServerList string `json:"HostDnsServerList,omitempty"`
439439
HostDNSSuffix string `json:"HostDnsSuffix,omitempty"`
440440
EnableLowMetric bool `json:",omitempty"`
441+
EncapOverhead uint16 `json:",omitempty"`
441442
}
442443

443444
// MappedVirtualDisk represents a disk on the host which is mapped into a

service/gcsutils/gcstools/netnsConfig.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ func netnsConfig() error {
9898
return fmt.Errorf("netlink.LinkByName(%s) failed: %v", *ifStr, err)
9999
}
100100

101+
// User requested non-default MTU size
102+
if a.EncapOverhead != 0 {
103+
mtu := link.Attrs().MTU - int(a.EncapOverhead)
104+
if err = netlink.LinkSetMTU(link, mtu); err != nil {
105+
return fmt.Errorf("netlink.LinkSetMTU(%#v, %d) failed: %v", link, mtu, err)
106+
}
107+
}
108+
101109
// Configure the interface
102110
if a.NatEnabled {
103111
metric := 1

0 commit comments

Comments
 (0)