runtime: add the mtu support for updating routes

Some cni plugins will set the MTU of some routes, such as cilium will
modify the MTU of the default route. If the mtu of the route is not set
correctly, it may cause excessive fragmentation or even packet loss of
network packets. Therefore, this PR adds the setting of the MTU of the
route. First, when obtaining the route, if the MTU is set, the MTU will
also be obtained and set to the route in the guest.

Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
This commit is contained in:
Fupan Li
2025-05-02 21:18:16 +08:00
committed by Fabiano Fidêncio
parent fbf7faa9f4
commit 492329fc02
9 changed files with 44 additions and 3 deletions

View File

@@ -310,6 +310,8 @@ func generateVCNetworkStructures(ctx context.Context, endpoints []Endpoint) ([]*
r.Scope = uint32(route.Scope)
r.Family = utils.ConvertAddressFamily((int32)(route.Family))
r.Flags = uint32(route.Flags)
r.Mtu = uint32(route.MTU)
routes = append(routes, &r)
}

View File

@@ -308,6 +308,7 @@ type Route struct {
Scope uint32 `protobuf:"varint,5,opt,name=scope,proto3" json:"scope,omitempty"`
Family IPFamily `protobuf:"varint,6,opt,name=family,proto3,enum=types.IPFamily" json:"family,omitempty"`
Flags uint32 `protobuf:"varint,7,opt,name=flags,proto3" json:"flags,omitempty"`
Mtu uint32 `protobuf:"varint,8,opt,name=mtu,proto3" json:"mtu,omitempty"`
}
func (x *Route) Reset() {