Merge bitcoin/bitcoin#34742: fuzz: set whitelist permissions on connman target

32debfa1ed fuzz: set whitelist permissions on connman target (Bruno Garcia)

Pull request description:

  I noticed that `AddWhitelistPermissionFlags` was always being called with an empty `ranges` (whitelist permissions). This function is called when connecting to a node (`ConnectNode`), and if the connection is a manual one, it uses the `vWhitelistedRangeOutgoing` to populate the permissions. However, since we were not setting any whitelist permission on the target, this vector is always empty. This PR improves this target by populating both `vWhitelistedRangeIncoming` and `vWhitelistedRangeOutgoing`.

ACKs for top commit:
  Crypt-iQ:
    utACK 32debfa1ed
  maflcko:
    lgtm ACK 32debfa1ed
  frankomosh:
    crACK 32debfa1ed

Tree-SHA512: 400ce780b9ae41d849ccad04258da4ad92d9bf780bfdeb9bb9c1684722bcc02ae45f13081b809f9e16b28078bd4efb928c6c7e1c3da638307b6c11b193d6dc04
This commit is contained in:
merge-script
2026-03-18 21:44:06 +08:00

View File

@@ -79,6 +79,18 @@ FUZZ_TARGET(connman, .init = initialize_connman)
CConnman::Options options;
options.m_msgproc = &net_events;
options.nMaxOutboundLimit = max_outbound_limit;
auto consume_whitelist = [&]() {
std::vector<NetWhitelistPermissions> result(fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 3));
for (auto& entry : result) {
entry.m_flags = ConsumeWeakEnum(fuzzed_data_provider, ALL_NET_PERMISSION_FLAGS);
entry.m_subnet = ConsumeSubNet(fuzzed_data_provider);
}
return result;
};
options.vWhitelistedRangeIncoming = consume_whitelist();
options.vWhitelistedRangeOutgoing = consume_whitelist();
connman.Init(options);
CNetAddr random_netaddr;