net: use stronger AddLocal() for our I2P address #21914

pull vasild wants to merge 1 commits into bitcoin:master from vasild:i2p_local changing 1 files +1 −1
  1. vasild commented at 10:56 am on May 11, 2021: member

    There are two issues:

    1. Our I2P address not added to local addresses.

    • externalip= is used with an IPv4 address (this sets automatically discover=0)
    • No discover=1 is used
    • i2psam= is used
    • No externalip= is used for our I2P address
    • listenonion=1 torcontrol= are used

    In this case AddLocal(LOCAL_MANUAL) is used for our .onion address and AddLocal(LOCAL_BIND) for our .b32.i2p address, the latter being ignored due to discover=0.

    2. Our I2P address removed from local addresses even if specified with externalip= on I2P proxy restart.

    • externalip= is used with our I2P address (this sets automatically discover=0)
    • No discover=1 is used
    • i2psam= is used

    In this case, initially externalip= causes our I2P address to be added with AddLocal(LOCAL_MANUAL) which overrides discover=0 and works as expected. However, if later the I2P proxy is shut down we do RemoveLocal() in order to stop advertising our I2P address (since we have lost I2P connectivity). When the I2P proxy is started and we reconnect to it, restoring the I2P connectivity, we do AddLocal(LOCAL_BIND) which does nothing due to discover=0.

    To resolve those two issues, use AddLocal(LOCAL_MANUAL) for I2P which is also what we do with Tor.

  2. net: use stronger AddLocal() for our I2P address
    There are two issues:
    
    1. Our I2P address not added to local addresses.
    
    * `externalip=` is used with an IPv4 address (this sets automatically
      `discover=0`)
    * No `discover=1` is used
    * `i2psam=` is used
    * No `externalip=` is used for our I2P address
    * `listenonion=1 torcontrol=` are used
    
    In this case `AddLocal(LOCAL_MANUAL)` is used for our `.onion` address
    and `AddLocal(LOCAL_BIND)` for our `.b32.i2p` address, the latter being
    ignored due to `discover=0`.
    
    2. Our I2P address removed from local addresses even if specified
    with `externalip=` on I2P proxy restart.
    
    * `externalip=` is used with our I2P address (this sets automatically
      `discover=0`)
    * No `discover=1` is used
    * `i2psam=` is used
    
    In this case, initially `externalip=` causes our I2P address to be added
    with `AddLocal(LOCAL_MANUAL)` which overrides `discover=0` and works as
    expected. However, if later the I2P proxy is shut down we do
    `RemoveLocal()` in order to stop advertising our I2P address (since we
    have lost I2P connectivity). When the I2P proxy is started and we
    reconnect to it, restoring the I2P connectivity, we do
    `AddLocal(LOCAL_BIND)` which does nothing due to `discover=0`.
    
    To resolve those two issues, use `AddLocal(LOCAL_MANUAL)` for I2P which
    is also what we do with Tor.
    105941b726
  3. vasild commented at 10:57 am on May 11, 2021: member
    The first issue was reported by @sdaftuar in #20685 (review), thanks!
  4. DrahtBot added the label P2P on May 11, 2021
  5. jonatack commented at 11:17 am on May 11, 2021: member
    Concept ACK, thanks for following up on this.
  6. laanwj commented at 1:35 pm on May 13, 2021: member

    It makes sense to do the same for I2P as for Tor.

    Code review ACK 105941b726c078642e785ecb7b6834ba814381b0

  7. laanwj merged this on May 13, 2021
  8. laanwj closed this on May 13, 2021

  9. vasild deleted the branch on May 13, 2021
  10. sidhujag referenced this in commit bf77c70a58 on May 13, 2021
  11. Fabcien referenced this in commit 9f22e70a42 on Feb 15, 2022
  12. gwillen referenced this in commit 7275a1732e on Jun 1, 2022
  13. DrahtBot locked this on Aug 16, 2022

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-12-18 18:12 UTC

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