mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 22:58:40 +02:00
Merge bitcoin/bitcoin#28584: Fuzz: extend CConnman tests
0802398e74fuzz: make it possible to mock (fuzz) CThreadInterrupt (Vasil Dimov)6d9e5d130dfuzz: add CConnman::SocketHandler() to the tests (Vasil Dimov)3265df63a4fuzz: add CConnman::InitBinds() to the tests (Vasil Dimov)91cbf4dbd8fuzz: add CConnman::CreateNodeFromAcceptedSocket() to the tests (Vasil Dimov)50da7432ecfuzz: add CConnman::OpenNetworkConnection() to the tests (Vasil Dimov)e6a917c8f8fuzz: add Fuzzed NetEventsInterface and use it in connman tests (Vasil Dimov)e883b37768fuzz: set the output argument of FuzzedSock::Accept() (Vasil Dimov) Pull request description: Extend `CConnman` fuzz tests to also exercise the methods `OpenNetworkConnection()`, `CreateNodeFromAcceptedSocket()`, `InitBinds()` and `SocketHandler()`. Previously fuzzing those methods would have resulted in real socket functions being called in the operating system which is undesirable during fuzzing. Now that https://github.com/bitcoin/bitcoin/pull/21878 is complete all those are mocked to a fuzzed socket and a fuzzed DNS resolver (see how `CreateSock` and `g_dns_lookup` are replaced in the first commit). ACKs for top commit: achow101: ACK0802398e74jonatack: Review re-ACK0802398e74dergoegge: Code review ACK0802398e74Tree-SHA512: a717d4e79f42bacf2b029c821fdc265e10e4e5c41af77cd4cb452cc5720ec83c62789d5b3dfafd39a22cc8c0500b18169aa7864d497dded729a32ab863dd6c4d
This commit is contained in:
@@ -71,6 +71,24 @@ struct ConnmanTestMsg : public CConnman {
|
||||
m_nodes.clear();
|
||||
}
|
||||
|
||||
void CreateNodeFromAcceptedSocketPublic(std::unique_ptr<Sock> sock,
|
||||
NetPermissionFlags permissions,
|
||||
const CAddress& addr_bind,
|
||||
const CAddress& addr_peer)
|
||||
{
|
||||
CreateNodeFromAcceptedSocket(std::move(sock), permissions, addr_bind, addr_peer);
|
||||
}
|
||||
|
||||
bool InitBindsPublic(const CConnman::Options& options)
|
||||
{
|
||||
return InitBinds(options);
|
||||
}
|
||||
|
||||
void SocketHandlerPublic()
|
||||
{
|
||||
SocketHandler();
|
||||
}
|
||||
|
||||
void Handshake(CNode& node,
|
||||
bool successfully_connected,
|
||||
ServiceFlags remote_services,
|
||||
|
||||
Reference in New Issue
Block a user