From 9c7a6a722fafad0628f3fde7b450acea6e0ba046 Mon Sep 17 00:00:00 2001 From: Julien Pinsonneau Date: Fri, 22 Sep 2023 18:57:14 +0200 Subject: [PATCH] dscp mapping --- .../pkg/decode/decode_protobuf.go | 1 + .../pkg/pbflow/flow.pb.go | 121 ++++++++++-------- .../pkg/pbflow/flow_grpc.pb.go | 2 +- 3 files changed, 67 insertions(+), 57 deletions(-) diff --git a/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/decode/decode_protobuf.go b/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/decode/decode_protobuf.go index 633b281a4..e91797914 100644 --- a/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/decode/decode_protobuf.go +++ b/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/decode/decode_protobuf.go @@ -71,6 +71,7 @@ func PBFlowToMap(flow *pbflow.Record) config.GenericMap { out["SrcAddr"] = ipToStr(flow.Network.GetSrcAddr()) out["DstAddr"] = ipToStr(flow.Network.GetDstAddr()) out["Proto"] = flow.Transport.GetProtocol() + out["Dscp"] = flow.Network.GetDscp() proto := flow.Transport.GetProtocol() if proto == syscall.IPPROTO_ICMP || proto == syscall.IPPROTO_ICMPV6 { out["IcmpType"] = flow.GetIcmpType() diff --git a/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/pbflow/flow.pb.go b/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/pbflow/flow.pb.go index c2c642674..16ad2116c 100644 --- a/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/pbflow/flow.pb.go +++ b/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/pbflow/flow.pb.go @@ -1,16 +1,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v3.12.4 +// protoc v3.19.4 // source: proto/flow.proto package pbflow import ( - duration "github.com/golang/protobuf/ptypes/duration" - timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -163,10 +163,10 @@ type Record struct { // protocol as defined by ETH_P_* in linux/if_ether.h // https://github.com/torvalds/linux/blob/master/include/uapi/linux/if_ether.h - EthProtocol uint32 `protobuf:"varint,1,opt,name=eth_protocol,json=ethProtocol,proto3" json:"eth_protocol,omitempty"` - Direction Direction `protobuf:"varint,2,opt,name=direction,proto3,enum=pbflow.Direction" json:"direction,omitempty"` - TimeFlowStart *timestamp.Timestamp `protobuf:"bytes,3,opt,name=time_flow_start,json=timeFlowStart,proto3" json:"time_flow_start,omitempty"` - TimeFlowEnd *timestamp.Timestamp `protobuf:"bytes,4,opt,name=time_flow_end,json=timeFlowEnd,proto3" json:"time_flow_end,omitempty"` + EthProtocol uint32 `protobuf:"varint,1,opt,name=eth_protocol,json=ethProtocol,proto3" json:"eth_protocol,omitempty"` + Direction Direction `protobuf:"varint,2,opt,name=direction,proto3,enum=pbflow.Direction" json:"direction,omitempty"` + TimeFlowStart *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=time_flow_start,json=timeFlowStart,proto3" json:"time_flow_start,omitempty"` + TimeFlowEnd *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=time_flow_end,json=timeFlowEnd,proto3" json:"time_flow_end,omitempty"` // OSI-layer attributes DataLink *DataLink `protobuf:"bytes,5,opt,name=data_link,json=dataLink,proto3" json:"data_link,omitempty"` Network *Network `protobuf:"bytes,6,opt,name=network,proto3" json:"network,omitempty"` @@ -178,19 +178,19 @@ type Record struct { // From all the duplicate flows, one will set this value to false and the rest will be true. Duplicate bool `protobuf:"varint,11,opt,name=duplicate,proto3" json:"duplicate,omitempty"` // Agent IP address to help identifying the source of the flow - AgentIp *IP `protobuf:"bytes,12,opt,name=agent_ip,json=agentIp,proto3" json:"agent_ip,omitempty"` - Flags uint32 `protobuf:"varint,13,opt,name=flags,proto3" json:"flags,omitempty"` - IcmpType uint32 `protobuf:"varint,14,opt,name=icmp_type,json=icmpType,proto3" json:"icmp_type,omitempty"` - IcmpCode uint32 `protobuf:"varint,15,opt,name=icmp_code,json=icmpCode,proto3" json:"icmp_code,omitempty"` - PktDropBytes uint64 `protobuf:"varint,16,opt,name=pkt_drop_bytes,json=pktDropBytes,proto3" json:"pkt_drop_bytes,omitempty"` - PktDropPackets uint64 `protobuf:"varint,17,opt,name=pkt_drop_packets,json=pktDropPackets,proto3" json:"pkt_drop_packets,omitempty"` - PktDropLatestFlags uint32 `protobuf:"varint,18,opt,name=pkt_drop_latest_flags,json=pktDropLatestFlags,proto3" json:"pkt_drop_latest_flags,omitempty"` - PktDropLatestState uint32 `protobuf:"varint,19,opt,name=pkt_drop_latest_state,json=pktDropLatestState,proto3" json:"pkt_drop_latest_state,omitempty"` - PktDropLatestDropCause uint32 `protobuf:"varint,20,opt,name=pkt_drop_latest_drop_cause,json=pktDropLatestDropCause,proto3" json:"pkt_drop_latest_drop_cause,omitempty"` - DnsId uint32 `protobuf:"varint,21,opt,name=dns_id,json=dnsId,proto3" json:"dns_id,omitempty"` - DnsFlags uint32 `protobuf:"varint,22,opt,name=dns_flags,json=dnsFlags,proto3" json:"dns_flags,omitempty"` - DnsLatency *duration.Duration `protobuf:"bytes,23,opt,name=dns_latency,json=dnsLatency,proto3" json:"dns_latency,omitempty"` - TimeFlowRtt *duration.Duration `protobuf:"bytes,24,opt,name=time_flow_rtt,json=timeFlowRtt,proto3" json:"time_flow_rtt,omitempty"` + AgentIp *IP `protobuf:"bytes,12,opt,name=agent_ip,json=agentIp,proto3" json:"agent_ip,omitempty"` + Flags uint32 `protobuf:"varint,13,opt,name=flags,proto3" json:"flags,omitempty"` + IcmpType uint32 `protobuf:"varint,14,opt,name=icmp_type,json=icmpType,proto3" json:"icmp_type,omitempty"` + IcmpCode uint32 `protobuf:"varint,15,opt,name=icmp_code,json=icmpCode,proto3" json:"icmp_code,omitempty"` + PktDropBytes uint64 `protobuf:"varint,16,opt,name=pkt_drop_bytes,json=pktDropBytes,proto3" json:"pkt_drop_bytes,omitempty"` + PktDropPackets uint64 `protobuf:"varint,17,opt,name=pkt_drop_packets,json=pktDropPackets,proto3" json:"pkt_drop_packets,omitempty"` + PktDropLatestFlags uint32 `protobuf:"varint,18,opt,name=pkt_drop_latest_flags,json=pktDropLatestFlags,proto3" json:"pkt_drop_latest_flags,omitempty"` + PktDropLatestState uint32 `protobuf:"varint,19,opt,name=pkt_drop_latest_state,json=pktDropLatestState,proto3" json:"pkt_drop_latest_state,omitempty"` + PktDropLatestDropCause uint32 `protobuf:"varint,20,opt,name=pkt_drop_latest_drop_cause,json=pktDropLatestDropCause,proto3" json:"pkt_drop_latest_drop_cause,omitempty"` + DnsId uint32 `protobuf:"varint,21,opt,name=dns_id,json=dnsId,proto3" json:"dns_id,omitempty"` + DnsFlags uint32 `protobuf:"varint,22,opt,name=dns_flags,json=dnsFlags,proto3" json:"dns_flags,omitempty"` + DnsLatency *durationpb.Duration `protobuf:"bytes,23,opt,name=dns_latency,json=dnsLatency,proto3" json:"dns_latency,omitempty"` + TimeFlowRtt *durationpb.Duration `protobuf:"bytes,24,opt,name=time_flow_rtt,json=timeFlowRtt,proto3" json:"time_flow_rtt,omitempty"` } func (x *Record) Reset() { @@ -239,14 +239,14 @@ func (x *Record) GetDirection() Direction { return Direction_INGRESS } -func (x *Record) GetTimeFlowStart() *timestamp.Timestamp { +func (x *Record) GetTimeFlowStart() *timestamppb.Timestamp { if x != nil { return x.TimeFlowStart } return nil } -func (x *Record) GetTimeFlowEnd() *timestamp.Timestamp { +func (x *Record) GetTimeFlowEnd() *timestamppb.Timestamp { if x != nil { return x.TimeFlowEnd } @@ -379,14 +379,14 @@ func (x *Record) GetDnsFlags() uint32 { return 0 } -func (x *Record) GetDnsLatency() *duration.Duration { +func (x *Record) GetDnsLatency() *durationpb.Duration { if x != nil { return x.DnsLatency } return nil } -func (x *Record) GetTimeFlowRtt() *duration.Duration { +func (x *Record) GetTimeFlowRtt() *durationpb.Duration { if x != nil { return x.TimeFlowRtt } @@ -453,8 +453,9 @@ type Network struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SrcAddr *IP `protobuf:"bytes,1,opt,name=src_addr,json=srcAddr,proto3" json:"src_addr,omitempty"` - DstAddr *IP `protobuf:"bytes,2,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"` + SrcAddr *IP `protobuf:"bytes,1,opt,name=src_addr,json=srcAddr,proto3" json:"src_addr,omitempty"` + DstAddr *IP `protobuf:"bytes,2,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"` + Dscp uint32 `protobuf:"varint,3,opt,name=dscp,proto3" json:"dscp,omitempty"` } func (x *Network) Reset() { @@ -503,6 +504,13 @@ func (x *Network) GetDstAddr() *IP { return nil } +func (x *Network) GetDscp() uint32 { + if x != nil { + return x.Dscp + } + return 0 +} + type IP struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -729,30 +737,31 @@ var file_proto_flow_proto_rawDesc = []byte{ 0x12, 0x17, 0x0a, 0x07, 0x73, 0x72, 0x63, 0x5f, 0x6d, 0x61, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x73, 0x72, 0x63, 0x4d, 0x61, 0x63, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x64, 0x73, 0x74, 0x4d, - 0x61, 0x63, 0x22, 0x57, 0x0a, 0x07, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x25, 0x0a, + 0x61, 0x63, 0x22, 0x6b, 0x0a, 0x07, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x25, 0x0a, 0x08, 0x73, 0x72, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x49, 0x50, 0x52, 0x07, 0x73, 0x72, 0x63, 0x41, 0x64, 0x64, 0x72, 0x12, 0x25, 0x0a, 0x08, 0x64, 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x66, 0x6c, 0x6f, 0x77, 0x2e, - 0x49, 0x50, 0x52, 0x07, 0x64, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x22, 0x3d, 0x0a, 0x02, 0x49, - 0x50, 0x12, 0x14, 0x0a, 0x04, 0x69, 0x70, 0x76, 0x34, 0x18, 0x01, 0x20, 0x01, 0x28, 0x07, 0x48, - 0x00, 0x52, 0x04, 0x69, 0x70, 0x76, 0x34, 0x12, 0x14, 0x0a, 0x04, 0x69, 0x70, 0x76, 0x36, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x69, 0x70, 0x76, 0x36, 0x42, 0x0b, 0x0a, - 0x09, 0x69, 0x70, 0x5f, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x22, 0x5d, 0x0a, 0x09, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x72, 0x63, 0x5f, 0x70, - 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x73, 0x72, 0x63, 0x50, 0x6f, - 0x72, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x73, 0x74, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x64, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2a, 0x24, 0x0a, 0x09, 0x44, 0x69, 0x72, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x47, 0x52, 0x45, 0x53, - 0x53, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x47, 0x52, 0x45, 0x53, 0x53, 0x10, 0x01, 0x32, - 0x3e, 0x0a, 0x09, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x31, 0x0a, 0x04, - 0x53, 0x65, 0x6e, 0x64, 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x73, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x43, - 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, - 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x70, 0x62, 0x66, 0x6c, 0x6f, 0x77, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x49, 0x50, 0x52, 0x07, 0x64, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x64, + 0x73, 0x63, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x64, 0x73, 0x63, 0x70, 0x22, + 0x3d, 0x0a, 0x02, 0x49, 0x50, 0x12, 0x14, 0x0a, 0x04, 0x69, 0x70, 0x76, 0x34, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x07, 0x48, 0x00, 0x52, 0x04, 0x69, 0x70, 0x76, 0x34, 0x12, 0x14, 0x0a, 0x04, 0x69, + 0x70, 0x76, 0x36, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x69, 0x70, 0x76, + 0x36, 0x42, 0x0b, 0x0a, 0x09, 0x69, 0x70, 0x5f, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x22, 0x5d, + 0x0a, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, + 0x72, 0x63, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x73, + 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x73, 0x74, 0x5f, 0x70, 0x6f, + 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x64, 0x73, 0x74, 0x50, 0x6f, 0x72, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2a, 0x24, 0x0a, + 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, + 0x47, 0x52, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x47, 0x52, 0x45, 0x53, + 0x53, 0x10, 0x01, 0x32, 0x3e, 0x0a, 0x09, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x12, 0x31, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x66, 0x6c, 0x6f, + 0x77, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x66, 0x6c, + 0x6f, 0x77, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x70, 0x62, 0x66, 0x6c, 0x6f, 0x77, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -770,16 +779,16 @@ func file_proto_flow_proto_rawDescGZIP() []byte { var file_proto_flow_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_proto_flow_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_proto_flow_proto_goTypes = []interface{}{ - (Direction)(0), // 0: pbflow.Direction - (*CollectorReply)(nil), // 1: pbflow.CollectorReply - (*Records)(nil), // 2: pbflow.Records - (*Record)(nil), // 3: pbflow.Record - (*DataLink)(nil), // 4: pbflow.DataLink - (*Network)(nil), // 5: pbflow.Network - (*IP)(nil), // 6: pbflow.IP - (*Transport)(nil), // 7: pbflow.Transport - (*timestamp.Timestamp)(nil), // 8: google.protobuf.Timestamp - (*duration.Duration)(nil), // 9: google.protobuf.Duration + (Direction)(0), // 0: pbflow.Direction + (*CollectorReply)(nil), // 1: pbflow.CollectorReply + (*Records)(nil), // 2: pbflow.Records + (*Record)(nil), // 3: pbflow.Record + (*DataLink)(nil), // 4: pbflow.DataLink + (*Network)(nil), // 5: pbflow.Network + (*IP)(nil), // 6: pbflow.IP + (*Transport)(nil), // 7: pbflow.Transport + (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 9: google.protobuf.Duration } var file_proto_flow_proto_depIdxs = []int32{ 3, // 0: pbflow.Records.entries:type_name -> pbflow.Record diff --git a/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/pbflow/flow_grpc.pb.go b/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/pbflow/flow_grpc.pb.go index 8cee0c714..fccb88095 100644 --- a/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/pbflow/flow_grpc.pb.go +++ b/vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/pbflow/flow_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.12.4 +// - protoc v3.19.4 // source: proto/flow.proto package pbflow