Skip to content

Commit

Permalink
fix: container env supports aggr packets with and without tunnels
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchaoa authored and rvql committed Oct 31, 2024
1 parent d967cdb commit 0eeb563
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions agent/src/flow_generator/flow_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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;
Expand Down Expand Up @@ -264,7 +265,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;
}
}
Expand Down Expand Up @@ -301,10 +302,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地址
Expand All @@ -321,7 +318,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);

Expand Down

0 comments on commit 0eeb563

Please sign in to comment.