Allow private addresses for testing#5334
Open
SirTyson wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in testing flag for peer discovery over RFC1918 networks.
Changes:
- Adds and parses a default-disabled testing option.
- Allows private addresses in outgoing and incoming peer gossip when enabled.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/overlay/PeerManager.cpp |
Gates private peer advertisements. |
src/overlay/Peer.cpp |
Gates acceptance of private peers. |
src/main/Config.h |
Declares the new option. |
src/main/Config.cpp |
Initializes and parses the option. |
Comment on lines
+2021
to
+2022
| if (address.isPrivate() && | ||
| !mAppConnector.getConfig().ALLOW_PRIVATE_ADDRESSES_FOR_TESTING) |
Comment on lines
+214
to
+217
| bool const allowPrivate = | ||
| mApp.getConfig().ALLOW_PRIVATE_ADDRESSES_FOR_TESTING; | ||
| auto keep = [&](PeerBareAddress const& pba) { | ||
| return !pba.isPrivate() && pba != address; | ||
| return (allowPrivate || !pba.isPrivate()) && pba != address; |
| // 192.168/16). Private addresses are normally filtered out of peer | ||
| // exchange, which disables gossip-based peer discovery in environments | ||
| // where every node has a private address (e.g. a Kubernetes pod network). | ||
| bool ALLOW_PRIVATE_ADDRESSES_FOR_TESTING; |
marta-lokhova
approved these changes
Jul 15, 2026
marta-lokhova
left a comment
Contributor
There was a problem hiding this comment.
LGTM overall, one small suggestion
| // 192.168/16). Private addresses are normally filtered out of peer | ||
| // exchange, which disables gossip-based peer discovery in environments | ||
| // where every node has a private address (e.g. a Kubernetes pod network). | ||
| bool ALLOW_PRIVATE_ADDRESSES_FOR_TESTING; |
Contributor
There was a problem hiding this comment.
should we put this behind BUILD_TESTS?
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in 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.
Description
Super cluster missions where we do not specify preferred peers only currently do not work. This is because each peer IP we see during discovery phase looks like a private IP and gets dropped. This flag can be set in SSC tests to skip the check.
Checklist
clang-formatv8.0.0 (viamake formator the Visual Studio extension)