Skip to content

Commit

Permalink
Make it clearer which addresses we want to keep non-aggregated.
Browse files Browse the repository at this point in the history
  • Loading branch information
ovalenti committed Jul 4, 2024
1 parent f9468f1 commit dd6048e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion collector/lib/ConnTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ IPNet ConnectionTracker::NormalizeAddressNoLock(const Address& address) const {
return {};
}

bool private_addr = !address.IsPublic();
bool do_not_aggregate_addr = !non_aggregated_networks_.Find(address).IsNull();

// We want to keep private addresses and explicitely requested ones.
bool keep_addr = !address.IsPublic() || !non_aggregated_networks_.Find(address).IsNull();
bool keep_addr = private_addr || do_not_aggregate_addr;

const bool* known_private_networks_exists = Lookup(known_private_networks_exists_, address.family());
if (keep_addr && (known_private_networks_exists && !*known_private_networks_exists)) {
return IPNet(address, 0, true);
Expand Down

0 comments on commit dd6048e

Please sign in to comment.