diff --git a/cmd/cni/cni.go b/cmd/cni/cni.go index 4289ce7d7fb..48b540c5f9f 100644 --- a/cmd/cni/cni.go +++ b/cmd/cni/cni.go @@ -85,6 +85,7 @@ func generateCNIResult(cniResponse *request.CniResponse, netns string) current.R podIface := current.Interface{ Name: cniResponse.PodNicName, Mac: cniResponse.MacAddress, + Mtu: cniResponse.Mtu, Sandbox: netns, } switch cniResponse.Protocol { diff --git a/pkg/daemon/handler.go b/pkg/daemon/handler.go index 6d42cc1a723..6e3e89af75f 100644 --- a/pkg/daemon/handler.go +++ b/pkg/daemon/handler.go @@ -226,6 +226,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon return } + var mtu int routes = append(podRequest.Routes, routes...) if strings.HasSuffix(podRequest.Provider, util.OvnProvider) && subnet != "" { podSubnet, err := csh.Controller.subnetsLister.Get(subnet) @@ -270,7 +271,6 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon detectIPConflict = false } - var mtu int if podSubnet.Spec.Mtu > 0 { mtu = int(podSubnet.Spec.Mtu) } else { @@ -368,6 +368,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon CIDR: cidr, PodNicName: podNicName, Routes: routes, + Mtu: mtu, } if isDefaultRoute { response.Gateway = gw