mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-06 13:47:56 +02:00
Merge bitcoin/bitcoin#34742: fuzz: set whitelist permissions on connman target
32debfa1edfuzz: 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: utACK32debfa1edmaflcko: lgtm ACK32debfa1edfrankomosh: crACK32debfa1edTree-SHA512: 400ce780b9ae41d849ccad04258da4ad92d9bf780bfdeb9bb9c1684722bcc02ae45f13081b809f9e16b28078bd4efb928c6c7e1c3da638307b6c11b193d6dc04
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user