net: Quiet down logging when router doesn’t support natpmp/pcp #33311

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2025-10-pcp-logging changing 1 files +2 −2
  1. laanwj commented at 7:27 pm on September 4, 2025: member

    When the router doesn’t support natpmp and PCP, one’d normally expect the UDP packet to be ignored, and hit a time out. This logs a message that is already in the debug category. However, there’s also the case in which sending an UDP packet causes a ICMP response (type 3, code 3 “port unreachable”). This is returned to user space as “connection refused” (despite UDP having no concept of connections).

    Move the warnings from Send and Recv to debug level too, to reduce log spam in that case.

    Closes #33301.

  2. net: Quiet down logging when router doesn't support natpmp/pcp
    When the router doesn't support natpmp and PCP, one'd normally expect
    the UDP packet to be ignored, and hit a time out. This logs a warning
    that is already in the debug category. However, there's also the case in
    which sending an UDP packet causes a ICMP response. This is returned to
    user space as "connection refused" (despite UDP having no concept of
    connections).
    
    Move the warnings from `Send` and `Recv` to debug level too, to reduce
    log spam in that case.
    
    Closes #33301.
    4f1a4cbccd
  3. DrahtBot added the label P2P on Sep 4, 2025
  4. DrahtBot commented at 7:27 pm on September 4, 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/33311.

    Reviews

    See the guideline for information on the review process.

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  5. maflcko added this to the milestone 30.0 on Sep 4, 2025
  6. darosior approved
  7. darosior commented at 7:31 pm on September 4, 2025: member
    utACK 4f1a4cbccd784e25f7932f1d0293602ef7f3e814
  8. willcl-ark commented at 7:40 pm on September 4, 2025: member

    utACK 4f1a4cbccd784e25f7932f1d0293602ef7f3e814

    Makes sense to demote this message to Debug level.

  9. mzumsande commented at 8:33 pm on September 4, 2025: contributor
    utACK 4f1a4cbccd784e25f7932f1d0293602ef7f3e814
  10. sipa commented at 9:07 pm on September 4, 2025: member
    utACK 4f1a4cbccd784e25f7932f1d0293602ef7f3e814
  11. davidgumberg commented at 9:07 pm on September 4, 2025: contributor

    Tested ACK https://github.com/bitcoin/bitcoin/commit/4f1a4cbccd784e25f7932f1d0293602ef7f3e814

    Tested on a network where the default gateway does not support NatPMP with -natpmp=1: pcp: Could not receive response: Connection refused on this branch is not printed, on master it is.

    0$ mkdir -p /tmp/datadir && ./build/bin/bitcoind -datadir=/tmp/datadir -regtest -natpmp=1 | grep -i pcp 
    

    On master:

    02025-09-04T21:03:19Z [net:warning] pcp: Could not receive response: Connection refused (111)
    12025-09-04T21:03:19Z [net:warning] pcp: Could not receive response: Connection refused (111)
    

    On this branch there is no output.

  12. achow101 commented at 10:16 pm on September 4, 2025: member
    ACK 4f1a4cbccd784e25f7932f1d0293602ef7f3e814
  13. achow101 merged this on Sep 4, 2025
  14. achow101 closed this on Sep 4, 2025


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: 2025-09-07 06:12 UTC

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