-
Notifications
You must be signed in to change notification settings - Fork 476
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
p2p: do not advertise private and non-routable addresses #6092
p2p: do not advertise private and non-routable addresses #6092
Conversation
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. |
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
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.