-
Notifications
You must be signed in to change notification settings - Fork 38.7k
net: use stronger AddLocal() for our I2P address #21914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Contributor
Author
|
The first issue was reported by @sdaftuar in #20685 (comment), thanks! |
Member
|
Concept ACK, thanks for following up on this. |
Member
|
It makes sense to do the same for I2P as for Tor. Code review ACK 105941b |
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
May 13, 2021
105941b net: use stronger AddLocal() for our I2P address (Vasil Dimov) Pull request description: 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](https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/torcontrol.cpp#L354) for our `.onion` address and `AddLocal(LOCAL_BIND)` [for our](https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/net.cpp#L2247) `.b32.i2p` address, the latter being [ignored](https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/net.cpp#L232-L233) 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](https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/init.cpp#L1266) with `AddLocal(LOCAL_MANUAL)` which overrides `discover=0` and works as expected. However, if later the I2P proxy is shut down [we do](https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/net.cpp#L2234) `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](https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/net.cpp#L2247) `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. ACKs for top commit: laanwj: Code review ACK 105941b Tree-SHA512: 0c9daf6116b8d9c34ad7e6e9bbff6e8106e94e4394a815d7ae19287aea22a8c7c4e093c8dd8c58a4a1b1412b2575a9b42b8a93672c8d17f11c24508c534506c7
Fabcien
pushed a commit
to Bitcoin-ABC/bitcoin-abc
that referenced
this pull request
Feb 15, 2022
…ng connections from CConnman Summary: > net: add I2P to the reachability map > > Update `CNetAddr::GetReachabilityFrom()` to recognize the I2P network so > that we would prefer to advertise our I2P address to I2P peers. bitcoin/bitcoin@9559bd1 > net: make outgoing I2P connections from CConnman bitcoin/bitcoin@0635233 > net: accept incoming I2P connections from CConnman https://github.com/bitcoin/bitcoin/pull/20685/commits/b905363fa8b0bb03fe34b53b5410880f42e0af39i > net: use stronger AddLocal() for our I2P address bitcoin/bitcoin@105941b This is a backport of [[bitcoin/bitcoin#20685 | core#20685]] [16,17,18/20] and [[bitcoin/bitcoin#21914 | core#21914]] Depends on D11027 Test Plan: `ninja all check-all` Run `bitcoind` using I2P (see detailed test plan in D11027). `ninja && src/bitcoind -regtest -i2psam=127.0.0.1:7656 -debug=i2p` Now you can see new interesting log messages: ``` 2022-02-11T14:35:42Z i2paccept thread start 2022-02-11T14:35:42Z I2P: Creating SAM session with 127.0.0.1:7656 2022-02-11T14:35:45Z I2P: SAM session created: session id=xxxxxxxxxx, my address=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.b32.i2p:18444 2022-02-11T14:35:45Z AddLocal(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.b32.i2p:18444,2) ``` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D11029
gwillen
pushed a commit
to ElementsProject/elements
that referenced
this pull request
Jun 1, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are two issues:
1. Our I2P address not added to local addresses.
externalip=is used with an IPv4 address (this sets automaticallydiscover=0)discover=1is usedi2psam=is usedexternalip=is used for our I2P addresslistenonion=1 torcontrol=are usedIn this case
AddLocal(LOCAL_MANUAL)is used for our.onionaddress andAddLocal(LOCAL_BIND)for our.b32.i2paddress, the latter being ignored due todiscover=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 automaticallydiscover=0)discover=1is usedi2psam=is usedIn this case, initially
externalip=causes our I2P address to be added withAddLocal(LOCAL_MANUAL)which overridesdiscover=0and works as expected. However, if later the I2P proxy is shut down we doRemoveLocal()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 doAddLocal(LOCAL_BIND)which does nothing due todiscover=0.To resolve those two issues, use
AddLocal(LOCAL_MANUAL)for I2P which is also what we do with Tor.