HomePhabricator

net: reduce log level for PCP/NAT-PMP NOT_AUTHORIZED failures

Description

net: reduce log level for PCP/NAT-PMP NOT_AUTHORIZED failures

Summary:
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.

Co-authored-by: willcl-ark <will@256k1.dev>

This is a backport of core#34549
Depends on D19804

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D19805

Details

Provenance
ANAVHEOBA <wisdomabraham92@gmail.com>Authored on Dec 19 2025, 16:35
PiRKCommitted on Apr 9 2026, 15:55
PiRKPushed on Apr 9 2026, 15:55
Reviewer
Restricted Project
Differential Revision
D19805: net: reduce log level for PCP/NAT-PMP NOT_AUTHORIZED failures
Parents
rABC37cd4bee71e5: net: Add interrupt to pcp retry loop
Branches
Unknown
Tags
Unknown