net: reduce log level for PCP/NAT-PMP NOT_AUTHORIZED failures#34117
net: reduce log level for PCP/NAT-PMP NOT_AUTHORIZED failures#34117ANAVHEOBA wants to merge 2 commits intobitcoin:masterfrom
Conversation
Users running Bitcoin Core 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. The repeated warnings create unnecessary log noise. This change: - Adds explicit constants for NOT_AUTHORIZED result code (value 2) for both NAT-PMP and PCP protocols - Downgrades NOT_AUTHORIZED failures from LogWarning to LogDebug since this is an expected condition on many networks - Keeps LogWarning for other failure types that may indicate actual configuration or network issues The NOT_AUTHORIZED message will still be visible when running with -debug=net for users who need to troubleshoot port mapping issues. Fixes bitcoin#34114
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34117. ReviewsSee the guideline for information on the review process. |
When -externalip is specified, Bitcoin Core disables automatic address discovery by setting fDiscover to false. This is intended to prevent discovery of IPv4/IPv6 addresses when the user already knows their public IP. However, this also incorrectly prevented CJDNS addresses from being discovered and added to the local address list. CJDNS is a separate overlay network, and specifying an IPv4/IPv6 external IP should not affect CJDNS address advertising. This fix modifies: 1. Discover() - Continue processing CJDNS addresses even when fDiscover is false, skipping only non-CJDNS addresses 2. AddLocal() - Allow CJDNS addresses to be added even when discovery is disabled, since they should still be advertised Now users running with -externalip and -cjdnsreachable will have their CJDNS address properly appear in local addresses and be logged via AddLocal(), matching the behavior when -externalip is not specified. Fixes bitcoin#33471
|
you have created a PR with 2 commits, one is unrelated to this PR it seems |
|
Both commit were on the issues list |
|
This PR mixes two unrelated changes:
These should be separate PRs. Each change looks reasonable on its own, but combining unrelated fixes makes review harder and complicates git history/bisecting. Would you please split this into two PRs and resubmit? |
|
@ANAVHEOBA are you still working on this? |
|
Yes, I push today |
|
I am interested in working with bitcoin what is it going to take |
|
I'll go ahead and close this for now. This clearly needs separate pull requests, so this one will need to be closed either way. |
|
@ANAVHEOBA do you intend to open a new PR with the first commit only as a fix to #34114? If you don't want to then I'd be happy to cherry-pick your commit and open a pr with it in, as the fix looks good to me. |
…s by default Users running Bitcoin Core 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. The repeated warnings create unnecessary log noise. This change: - Adds explicit constants for NOT_AUTHORIZED result code (value 2) for both NAT-PMP and PCP protocols - Downgrades NOT_AUTHORIZED failures from LogWarning to LogDebug after the first failure since this is an expected condition on many networks, UNLESS the user has explicitly enabled -natpmp - Keeps LogWarning for other failure types that may indicate actual configuration or network issues The NOT_AUTHORIZED message will still be visible when running with -debug=net for users who need to troubleshoot port mapping issues. Fixes bitcoin#34114 Inspired-by: 78e7259 (bitcoin#34117) Inspired-by-author: ANAVHEOBA <wisdomabraham92@gmail.com>
Users running Bitcoin Core 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. The repeated warnings create unnecessary log noise.
This change:
The NOT_AUTHORIZED message will still be visible when running with -debug=net for users who need to troubleshoot port mapping issues.
Fixes #34114