mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-02 17:56:16 +00:00
afea2af1391314be0e5caaa0125c884da2405316 net: reduce log level for PCP/NAT-PMP NOT_AUTHORIZED failures (ANAVHEOBA) Pull request description: Cherry-picks (and tweaks) a commit from #34117 which the ANAVHEOBA did not follow up with when changes were requested. The tweak here is to log once at `LogWarning`, so that users have a chance to spot misconfiguration. ---- Users running on home networks with routers that don't support PCP (Port Control Protocol) or NAT-PMP port mapping receive frequent warning-level log messages every few minutes: "pcp: Mapping failed with result NOT_AUTHORIZED (code 2)" This is expected behavior for many consumer routers that have PCP disabled by default, not an actionable error. Add explicit constants for the NOT_AUTHORIZED result code (value 2) for both NAT-PMP and PCP protocols. Log the first NOT_AUTHORIZED failure at warning level for visibility, then downgrade subsequent occurrences to LogDebug to avoid log noise. Other failure types continue to warn unconditionally. Fixes #34114 ACKs for top commit: achow101: ACK afea2af1391314be0e5caaa0125c884da2405316 sedited: ACK afea2af1391314be0e5caaa0125c884da2405316 Tree-SHA512: 43dad9f3cca0ef9b82446045a3ccd90418cd5595c9965e938d9d539bbba863dde6b4a358adbee56f8d97d6efbf947eb5ddbbaf426faefcf3b1e36e4c8edb0d94