-
Notifications
You must be signed in to change notification settings - Fork 117
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
fix(network): Limit number of peer connections per IP address, Ignore new peer connections from the same IP and port #6980
Conversation
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.
I think this change needs some tests, what do you think?
Co-authored-by: teor <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6980 +/- ##
==========================================
+ Coverage 77.50% 77.52% +0.02%
==========================================
Files 310 310
Lines 41534 41582 +48
==========================================
+ Hits 32192 32238 +46
- Misses 9342 9344 +2 |
Configures the max to usize::MAX for some tests.
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.
Thanks for the tests!
Motivation
This PR drops additional peer connections from a given IP after there are already
MAX_CONNS_PER_IP
in the peer set.Closes #6936.
Solution
MAX_CONNS_PER_IP
PeerSet.ready_services
andPeerSet.cancel_handles
before inserting new connections into the peer setMAX_CONNS_PER_IP
Review
This is a routine security fix.
Reviewer Checklist
Follow Up Work