aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jonas <jonas@chaincode.com>2020-12-15 20:37:32 -0500
committerAdam Jonas <jonas@chaincode.com>2020-12-16 09:24:03 -0500
commit010eed3ce03cf4fc622a48f40fc4d589383f7a44 (patch)
tree8b802bb8e058873210e2c447e1d7eee6a5cb0385
parentc434e2cca9181ce184efef946ab2ce62f2cd2ee7 (diff)
doc: warn that incoming conns are unlikely when not using default ports
-rw-r--r--src/init.cpp2
-rw-r--r--src/net.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 48711f9cd2..e077f3dbb8 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -450,7 +450,7 @@ void SetupServerArgs(NodeContext& node)
argsman.AddArg("-peerbloomfilters", strprintf("Support filtering of blocks and transaction with bloom filters (default: %u)", DEFAULT_PEERBLOOMFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
argsman.AddArg("-peerblockfilters", strprintf("Serve compact block filters to peers per BIP 157 (default: %u)", DEFAULT_PEERBLOCKFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
argsman.AddArg("-permitbaremultisig", strprintf("Relay non-P2SH multisig (default: %u)", DEFAULT_PERMIT_BAREMULTISIG), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
- argsman.AddArg("-port=<port>", strprintf("Listen for connections on <port> (default: %u, testnet: %u signet: %u, regtest: %u)", defaultChainParams->GetDefaultPort(), testnetChainParams->GetDefaultPort(), signetChainParams->GetDefaultPort(), regtestChainParams->GetDefaultPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
+ argsman.AddArg("-port=<port>", strprintf("Listen for connections on <port>. Nodes not using the default ports (default: %u, testnet: %u, signet: %u, regtest: %u) are unlikely to get incoming connections.", defaultChainParams->GetDefaultPort(), testnetChainParams->GetDefaultPort(), signetChainParams->GetDefaultPort(), regtestChainParams->GetDefaultPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
argsman.AddArg("-proxy=<ip:port>", "Connect through SOCKS5 proxy, set -noproxy to disable (default: disabled)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
argsman.AddArg("-proxyrandomize", strprintf("Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)", DEFAULT_PROXYRANDOMIZE), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
argsman.AddArg("-seednode=<ip>", "Connect to a node to retrieve peer addresses, and disconnect. This option can be specified multiple times to connect to multiple nodes.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
diff --git a/src/net.cpp b/src/net.cpp
index 66bf9b0315..7a04a215eb 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2081,7 +2081,11 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
continue;
}
- // do not allow non-default ports, unless after 50 invalid addresses selected already
+ // Do not allow non-default ports, unless after 50 invalid
+ // addresses selected already. This is to prevent malicious peers
+ // from advertising themselves as a service on another host and
+ // port, causing a DoS attack as nodes around the network attempt
+ // to connect to it fruitlessly.
if (addr.GetPort() != Params().GetDefaultPort() && nTries < 50)
continue;