Skip to content

Commit

Permalink
fix: skip_npb_bpf is not effective
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchaoa committed Mar 9, 2025
1 parent 8fd763d commit ad7c51a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions agent/src/dispatcher/recv_engine/bpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ impl Builder {
// 不采集和TSDB通信的流量
bpf_builder.appends(&mut self.skip_ipv4_tsdb());
// 不采集分发流量
if self.skip_npb_bpf {
if !self.skip_npb_bpf {
bpf_builder.appends(&mut self.skip_ipv4_npb());
}

Expand All @@ -739,7 +739,7 @@ impl Builder {
// 不采集和TSDB通信的流量
bpf_builder.appends(&mut self.skip_ipv6_tsdb());
// 不采集分发流量
if self.skip_npb_bpf {
if !self.skip_npb_bpf {
bpf_builder.appends(&mut self.skip_ipv6_npb());
}

Expand Down Expand Up @@ -784,7 +784,7 @@ impl Builder {
ip_version, self.analyzer_source_ip, self.analyzer_port
));

if self.skip_npb_bpf {
if !self.skip_npb_bpf {
// 不采集分发的VXLAN流量
conditions.push(format!(
"not (udp and dst port {} and udp[8:1]={:#x})",
Expand Down Expand Up @@ -827,7 +827,7 @@ mod tests {
proxy_controller_port: 7788,
analyzer_port: 8899,
analyzer_source_ip: "1.2.3.4".parse::<IpAddr>().unwrap(),
skip_npb_bpf: true,
skip_npb_bpf: false,
};

let syntax = builder.build_pcap_syntax();
Expand Down Expand Up @@ -917,7 +917,7 @@ mod tests {
analyzer_source_ip: "9999:aaaa:bbbb:cccc:dddd:eeee:ffff:0000"
.parse::<IpAddr>()
.unwrap(),
skip_npb_bpf: true,
skip_npb_bpf: false,
};

let syntax = builder.build_pcap_syntax();
Expand Down
1 change: 1 addition & 0 deletions agent/src/trident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3613,6 +3613,7 @@ fn build_dispatchers(
fanout_enabled,
#[cfg(any(target_os = "linux", target_os = "android"))]
promisc: user_config.inputs.cbpf.af_packet.tunning.promisc,
skip_npb_bpf: user_config.inputs.cbpf.af_packet.skip_npb_bpf,
..Default::default()
})))
.bpf_options(bpf_options)
Expand Down

0 comments on commit ad7c51a

Please sign in to comment.