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

pull ANAVHEOBA wants to merge 2 commits into bitcoin:master from ANAVHEOBA:master changing 2 files +27 −6
  1. ANAVHEOBA commented at 4:35 pm on December 19, 2025: none

    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 #34114

  2. net: reduce log level for PCP/NAT-PMP NOT_AUTHORIZED failures
    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 #34114
    78e7259081
  3. DrahtBot added the label P2P on Dec 19, 2025
  4. DrahtBot commented at 4:35 pm on December 19, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34117.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  5. net: fix CJDNS address discovery when -externalip is set
    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 #33471
    af5c2fcf14
  6. janb84 commented at 5:35 pm on December 19, 2025: contributor
    you have created a PR with 2 commits, one is unrelated to this PR it seems
  7. ANAVHEOBA commented at 6:05 pm on December 19, 2025: none
    Both commit were on the issues list
  8. janb84 commented at 9:06 am on December 22, 2025: contributor

    Both commit were on the issues list

    Not how this works, one PR one topic. Currently the PR description describes the commit for fixing #34114, I suggest that you keep that commit and create a new PR for the other commit, that has code for fixing #33471.

  9. bensig commented at 3:10 am on January 5, 2026: contributor

    This PR mixes two unrelated changes:

    1. Log level reduction for PCP/NAT-PMP NOT_AUTHORIZED (pcp.cpp) - fixes #34114
    2. CJDNS address discovery fix when -externalip is set (net.cpp) - fixes #33471

    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?

  10. maflcko commented at 10:13 am on January 5, 2026: member
    @ANAVHEOBA are you still working on this?
  11. ANAVHEOBA commented at 4:56 pm on January 5, 2026: none
    Yes, I push today
  12. ANAVHEOBA commented at 4:57 pm on January 5, 2026: none
    I am interested in working with bitcoin what is it going to take
  13. maflcko commented at 7:14 am on January 6, 2026: member
    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.
  14. maflcko closed this on Jan 6, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-07 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me