Skip to content

Allow private addresses for testing#5334

Open
SirTyson wants to merge 1 commit into
stellar:masterfrom
SirTyson:allow-private-addresses-for-testing
Open

Allow private addresses for testing#5334
SirTyson wants to merge 1 commit into
stellar:masterfrom
SirTyson:allow-private-addresses-for-testing

Conversation

@SirTyson

@SirTyson SirTyson commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

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

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

@SirTyson
SirTyson requested a review from marta-lokhova July 15, 2026 00:17
@SirTyson
SirTyson marked this pull request as ready for review July 15, 2026 00:17
Copilot AI review requested due to automatic review settings July 15, 2026 00:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 thread src/overlay/Peer.cpp
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;
Comment thread src/main/Config.h
// 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 marta-lokhova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM overall, one small suggestion

Comment thread src/main/Config.h
// 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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we put this behind BUILD_TESTS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants