From 4e330801695056d7e0084dfa7c439533ae9002ca Mon Sep 17 00:00:00 2001 From: huanchao Date: Fri, 22 Sep 2023 15:28:42 +0800 Subject: [PATCH] [Agent] fixes http2 go uprobe wrong direction #22443 --- agent/src/flow_generator/flow_map.rs | 9 +++++++-- agent/src/flow_generator/protocol_logs/http.rs | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/agent/src/flow_generator/flow_map.rs b/agent/src/flow_generator/flow_map.rs index 73aa0ecbca2..df80db4943f 100644 --- a/agent/src/flow_generator/flow_map.rs +++ b/agent/src/flow_generator/flow_map.rs @@ -48,6 +48,7 @@ use super::{ use crate::{ common::{ + ebpf::EbpfType, endpoint::{ EndpointData, EndpointDataPov, EndpointInfo, EPC_FROM_DEEPFLOW, EPC_FROM_INTERNET, }, @@ -983,8 +984,12 @@ impl FlowMap { fn init_flow(&mut self, config: &Config, meta_packet: &mut MetaPacket) -> Box { let flow_config = config.flow; - - meta_packet.lookup_key.direction = PacketDirection::ClientToServer; + match meta_packet.ebpf_type { + EbpfType::GoHttp2Uprobe | EbpfType::GoHttp2UprobeData => {} + _ => { + meta_packet.lookup_key.direction = PacketDirection::ClientToServer; + } + } let mut tagged_flow = TaggedFlow::default(); let lookup_key = &meta_packet.lookup_key; diff --git a/agent/src/flow_generator/protocol_logs/http.rs b/agent/src/flow_generator/protocol_logs/http.rs index 3e55ec2e6b5..046c666a940 100644 --- a/agent/src/flow_generator/protocol_logs/http.rs +++ b/agent/src/flow_generator/protocol_logs/http.rs @@ -451,9 +451,18 @@ impl L7ProtocolParserInterface for HttpLog { return false; }; match param.ebpf_type { - EbpfType::GoHttp2Uprobe => self - .parse_http2_go_uprobe(&config.l7_log_dynamic, payload, param, &mut info) - .is_ok(), + EbpfType::GoHttp2Uprobe | EbpfType::GoHttp2UprobeData => { + if param.direction == PacketDirection::ServerToClient { + return false; + } + self.parse_http2_go_uprobe( + &config.l7_log_dynamic, + payload, + param, + &mut info, + ) + .is_ok() + } _ => self.parse_http_v2(payload, param, &mut info).is_ok(), } }