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:
Nik Bougalis
2015-10-21 19:31:21 -07:00
parent f00c09d9fc
commit 0c67364e6c
8 changed files with 45 additions and 5 deletions

View File

@@ -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 ())