aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
diff options
context:
space:
mode:
authorlaanwj <126646+laanwj@users.noreply.github.com>2022-03-02 09:32:56 +0100
committerlaanwj <126646+laanwj@users.noreply.github.com>2022-03-02 09:33:03 +0100
commitba11eb354b9f3420ebb8608227062fb639a07496 (patch)
tree5b5e09c589b7a6cd900d1786edbafa6429998f16 /src/netbase.cpp
parent848b11615b67a3c49f76ebbcaa241a322d8014d8 (diff)
parent36ee76d1afbb278500fc8aa01606ec933b52c17d (diff)
downloadbitcoin-ba11eb354b9f3420ebb8608227062fb639a07496.tar.xz
Merge bitcoin/bitcoin#23542: net: open p2p connections to nodes that listen on non-default ports
36ee76d1afbb278500fc8aa01606ec933b52c17d net: remove unused CNetAddr::GetHash() (Vasil Dimov) d0abce9a50dd4f507e3a30348eabffb7552471d5 net: include the port when deciding a relay destination (Vasil Dimov) 2e38a0e6865187d1f0d0f016d3df7cce414a7c4f net: add CServiceHash constructor so the caller can provide the salts (Vasil Dimov) 97208634b96f2d9a55f2ead7b0ef407da729d7bd net: open p2p connections to nodes that listen on non-default ports (Vasil Dimov) Pull request description: By default, for mainnet, the p2p listening port is 8333. Bitcoin Core has a strong preference for only connecting to nodes that listen on that port. Remove that preference because connections over clearnet that involve port 8333 make it easy to detect, analyze, block or divert Bitcoin p2p traffic before the connection is even established (at TCP SYN time). For further justification see the OP of: https://github.com/bitcoin/bitcoin/pull/23306 ACKs for top commit: laanwj: Concept and light code review ACK 36ee76d1afbb278500fc8aa01606ec933b52c17d prayank23: ACK https://github.com/bitcoin/bitcoin/pull/23542/commits/36ee76d1afbb278500fc8aa01606ec933b52c17d stickies-v: tACK 36ee76d1a jonatack: ACK 36ee76d1afbb278500fc8aa01606ec933b52c17d glozow: utACK 36ee76d1afbb278500fc8aa01606ec933b52c17d Tree-SHA512: 7f45ab7567c51c19fc50fabbaf84f0cc8883a8eef84272b76435c014c31d89144271d70dd387212cc1114213165d76b4d20a5ddb8dbc958fe7e74e6ddbd56d11
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r--src/netbase.cpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index a36ad7d179..9a0b800565 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -749,3 +749,93 @@ void InterruptSocks5(bool interrupt)
{
interruptSocks5Recv = interrupt;
}
+
+bool IsBadPort(uint16_t port)
+{
+ /* Don't forget to update doc/p2p-bad-ports.md if you change this list. */
+
+ switch (port) {
+ case 1: // tcpmux
+ case 7: // echo
+ case 9: // discard
+ case 11: // systat
+ case 13: // daytime
+ case 15: // netstat
+ case 17: // qotd
+ case 19: // chargen
+ case 20: // ftp data
+ case 21: // ftp access
+ case 22: // ssh
+ case 23: // telnet
+ case 25: // smtp
+ case 37: // time
+ case 42: // name
+ case 43: // nicname
+ case 53: // domain
+ case 69: // tftp
+ case 77: // priv-rjs
+ case 79: // finger
+ case 87: // ttylink
+ case 95: // supdup
+ case 101: // hostname
+ case 102: // iso-tsap
+ case 103: // gppitnp
+ case 104: // acr-nema
+ case 109: // pop2
+ case 110: // pop3
+ case 111: // sunrpc
+ case 113: // auth
+ case 115: // sftp
+ case 117: // uucp-path
+ case 119: // nntp
+ case 123: // NTP
+ case 135: // loc-srv /epmap
+ case 137: // netbios
+ case 139: // netbios
+ case 143: // imap2
+ case 161: // snmp
+ case 179: // BGP
+ case 389: // ldap
+ case 427: // SLP (Also used by Apple Filing Protocol)
+ case 465: // smtp+ssl
+ case 512: // print / exec
+ case 513: // login
+ case 514: // shell
+ case 515: // printer
+ case 526: // tempo
+ case 530: // courier
+ case 531: // chat
+ case 532: // netnews
+ case 540: // uucp
+ case 548: // AFP (Apple Filing Protocol)
+ case 554: // rtsp
+ case 556: // remotefs
+ case 563: // nntp+ssl
+ case 587: // smtp (rfc6409)
+ case 601: // syslog-conn (rfc3195)
+ case 636: // ldap+ssl
+ case 989: // ftps-data
+ case 990: // ftps
+ case 993: // ldap+ssl
+ case 995: // pop3+ssl
+ case 1719: // h323gatestat
+ case 1720: // h323hostcall
+ case 1723: // pptp
+ case 2049: // nfs
+ case 3659: // apple-sasl / PasswordServer
+ case 4045: // lockd
+ case 5060: // sip
+ case 5061: // sips
+ case 6000: // X11
+ case 6566: // sane-port
+ case 6665: // Alternate IRC
+ case 6666: // Alternate IRC
+ case 6667: // Standard IRC
+ case 6668: // Alternate IRC
+ case 6669: // Alternate IRC
+ case 6697: // IRC + TLS
+ case 10080: // Amanda
+ return true;
+ }
+ return false;
+}