Merge #20668: doc: warn that incoming conns are unlikely when not using default ports

010eed3ce0 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes #5150.

  This was mostly copied from #5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3ce0

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
This commit is contained in:
Wladimir J. van der Laan
2020-12-17 12:05:55 +01:00
2 changed files with 6 additions and 2 deletions

View File

@@ -2074,7 +2074,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;