-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
p2p: do not advertise private and non-routable addresses #6092
Merged
algorandskiy
merged 8 commits into
algorand:master
from
algorandskiy:pavel/p2p-filter-local-addr
Aug 7, 2024
Merged
p2p: do not advertise private and non-routable addresses #6092
algorandskiy
merged 8 commits into
algorand:master
from
algorandskiy:pavel/p2p-filter-local-addr
Aug 7, 2024
Conversation
This file contains 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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6092 +/- ##
==========================================
- Coverage 56.26% 56.23% -0.03%
==========================================
Files 489 489
Lines 69637 69691 +54
==========================================
+ Hits 39182 39192 +10
- Misses 27796 27831 +35
- Partials 2659 2668 +9 ☔ View full report in Codecov by Sentry. |
gmalouf
reviewed
Aug 2, 2024
gmalouf
previously approved these changes
Aug 5, 2024
jasonpaulos
previously approved these changes
Aug 6, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good just some nits
algorandskiy
commented
Aug 6, 2024
jasonpaulos
approved these changes
Aug 6, 2024
gmalouf
approved these changes
Aug 7, 2024
cce
approved these changes
Aug 7, 2024
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
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.
Summary
When p2p net listens on all interfaces ("0.0.0.0:0", ":0", ":N"), it advertises everything including loopback and private interface addresses. The solution is to handle this specification and apply libp2p's AddressFactory filter.
Note, when some specific address is set like loopback or a private interface, it recognized as intentional action and no filters applied. This allows to all unit tests starting network on "127.0.0.1:0" to continue to operate, as well allows private nets to run if
NetAddress
is set appropriate (say to "10.1.0.101:0").During algonet testing I found EC2 instances only have loopback and a private 172.31.x.x addresses so that filtered.
libp2p has address observation facility (part of netidentity) that reports addresses seen at least 4 times (
activated()
piece) in last 30 minutes (TTL piece).This means we need at least 4 p2p bootstrap nodes to allow other nodes to advertise their observed addresses over DHT.
Test Plan
addressFilter' function and for
MakeHostwith different
NetAddress` specifications.with 4 of 8 relays being p2p bootstrap nodes (via DNS TXT) and with all nodes
"EnableDHTProviders": true
. I was able to add an extra node with"GossipFanout": 8
to this network and have it connected to all 8 relays despite the fact only 8 are registered in DNS.