CJDNS doesn’t resolve inbound/outbound to same addr, resulting in duplicated connections #26587

issue andrewtoth openend this issue on November 28, 2022
  1. andrewtoth commented at 0:37 am on November 28, 2022: contributor

    For two peers connecting to each other over CJDNS via addnode, it results in 2 connections. We would expect them to determine they are connecting to each other and not duplicate the connection. getpeerinfo gives the following: inbound connection - "addr": "[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:<port>]:<random_port>",, outbound connection - "addr": "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:<port>",

    Not sure if it would be possible to determine that the inbound connection is the same as our outbound, and don’t make an outbound if requested with that same cjdns address.

  2. andrewtoth added the label Bug on Nov 28, 2022
  3. willcl-ark commented at 8:11 am on November 28, 2022: contributor
  4. vasild commented at 10:16 am on November 28, 2022: contributor

    addnode overrides the is already connected to check. Here is the same with IPv4 - I ran two nodes, one listening on 5.5.5.5:5555 and another on 6.6.6.6:6666, then addnode each one to the other:

     0$ bitcoin-cli ... getpeerinfo |jq 'map({addr: .addr, addrlocal: .addrlocal, connection_type: .connection_type})'
     1[
     2  {
     3    "addr": "5.5.5.5:59064",
     4    "addrlocal": "5.5.5.5:5555",
     5    "connection_type": "inbound"
     6  },
     7  {
     8    "addr": "6.6.6.6:6666",
     9    "addrlocal": "6.6.6.6:45341",
    10    "connection_type": "manual"
    11  }
    12]
    13
    14$ bitcoin-cli ... getpeerinfo |jq 'map({addr: .addr, addrlocal: .addrlocal, connection_type: .connection_type})'
    15[
    16  {
    17    "addr": "5.5.5.5:5555",
    18    "addrlocal": "5.5.5.5:59064",
    19    "connection_type": "manual"
    20  },
    21  {
    22    "addr": "6.6.6.6:45341",
    23    "addrlocal": "6.6.6.6:6666",
    24    "connection_type": "inbound"
    25  }
    26]
    

    I think this is expected. However the following looks like a bug:

    inbound connection - "addr": "[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:<port>]:<random_port>"

    Are you sure that there is a port inside [] and that it is not just part of the address?

  5. jonatack commented at 9:52 pm on December 31, 2022: contributor

    inbound connection - "addr": "[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:<port>]:<random_port>"

    Are you sure that there is a port inside [] and that it is not just part of the address?

    Perhaps the OP had a typo. For CJDNS peer addresses, I see:

    • [xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:<port> for inbound
    • xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx for outbound

    (with xxxx sometimes being 3 chars instead of 4).

  6. andrewtoth commented at 3:26 pm on January 6, 2023: contributor

    Are you sure that there is a port inside [] and that it is not just part of the address?

    Ahh yes tried it again and it is indeed just part of the address. Not a typo but misread. If overriding the is already connected to check for manual connections is expected behavior then this is not an issue.

  7. andrewtoth closed this on Jan 6, 2023

  8. bitcoin locked this on Jan 6, 2024

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: 2024-06-29 10:13 UTC

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