mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-15 01:58:09 +02:00
c73b59d47ffuzz: implement targets for PCP and NAT-PMP port mapping requests (Antoine Poinsot)1695c8ab5bfuzz: in FuzzedSock::GetSockName(), return a random-length name (Antoine Poinsot)0d472c1953fuzz: never return an uninitialized sockaddr in FuzzedSock::GetSockName (Antoine Poinsot)39b7e2b590fuzz: add steady clock mocking to FuzzedSock (Antoine Poinsot)6fe1c35c05pcp: make NAT-PMP error codes uint16_t (Antoine Poinsot)01906ce912pcp: make the ToString method const (Antoine Poinsot) Pull request description: Based on https://github.com/bitcoin/bitcoin/pull/31022, this introduces a fuzz target for `PCPRequestPortMap` and `NATPMPRequestPortMap`. Like in #31022 we set `CreateSock` to return a `Sock` which mocks the responses from the server and uses a mocked steady clock for the `Wait`s. Except here we simply respond with fuzzer-provided data until the client stop sending requests. We also sometimes inject errors and connection failures based on fuzzer-provided data. We reuse the existing `FuzzedSock`, so a preparatory commit is included that adds steady clock mocking to it. This may be useful for other harnesses as well. ACKs for top commit: laanwj: re-ACKc73b59d47fmarcofleon: ACKc73b59d47fdergoegge: utACKc73b59d47fTree-SHA512: 24cd4d958a0999946a0c3d164a242fc3f0a0b66770630252b881423ad0065d29fdaab765014d193b705d3eff397f201d51a88a3ca80c63fd3867745e6f21bb2b