mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 14:35:52 +00:00
Allow multiple incoming connections from the same IP:
Multiple servers behind NAT might share a single public IP, making it difficult for them to connect to the Ripple network since multiple incoming connections from the same non-private IP are currently not allowed. RippleD now automatically allows between 2 and 5 incoming connections, from the same public IP based on the total number of peers that it is configured to accept. Administrators can manually change the limit by adding an "ip_limit" key value pair in the [overlay] stanza of the configuration file and specifying a positive non-zero number. For example: [overlay] ip_limit=3 The previous "one connection per IP" strategy can be emulated by setting "ip_limit" to 1. The implementation imposes both soft and hard upper limits and will adjust the value so that a single IP cannot consume all inbound slots.
This commit is contained in:
@@ -506,6 +506,7 @@ OverlayImpl::onPrepare()
|
||||
!app_.config().PEER_PRIVATE;
|
||||
config.listeningPort = port;
|
||||
config.features = "";
|
||||
config.ipLimit = setup_.ipLimit;
|
||||
|
||||
// Enforce business rules
|
||||
config.applyTuning();
|
||||
@@ -1056,6 +1057,10 @@ setup_Overlay (BasicConfig const& config)
|
||||
setup.context = make_SSLContext();
|
||||
setup.expire = get<bool>(section, "expire", false);
|
||||
|
||||
set (setup.ipLimit, "ip_limit", section);
|
||||
if (setup.ipLimit < 0)
|
||||
throw std::runtime_error ("Configured IP limit is invalid");
|
||||
|
||||
std::string ip;
|
||||
set (ip, "public_ip", section);
|
||||
if (! ip.empty ())
|
||||
|
||||
Reference in New Issue
Block a user