Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Search for ports sequentially instead of at random for more predictable port selection #9411

Merged
merged 3 commits into from
Apr 10, 2020

Conversation

mvines
Copy link
Contributor

@mvines mvines commented Apr 9, 2020

solana-validator currently randomly selects UDP/TCP ports within its port range at startup, which makes traffic analysis harder than it should be. Instead sequentially walk the port range for the first open port so allocations are deterministic (assuming no port conflicts).

Fixes #9399
cc: @leoluk

@mvines mvines added the v1.1 label Apr 9, 2020
@mvines mvines requested a review from sakridge April 9, 2020 20:39
@leoluk
Copy link
Contributor

leoluk commented Apr 9, 2020

Cool, cherry-picked on tds (on top of v1.1.2), works great and is stable between restarts:

 |Gossip| TPU  |TPUfwd| TVU  |TVUfwd|Repair|ServeR|Storag| RPC  |PubSub|ShredVer
-+------+------+------+------+------+------+------+------+------+------+--------
 | 8000 | 8003 | 8004 | 8001 | 8002 | 8006 | 8007 | none | none | none | 18216

@codecov
Copy link

codecov bot commented Apr 9, 2020

Codecov Report

Merging #9411 into master will decrease coverage by 0.0%.
The diff coverage is 100.0%.

@@           Coverage Diff            @@
##           master   #9411     +/-   ##
========================================
- Coverage    81.1%   81.1%   -0.1%     
========================================
  Files         277     277             
  Lines       62227   62209     -18     
========================================
- Hits        50512   50494     -18     
  Misses      11715   11715             

@mvines
Copy link
Contributor Author

mvines commented Apr 10, 2020

nice, this PR scared out some crappy tests 🛠️

Copy link
Contributor

@sakridge sakridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

solana-grimes pushed a commit that referenced this pull request Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deterministic port allocation
3 participants