1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-05-08 00:17:31 +00:00

runtime: add the flags support to the route setting

We should support the flags when add the route from
host to guest. Otherwise, some route would be set
failed.

Fixes: 

Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
This commit is contained in:
Fupan Li 2025-01-16 12:07:31 +08:00
parent 8ef8109b2f
commit 1ade2a874f
3 changed files with 36 additions and 25 deletions
src
libs/protocols/protos
runtime/virtcontainers
network.go
pkg/agent/protocols

View File

@ -58,6 +58,7 @@ message Route {
string source = 4;
uint32 scope = 5;
IPFamily family = 6;
uint32 flags = 7;
}
message ARPNeighbor {

View File

@ -309,6 +309,7 @@ func generateVCNetworkStructures(ctx context.Context, endpoints []Endpoint) ([]*
r.Device = endpoint.Name()
r.Scope = uint32(route.Scope)
r.Family = utils.ConvertAddressFamily((int32)(route.Family))
r.Flags = uint32(route.Flags)
routes = append(routes, &r)
}

View File

@ -7,8 +7,8 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.21.12
// protoc-gen-go v1.32.0
// protoc v5.29.3
// source: types.proto
package protocols
@ -307,6 +307,7 @@ type Route struct {
Source string `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"`
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"`
}
func (x *Route) Reset() {
@ -383,6 +384,13 @@ func (x *Route) GetFamily() IPFamily {
return IPFamily_v4
}
func (x *Route) GetFlags() uint32 {
if x != nil {
return x.Flags
}
return 0
}
type ARPNeighbor struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -486,7 +494,7 @@ var file_types_proto_rawDesc = []byte{
0x09, 0x52, 0x07, 0x70, 0x63, 0x69, 0x50, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79,
0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b,
0x0a, 0x09, 0x72, 0x61, 0x77, 0x5f, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x08, 0x72, 0x61, 0x77, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x05,
0x0d, 0x52, 0x08, 0x72, 0x61, 0x77, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x22, 0xba, 0x01, 0x0a, 0x05,
0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x61, 0x74,
0x65, 0x77, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65,
@ -497,28 +505,29 @@ var file_types_proto_rawDesc = []byte{
0x28, 0x0d, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x27, 0x0a, 0x06, 0x66, 0x61, 0x6d,
0x69, 0x6c, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65,
0x73, 0x2e, 0x49, 0x50, 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x52, 0x06, 0x66, 0x61, 0x6d, 0x69,
0x6c, 0x79, 0x22, 0x9d, 0x01, 0x0a, 0x0b, 0x41, 0x52, 0x50, 0x4e, 0x65, 0x69, 0x67, 0x68, 0x62,
0x6f, 0x72, 0x12, 0x32, 0x0a, 0x0b, 0x74, 0x6f, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x74, 0x6f, 0x49, 0x50, 0x41,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x16,
0x0a, 0x06, 0x6c, 0x6c, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x6c, 0x6c, 0x61, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x66, 0x6c, 0x61,
0x67, 0x73, 0x2a, 0x1a, 0x0a, 0x08, 0x49, 0x50, 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x12, 0x06,
0x0a, 0x02, 0x76, 0x34, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x76, 0x36, 0x10, 0x01, 0x2a, 0x35,
0x0a, 0x13, 0x46, 0x53, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50,
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x10,
0x00, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x4d, 0x69, 0x73, 0x6d, 0x61,
0x74, 0x63, 0x68, 0x10, 0x01, 0x42, 0x5b, 0x5a, 0x59, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x61, 0x74, 0x61, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x73, 0x2f, 0x6b, 0x61, 0x74, 0x61, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x73, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f,
0x76, 0x69, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x2f, 0x70,
0x6b, 0x67, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x22, 0x9d, 0x01, 0x0a, 0x0b, 0x41, 0x52, 0x50,
0x4e, 0x65, 0x69, 0x67, 0x68, 0x62, 0x6f, 0x72, 0x12, 0x32, 0x0a, 0x0b, 0x74, 0x6f, 0x49, 0x50,
0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e,
0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52,
0x0b, 0x74, 0x6f, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06,
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65,
0x76, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6c, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x6c, 0x61, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05,
0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61,
0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28,
0x05, 0x52, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x2a, 0x1a, 0x0a, 0x08, 0x49, 0x50, 0x46, 0x61,
0x6d, 0x69, 0x6c, 0x79, 0x12, 0x06, 0x0a, 0x02, 0x76, 0x34, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02,
0x76, 0x36, 0x10, 0x01, 0x2a, 0x35, 0x0a, 0x13, 0x46, 0x53, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43,
0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x0a, 0x0a, 0x06, 0x41,
0x6c, 0x77, 0x61, 0x79, 0x73, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x6e, 0x52, 0x6f, 0x6f,
0x74, 0x4d, 0x69, 0x73, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x10, 0x01, 0x42, 0x5b, 0x5a, 0x59, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x61, 0x74, 0x61, 0x2d, 0x63,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x2f, 0x6b, 0x61, 0x74, 0x61, 0x2d, 0x63,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x72, 0x75,
0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x69, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69,
0x6e, 0x65, 0x72, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (