This PR adds PCP (Port Control Protocol) from RFC6887. This adds, in addition to the existing IPv4 port mapping (which now uses PCP, with fallback to NAT-PMP), support for IPv6 pinholing-that is, opening a port on the firewall to make it reachable.
PCP, like NAT-PMP is a simple UDP-based protocol, and the implementation is self-contained, so this gets rid of lthe libnatpnp dependency without adding a new one. It should otherwise be a drop-in replacement. NAT-PMP fallback is implemented so this will not make router support worse.
For now it is disabled by default, though in the future (not in this PR) we could consider enable it by default to increase the number of connectable nodes without adding significant attack surface.
crypto: Add missing WriteBE16 function
Also add fuzz test, mimicing the WriteLE16 one.
https://github.com/bitcoin/bitcoin/pull/30043/changes/754e4254388ec8ac1be6cf807bf300cd43fd3da5
net: Add PCP and NATPMP implementation
Add a RFC 6886 NATPMP and RFC 6887 Port Control Protocol (PCP)
implementation, to replace libnatpmp.
https://github.com/bitcoin/bitcoin/pull/30043/changes/97c97177cdb2f596aa7d4a65c4bde87de50a96f2
net: Replace libnatpmp with built-in NATPMP+PCP implementation in mapport
https://github.com/bitcoin/bitcoin/pull/30043/changes/52f8ef66c61b82457a161f3b90cc87f57d1dda80
qt: Changes for built-in PCP+NAT-PMP
Change option help, and remove conditionals.
https://github.com/bitcoin/bitcoin/pull/30043/changes/7b04709862f48e9020c7bef79cb31dd794cf91d0
cmake: remove natpmp dependency and configuration
depends: Drop natpmp and associated option from depends
https://github.com/bitcoin/bitcoin/pull/30043/changes/061c3e32a26c6c04bf734d62627403758d7e51d9
This concludes backport of core#30043
Depends on D19759
Ref T3982