From b6d37f78ef2a2a4f1aa3e79beac7d7c9217a2823 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Thu, 31 Oct 2024 15:00:51 +0800 Subject: [PATCH] fix: container env supports aggr packets with and without tunnels --- agent/src/flow_generator/flow_node.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/agent/src/flow_generator/flow_node.rs b/agent/src/flow_generator/flow_node.rs index d69687b8702..dc83a2f5326 100644 --- a/agent/src/flow_generator/flow_node.rs +++ b/agent/src/flow_generator/flow_node.rs @@ -27,6 +27,7 @@ use crate::common::{ tagged_flow::TaggedFlow, TapPort, Timestamp, }; +use crate::utils::environment::{is_tt_hyper_v, is_tt_pod}; use public::{proto::common::TridentType, utils::net::MacAddr}; use npb_pcap_policy::PolicyData; @@ -262,7 +263,7 @@ impl FlowNode { || (meta_packet.tunnel.is_none() && flow.tunnel.tunnel_type != TunnelType::None) { // 微软ACS存在非对称隧道流量,需要排除 - if !Self::is_hyper_v(trident_type) { + if !is_tt_hyper_v(trident_type) && !is_tt_pod(trident_type) { return false; } } @@ -299,10 +300,6 @@ impl FlowNode { ) } - fn is_hyper_v(trident_type: TridentType) -> bool { - trident_type == TridentType::TtHyperVCompute || trident_type == TridentType::TtHyperVNetwork - } - // Microsoft ACS: // HyperVNetwork网关宿主机和HyperVCompute网关流量模型中,MAC地址不对称 // 在部分微软ACS环境中,IP地址不存在相同的场景,所以流聚合可直接忽略MAC地址 @@ -319,7 +316,7 @@ impl FlowNode { trident_type: TridentType, ) -> MatchMac { let ignore_mac = meta_packet.tunnel.is_some() - && ((Self::is_hyper_v(trident_type) && meta_packet.tunnel.unwrap().tier < 2) + && ((is_tt_hyper_v(trident_type) && meta_packet.tunnel.unwrap().tier < 2) || meta_packet.tunnel.unwrap().tunnel_type == TunnelType::TencentGre || meta_packet.tunnel.unwrap().tunnel_type == TunnelType::Ipip);