Skip to content

Commit

Permalink
[Agent] fixes http2 go uprobe wrong direction #22443
Browse files Browse the repository at this point in the history
  • Loading branch information
TomatoMr committed Sep 22, 2023
1 parent bbb792b commit 4e33080
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
9 changes: 7 additions & 2 deletions agent/src/flow_generator/flow_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ use super::{

use crate::{
common::{
ebpf::EbpfType,
endpoint::{
EndpointData, EndpointDataPov, EndpointInfo, EPC_FROM_DEEPFLOW, EPC_FROM_INTERNET,
},
Expand Down Expand Up @@ -983,8 +984,12 @@ impl FlowMap {

fn init_flow(&mut self, config: &Config, meta_packet: &mut MetaPacket) -> Box<FlowNode> {
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;
Expand Down
15 changes: 12 additions & 3 deletions agent/src/flow_generator/protocol_logs/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}
Expand Down

0 comments on commit 4e33080

Please sign in to comment.