diff --git a/pkg/tcpip/network/arp/arp.go b/pkg/tcpip/network/arp/arp.go index e05f188990..f416fe821e 100644 --- a/pkg/tcpip/network/arp/arp.go +++ b/pkg/tcpip/network/arp/arp.go @@ -128,6 +128,11 @@ func (e *endpoint) MTU() uint32 { return lmtu - uint32(e.MaxHeaderLength()) } +// EndpointHeaderSize returns the size necessary for the ARP header. +func (e *endpoint) EndpointHeaderSize() uint32 { + return header.ARPSize +} + func (e *endpoint) MaxHeaderLength() uint16 { return e.nic.MaxHeaderLength() + header.ARPSize } diff --git a/pkg/tcpip/network/ipv4/ipv4.go b/pkg/tcpip/network/ipv4/ipv4.go index 8d530b8033..87824deaf1 100644 --- a/pkg/tcpip/network/ipv4/ipv4.go +++ b/pkg/tcpip/network/ipv4/ipv4.go @@ -426,6 +426,11 @@ func (e *endpoint) MTU() uint32 { return networkMTU } +// EndpointHeaderSize returns the size necessary for the IPv4 header. +func (e *endpoint) EndpointHeaderSize() uint32 { + return header.IPv4MinimumSize +} + // MaxHeaderLength returns the maximum length needed by ipv4 headers (and // underlying protocols). func (e *endpoint) MaxHeaderLength() uint16 { diff --git a/pkg/tcpip/network/ipv6/ipv6.go b/pkg/tcpip/network/ipv6/ipv6.go index c920f92343..757d8a7c8e 100644 --- a/pkg/tcpip/network/ipv6/ipv6.go +++ b/pkg/tcpip/network/ipv6/ipv6.go @@ -728,6 +728,11 @@ func (e *endpoint) MTU() uint32 { return networkMTU } +// EndpointHeaderSize returns the size necessary for the IPv6 header. +func (e *endpoint) EndpointHeaderSize() uint32 { + return header.IPv6MinimumSize +} + // MaxHeaderLength returns the maximum length needed by ipv6 headers (and // underlying protocols). func (e *endpoint) MaxHeaderLength() uint16 { diff --git a/pkg/tcpip/stack/forwarding_test.go b/pkg/tcpip/stack/forwarding_test.go index 9bc7103901..421c732a06 100644 --- a/pkg/tcpip/stack/forwarding_test.go +++ b/pkg/tcpip/stack/forwarding_test.go @@ -109,6 +109,11 @@ func (f *fwdTestNetworkEndpoint) HandlePacket(pkt *PacketBuffer) { _ = r.WriteHeaderIncludedPacket(pkt) } +// EndpointHeaderSize implements NetworkEndpoint.EndpointHeaderSize. +func (f *fwdTestNetworkEndpoint) EndpointHeaderSize() uint32 { + return fwdTestNetHeaderLen +} + func (f *fwdTestNetworkEndpoint) MaxHeaderLength() uint16 { return f.nic.MaxHeaderLength() + fwdTestNetHeaderLen } diff --git a/pkg/tcpip/stack/nic_test.go b/pkg/tcpip/stack/nic_test.go index 13450a21ab..907747d573 100644 --- a/pkg/tcpip/stack/nic_test.go +++ b/pkg/tcpip/stack/nic_test.go @@ -62,6 +62,11 @@ func (e *testIPv6Endpoint) MTU() uint32 { return e.nic.MTU() - header.IPv6MinimumSize } +// EndpointHeaderSize implements NetworkEndpoint.EndpointHeaderSize. +func (e *testIPv6Endpoint) EndpointHeaderSize() uint32 { + return header.IPv6MinimumSize +} + // MaxHeaderLength implements NetworkEndpoint.MaxHeaderLength. func (e *testIPv6Endpoint) MaxHeaderLength() uint16 { return e.nic.MaxHeaderLength() + header.IPv6MinimumSize diff --git a/pkg/tcpip/stack/registration.go b/pkg/tcpip/stack/registration.go index 9286ed2912..2c23eee23c 100644 --- a/pkg/tcpip/stack/registration.go +++ b/pkg/tcpip/stack/registration.go @@ -872,6 +872,9 @@ type NetworkEndpoint interface { // minus the network endpoint max header length. MTU() uint32 + // EndpointHeaderSize returns the size of this endpoint header. + EndpointHeaderSize() uint32 + // MaxHeaderLength returns the maximum size the network (and lower // level layers combined) headers can have. Higher levels use this // information to reserve space in the front of the packets they're diff --git a/pkg/tcpip/stack/route.go b/pkg/tcpip/stack/route.go index d2a5f3bfbe..3098e7bfcd 100644 --- a/pkg/tcpip/stack/route.go +++ b/pkg/tcpip/stack/route.go @@ -245,6 +245,14 @@ func makeRoute(netProto tcpip.NetworkProtocolNumber, gateway, localAddr, remoteA } func makeRouteInner(netProto tcpip.NetworkProtocolNumber, localAddr, remoteAddr tcpip.Address, outgoingNIC, localAddressNIC *nic, localAddressEndpoint AssignableAddressEndpoint, loop PacketLooping, mtu uint32) *Route { + if mtu != 0 { + adjusted := mtu - outgoingNIC.getNetworkEndpoint(netProto).EndpointHeaderSize() + if adjusted > mtu { + mtu = 0 + } else { + mtu = adjusted + } + } r := &Route{ routeInfo: routeInfo{ NetProto: netProto, @@ -520,6 +528,7 @@ func (r *Route) DefaultTTL() uint8 { // MTU returns the MTU of the route if present, otherwise the MTU of the underlying network endpoint. func (r *Route) MTU() uint32 { if r.mtu > 0 { + // r.mtu is already adjusted to account for IP headers. See makeRouteInner. return r.mtu } return r.outgoingNIC.getNetworkEndpoint(r.NetProto()).MTU() diff --git a/pkg/tcpip/stack/stack_test.go b/pkg/tcpip/stack/stack_test.go index 39eb88f67a..240cd3ec66 100644 --- a/pkg/tcpip/stack/stack_test.go +++ b/pkg/tcpip/stack/stack_test.go @@ -169,6 +169,10 @@ func (f *fakeNetworkEndpoint) HandlePacket(pkt *stack.PacketBuffer) { f.dispatcher.DeliverTransportPacket(transProtoNum, pkt) } +func (f *fakeNetworkEndpoint) EndpointHeaderSize() uint32 { + return fakeNetHeaderLen +} + func (f *fakeNetworkEndpoint) MaxHeaderLength() uint16 { return f.nic.MaxHeaderLength() + fakeNetHeaderLen } @@ -832,6 +836,8 @@ func TestNetworkSendMultiRoute(t *testing.T) { } func testRoute(t *testing.T, s *stack.Stack, nic tcpip.NICID, srcAddr, dstAddr, expectedSrcAddr tcpip.Address, expectedRouteMTU int) { + t.Helper() + r, err := s.FindRoute(nic, srcAddr, dstAddr, fakeNetNumber, false /* multicastLoop */) if err != nil { t.Fatal("FindRoute failed:", err) @@ -840,19 +846,21 @@ func testRoute(t *testing.T, s *stack.Stack, nic tcpip.NICID, srcAddr, dstAddr, defer r.Release() if r.LocalAddress() != expectedSrcAddr { - t.Fatalf("got Route.LocalAddress() = %s, want = %s", expectedSrcAddr, r.LocalAddress()) + t.Errorf("got Route.LocalAddress() = %s, want = %s", expectedSrcAddr, r.LocalAddress()) } if r.RemoteAddress() != dstAddr { - t.Fatalf("got Route.RemoteAddress() = %s, want = %s", dstAddr, r.RemoteAddress()) + t.Errorf("got Route.RemoteAddress() = %s, want = %s", dstAddr, r.RemoteAddress()) } if int(r.MTU()) != expectedRouteMTU { - t.Fatalf("got Route.MTU() = %d, want = %d", r.MTU(), expectedRouteMTU) + t.Errorf("got Route.MTU() = %d, want = %d", r.MTU(), expectedRouteMTU) } } func testNoRoute(t *testing.T, s *stack.Stack, nic tcpip.NICID, srcAddr, dstAddr tcpip.Address) { + t.Helper() + _, err := s.FindRoute(nic, srcAddr, dstAddr, fakeNetNumber, false /* multicastLoop */) if _, ok := err.(*tcpip.ErrNetworkUnreachable); !ok { t.Fatalf("FindRoute returned unexpected error, got = %v, want = %s", err, &tcpip.ErrNetworkUnreachable{}) @@ -1043,17 +1051,22 @@ func TestRouteWithDownNIC(t *testing.T) { const unspecifiedNIC = 0 const nicID1 = 1 const nicID2 = 2 - var addr1 = tcpip.AddrFrom4Slice([]byte("\x01\x00\x00\x00")) - var addr2 = tcpip.AddrFrom4Slice([]byte("\x02\x00\x00\x00")) - var nic1Dst = tcpip.AddrFrom4Slice([]byte("\x05\x00\x00\x00")) - var nic2Dst = tcpip.AddrFrom4Slice([]byte("\x06\x00\x00\x00")) - var nic1RouteMTU = 1500 - var nic2RouteMTU = 1460 + addr1 := tcpip.AddrFrom4Slice([]byte("\x01\x00\x00\x00")) + addr2 := tcpip.AddrFrom4Slice([]byte("\x02\x00\x00\x00")) + nic1Dst := tcpip.AddrFrom4Slice([]byte("\x05\x00\x00\x00")) + nic2Dst := tcpip.AddrFrom4Slice([]byte("\x06\x00\x00\x00")) + nic1RouteMTU := 1500 + nic2RouteMTU := 1460 + // These are set in setup function, because they depend on protocl being used. + nic1RouteMTUAtNetworkLayer := 0 + nic2RouteMTUAtNetworkLayer := 0 setup := func(t *testing.T) (*stack.Stack, *channel.Endpoint, *channel.Endpoint) { s := stack.New(stack.Options{ NetworkProtocols: []stack.NetworkProtocolFactory{fakeNetFactory}, }) + nic1RouteMTUAtNetworkLayer = nic1RouteMTU - fakeNetHeaderLen + nic2RouteMTUAtNetworkLayer = nic2RouteMTU - fakeNetHeaderLen ep1 := channel.New(1, defaultMTU, "") if err := s.CreateNIC(nicID1, ep1); err != nil { @@ -1116,14 +1129,14 @@ func TestRouteWithDownNIC(t *testing.T) { s, _, _ := setup(t) // Test routes to odd address. - testRoute(t, s, unspecifiedNIC, tcpip.Address{}, tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), addr1, nic1RouteMTU) - testRoute(t, s, unspecifiedNIC, addr1, tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), addr1, nic1RouteMTU) - testRoute(t, s, nicID1, addr1, tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), addr1, nic1RouteMTU) + testRoute(t, s, unspecifiedNIC, tcpip.Address{}, tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), addr1, nic1RouteMTUAtNetworkLayer) + testRoute(t, s, unspecifiedNIC, addr1, tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), addr1, nic1RouteMTUAtNetworkLayer) + testRoute(t, s, nicID1, addr1, tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), addr1, nic1RouteMTUAtNetworkLayer) // Test routes to even address. - testRoute(t, s, unspecifiedNIC, tcpip.Address{}, tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), addr2, nic2RouteMTU) - testRoute(t, s, unspecifiedNIC, addr2, tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), addr2, nic2RouteMTU) - testRoute(t, s, nicID2, addr2, tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), addr2, nic2RouteMTU) + testRoute(t, s, unspecifiedNIC, tcpip.Address{}, tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), addr2, nic2RouteMTUAtNetworkLayer) + testRoute(t, s, unspecifiedNIC, addr2, tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), addr2, nic2RouteMTUAtNetworkLayer) + testRoute(t, s, nicID2, addr2, tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), addr2, nic2RouteMTUAtNetworkLayer) // Bringing NIC1 down should result in no routes to odd addresses. Routes to // even addresses should continue to be available as NIC2 is still up. @@ -1133,9 +1146,9 @@ func TestRouteWithDownNIC(t *testing.T) { testNoRoute(t, s, unspecifiedNIC, tcpip.Address{}, nic1Dst) testNoRoute(t, s, unspecifiedNIC, addr1, nic1Dst) testNoRoute(t, s, nicID1, addr1, nic1Dst) - testRoute(t, s, unspecifiedNIC, tcpip.Address{}, nic2Dst, addr2, nic2RouteMTU) - testRoute(t, s, unspecifiedNIC, addr2, nic2Dst, addr2, nic2RouteMTU) - testRoute(t, s, nicID2, addr2, nic2Dst, addr2, nic2RouteMTU) + testRoute(t, s, unspecifiedNIC, tcpip.Address{}, nic2Dst, addr2, nic2RouteMTUAtNetworkLayer) + testRoute(t, s, unspecifiedNIC, addr2, nic2Dst, addr2, nic2RouteMTUAtNetworkLayer) + testRoute(t, s, nicID2, addr2, nic2Dst, addr2, nic2RouteMTUAtNetworkLayer) // Bringing NIC2 down should result in no routes to even addresses. No // route should be available to any address as routes to odd addresses @@ -1157,9 +1170,9 @@ func TestRouteWithDownNIC(t *testing.T) { if err := upFn(s, nicID1); err != nil { t.Fatalf("test.upFn(_, %d): %s", nicID1, err) } - testRoute(t, s, unspecifiedNIC, tcpip.Address{}, nic1Dst, addr1, nic1RouteMTU) - testRoute(t, s, unspecifiedNIC, addr1, nic1Dst, addr1, nic1RouteMTU) - testRoute(t, s, nicID1, addr1, nic1Dst, addr1, nic1RouteMTU) + testRoute(t, s, unspecifiedNIC, tcpip.Address{}, nic1Dst, addr1, nic1RouteMTUAtNetworkLayer) + testRoute(t, s, unspecifiedNIC, addr1, nic1Dst, addr1, nic1RouteMTUAtNetworkLayer) + testRoute(t, s, nicID1, addr1, nic1Dst, addr1, nic1RouteMTUAtNetworkLayer) testNoRoute(t, s, unspecifiedNIC, tcpip.Address{}, nic2Dst) testNoRoute(t, s, unspecifiedNIC, addr2, nic2Dst) testNoRoute(t, s, nicID2, addr2, nic2Dst) @@ -1293,7 +1306,9 @@ func TestRoutes(t *testing.T) { // addresses through the first NIC, and all even destination address // through the second one. nic1RouteMTU := 1500 + nic1RouteMTUAtNetworkLayer := nic1RouteMTU - fakeNetHeaderLen nic2RouteMTU := 1460 + nic2RouteMTUAtNetworkLayer := nic2RouteMTU - fakeNetHeaderLen { subnet0, err := tcpip.NewSubnet(tcpip.AddrFromSlice([]byte("\x00\x00\x00\x00")), tcpip.MaskFrom("\x01\x00\x00\x00")) if err != nil { @@ -1311,18 +1326,18 @@ func TestRoutes(t *testing.T) { } // Test routes to odd address. - testRoute(t, s, 0, tcpip.Address{}, tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x01\x00\x00\x00")), nic1RouteMTU) - testRoute(t, s, 0, tcpip.AddrFromSlice([]byte("\x01\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x01\x00\x00\x00")), nic1RouteMTU) - testRoute(t, s, 1, tcpip.AddrFromSlice([]byte("\x01\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x01\x00\x00\x00")), nic1RouteMTU) - testRoute(t, s, 0, tcpip.AddrFromSlice([]byte("\x03\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x03\x00\x00\x00")), nic1RouteMTU) - testRoute(t, s, 1, tcpip.AddrFromSlice([]byte("\x03\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x03\x00\x00\x00")), nic1RouteMTU) + testRoute(t, s, 0, tcpip.Address{}, tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x01\x00\x00\x00")), nic1RouteMTUAtNetworkLayer) + testRoute(t, s, 0, tcpip.AddrFromSlice([]byte("\x01\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x01\x00\x00\x00")), nic1RouteMTUAtNetworkLayer) + testRoute(t, s, 1, tcpip.AddrFromSlice([]byte("\x01\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x01\x00\x00\x00")), nic1RouteMTUAtNetworkLayer) + testRoute(t, s, 0, tcpip.AddrFromSlice([]byte("\x03\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x03\x00\x00\x00")), nic1RouteMTUAtNetworkLayer) + testRoute(t, s, 1, tcpip.AddrFromSlice([]byte("\x03\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x05\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x03\x00\x00\x00")), nic1RouteMTUAtNetworkLayer) // Test routes to even address. - testRoute(t, s, 0, tcpip.Address{}, tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x04\x00\x00\x00")), nic2RouteMTU) - testRoute(t, s, 0, tcpip.AddrFromSlice([]byte("\x02\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x02\x00\x00\x00")), nic2RouteMTU) - testRoute(t, s, 2, tcpip.AddrFromSlice([]byte("\x02\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x02\x00\x00\x00")), nic2RouteMTU) - testRoute(t, s, 0, tcpip.AddrFromSlice([]byte("\x04\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x04\x00\x00\x00")), nic2RouteMTU) - testRoute(t, s, 2, tcpip.AddrFromSlice([]byte("\x04\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x04\x00\x00\x00")), nic2RouteMTU) + testRoute(t, s, 0, tcpip.Address{}, tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x04\x00\x00\x00")), nic2RouteMTUAtNetworkLayer) + testRoute(t, s, 0, tcpip.AddrFromSlice([]byte("\x02\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x02\x00\x00\x00")), nic2RouteMTUAtNetworkLayer) + testRoute(t, s, 2, tcpip.AddrFromSlice([]byte("\x02\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x02\x00\x00\x00")), nic2RouteMTUAtNetworkLayer) + testRoute(t, s, 0, tcpip.AddrFromSlice([]byte("\x04\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x04\x00\x00\x00")), nic2RouteMTUAtNetworkLayer) + testRoute(t, s, 2, tcpip.AddrFromSlice([]byte("\x04\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x06\x00\x00\x00")), tcpip.AddrFromSlice([]byte("\x04\x00\x00\x00")), nic2RouteMTUAtNetworkLayer) // Try to send to odd numbered address from even numbered ones, then // vice-versa. diff --git a/runsc/boot/network.go b/runsc/boot/network.go index 7e6f4c4850..e9bd26c182 100644 --- a/runsc/boot/network.go +++ b/runsc/boot/network.go @@ -43,31 +43,29 @@ import ( "gvisor.dev/gvisor/runsc/config" ) -var ( - // DefaultLoopbackLink contains IP addresses and routes of "127.0.0.1/8" and - // "::1/8" on "lo" interface. - DefaultLoopbackLink = LoopbackLink{ - Name: "lo", - Addresses: []IPWithPrefix{ - {Address: net.IP("\x7f\x00\x00\x01"), PrefixLen: 8}, - {Address: net.IPv6loopback, PrefixLen: 128}, - }, - Routes: []Route{ - { - Destination: net.IPNet{ - IP: net.IPv4(0x7f, 0, 0, 0), - Mask: net.IPv4Mask(0xff, 0, 0, 0), - }, +// DefaultLoopbackLink contains IP addresses and routes of "127.0.0.1/8" and +// "::1/8" on "lo" interface. +var DefaultLoopbackLink = LoopbackLink{ + Name: "lo", + Addresses: []IPWithPrefix{ + {Address: net.IP("\x7f\x00\x00\x01"), PrefixLen: 8}, + {Address: net.IPv6loopback, PrefixLen: 128}, + }, + Routes: []Route{ + { + Destination: net.IPNet{ + IP: net.IPv4(0x7f, 0, 0, 0), + Mask: net.IPv4Mask(0xff, 0, 0, 0), }, - { - Destination: net.IPNet{ - IP: net.IPv6loopback, - Mask: net.IPMask(strings.Repeat("\xff", net.IPv6len)), - }, + }, + { + Destination: net.IPNet{ + IP: net.IPv6loopback, + Mask: net.IPMask(strings.Repeat("\xff", net.IPv6len)), }, }, - } -) + }, +} // Network exposes methods that can be used to configure a network stack. type Network struct { @@ -83,6 +81,7 @@ type Network struct { type Route struct { Destination net.IPNet Gateway net.IP + MTU uint32 } // DefaultRoute represents a catch all route to the default gateway. @@ -220,6 +219,7 @@ func (r *Route) toTcpipRoute(id tcpip.NICID) (tcpip.Route, error) { Destination: subnet, Gateway: ipToAddress(r.Gateway), NIC: id, + MTU: r.MTU, }, nil } diff --git a/runsc/sandbox/network.go b/runsc/sandbox/network.go index 7a0a0b01f5..3826e25c61 100644 --- a/runsc/sandbox/network.go +++ b/runsc/sandbox/network.go @@ -506,6 +506,8 @@ func routesForIface(iface net.Interface, disableIPv6 bool) ([]boot.Route, *boot. var defv4, defv6 *boot.Route var routes []boot.Route for _, r := range rs { + mtu := uint32(r.MTU) + // Is it a default route? if r.Dst == nil { if r.Gw == nil { @@ -523,6 +525,7 @@ func routesForIface(iface net.Interface, disableIPv6 bool) ([]boot.Route, *boot. Mask: net.IPMask(net.IPv4zero), }, Gateway: r.Gw, + MTU: mtu, } case header.IPv6AddressSize: if defv6 != nil { @@ -536,6 +539,7 @@ func routesForIface(iface net.Interface, disableIPv6 bool) ([]boot.Route, *boot. Mask: net.IPMask(net.IPv6zero), }, Gateway: r.Gw, + MTU: mtu, } } default: @@ -552,6 +556,7 @@ func routesForIface(iface net.Interface, disableIPv6 bool) ([]boot.Route, *boot. routes = append(routes, boot.Route{ Destination: dst, Gateway: r.Gw, + MTU: mtu, }) } return routes, defv4, defv6, nil