aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
AgeCommit message (Collapse)Author
2016-09-28net: Consistent checksum handlingWladimir J. van der Laan
In principle, the checksums of P2P packets are simply 4-byte blobs which are the first four bytes of SHA256(SHA256(payload)). Currently they are handled as little-endian 32-bit integers half of the time, as blobs the other half, sometimes copying the one to the other, resulting in somewhat confused code. This PR changes the handling to be consistent both at packet creation and receiving, making it (I think) easier to understand.
2016-09-19Merge #8688: Move static global randomizer seeds into CConnmanWladimir J. van der Laan
d9ff591 Move static global randomizer seeds into CConnman (Pieter Wuille)
2016-09-19Merge #8707: net: fix maxuploadtarget settingWladimir J. van der Laan
f3552da net: fix maxuploadtarget setting (Cory Fields)
2016-09-19Move static global randomizer seeds into CConnmanPieter Wuille
2016-09-15net: No longer send local address in addrMeWladimir J. van der Laan
After #8594 the addrFrom sent by a node is not used anymore at all, so don't bother sending it. Also mitigates the privacy issue in (#8616). It doesn't completely solve the issue as GetLocalAddress is also called in AdvertiseLocal, but at least when advertising addresses it stands out less as *our* address.
2016-09-14net: fix maxuploadtarget settingCory Fields
This was broken by 63cafa6329e1a. Note that while this fixes the settings, it doesn't fix the actual usage of -maxuploadtarget completely, as there is currently a bug in the nOptimisticBytesWritten accounting that causes a delayed response if the target is reached. That bug will be addressed separately.
2016-09-14Merge #8715: net: only delete CConnman if it's been createdWladimir J. van der Laan
36fa01f net: only delete CConnman if it's been created (Cory Fields)
2016-09-13net: only delete CConnman if it's been createdCory Fields
In the case of (for example) an already-running bitcoind, the shutdown sequence begins before CConnman has been created, leading to a null-pointer dereference when g_connman->Stop() is called. Instead, Just let the CConnman dtor take care of stopping.
2016-09-13Remove maxuploadtargets recommended minimumJonas Schnelli
2016-09-08net: move MAX_FEELER_CONNECTIONS into connmanCory Fields
2016-09-08Convert ForEachNode* functions to take a templated function argument rather ↵Jeremy Rubin
than a std::function to eliminate std::function overhead
2016-09-08Made the ForEachNode* functions in src/net.cpp more pragmatic and self ↵Jeremy Rubin
documenting
2016-09-08net: move vNodesDisconnected into CConnmanCory Fields
2016-09-08net: add nSendBufferMaxSize/nReceiveFloodSize to CConnection::OptionsCory Fields
2016-09-08net: Introduce CConnection::Options to avoid passing so many paramsCory Fields
2016-09-08net: Drop StartNode/StopNode and use CConnman directlyCory Fields
2016-09-08net: pass CClientUIInterface into CConnmanCory Fields
2016-09-08net: Pass best block known height into CConnmanCory Fields
CConnman then passes the current best height into CNode at creation time. This way CConnman/CNode have no dependency on main for height, and the signals only move in one direction. This also helps to prevent identity leakage a tiny bit. Before this change, an attacker could theoretically make 2 connections on different interfaces. They would connect fully on one, and only establish the initial connection on the other. Once they receive a new block, they would relay it to your first connection, and immediately commence the version handshake on the second. Since the new block height is reflected immediately, they could attempt to learn whether the two connections were correlated. This is, of course, incredibly unlikely to work due to the small timings involved and receipt from other senders. But it doesn't hurt to lock-in nBestHeight at the time of connection, rather than letting the remote choose the time.
2016-09-08net: move max/max-outbound to CConnmanCory Fields
2016-09-08net: move semOutbound to CConnmanCory Fields
2016-09-08net: move nLocalServices/nRelevantServices to CConnmanCory Fields
These are in-turn passed to CNode at connection time. This allows us to offer different services to different peers (or test the effects of doing so).
2016-09-08net: move SendBufferSize/ReceiveFloodSize to CConnmanCory Fields
2016-09-08net: move send/recv statistics to CConnmanCory Fields
2016-09-08net: SocketSendData returns written sizeCory Fields
2016-09-08net: move messageHandlerCondition to CConnmanCory Fields
2016-09-08net: move nLocalHostNonce to CConnmanCory Fields
This behavior seems to have been quite racy and broken. Move nLocalHostNonce into CNode, and check received nonces against all non-fully-connected nodes. If there's a match, assume we've connected to ourself.
2016-09-08net: move nLastNodeId to CConnmanCory Fields
2016-09-08net: move whitelist functions into CConnmanCory Fields
2016-09-08net: create generic functor accessors and move vNodes to CConnmanCory Fields
2016-09-08net: Add most functions needed for vNodes to CConnmanCory Fields
2016-09-08net: move added node functions to CConnmanCory Fields
2016-09-08net: Add oneshot functions to CConnmanCory Fields
2016-09-08net: move ban and addrman functions into CConnmanCory Fields
2016-09-08net: handle nodesignals in CConnmanCory Fields
2016-09-08net: move OpenNetworkConnection into CConnmanCory Fields
2016-09-08net: Move socket binding into CConnmanCory Fields
2016-09-08net: Pass CConnman around as neededCory Fields
2016-09-08net: Create CConnman to encapsulate p2p connectionsCory Fields
2016-09-08net: move CBanDB and CAddrDB out of net.h/cppCory Fields
This will eventually solve a circular dependency
2016-09-02Merge #8466: [Trivial] Do not shadow variables in networking codeWladimir J. van der Laan
b7c349d Do not shadow variables in networking code (Pavel Janík)
2016-08-25Merge #8462: Move AdvertiseLocal debug output to net categoryPieter Wuille
f13c1ba Move AdvertiseLocal debug output to net category (Michael Rotarius)
2016-08-23Added feeler connections increasing good addrs in the tried table.Ethan Heilman
Tests if addresses are online or offline by briefly connecting to them. These short lived connections are referred to as feeler connections. Feeler connections are designed to increase the number of fresh online addresses in tried by selecting and connecting to addresses in new. One feeler connection is attempted on average once every two minutes. This change was suggested as Countermeasure 4 in Eclipse Attacks on Bitcoin’s Peer-to-Peer Network, Ethan Heilman, Alison Kendler, Aviv Zohar, Sharon Goldberg. ePrint Archive Report 2015/263. March 2015.
2016-08-17Merge #8505: Trivial: Fix typos in various filesWladimir J. van der Laan
1aacfc2 various typos (leijurv)
2016-08-15Do not shadow variables in networking codePavel Janík
2016-08-15Merge #8128: Net: Turn net structures into dumb storage classesWladimir J. van der Laan
9e9d644 net: fixup nits (Cory Fields) 8945384 net: Have LookupNumeric return a CService directly (Cory Fields) 21ba407 net: narrow include scope after moving to netaddress (Cory Fields) 21e5b96 net: move CNetAddr/CService/CSubNet out of netbase (Cory Fields) 1017b8a net: Add direct tests for new CSubNet constructors (Cory Fields) b6c3ff3 net: Split resolving out of CSubNet (Cory Fields) f96c7c4 net: Split resolving out of CService (Cory Fields) 31d6b1d net: Split resolving out of CNetAddr (Cory Fields)
2016-08-14various typosleijurv
2016-08-05Move AdvertiseLocal debug output to net categoryMichael Rotarius
2016-08-04net: Have LookupNumeric return a CService directlyCory Fields
Also fix up a few small issues: - Lookup with "badip:port" now sets the port to 0 - Don't allow assert to have side-effects
2016-08-04Merge #8392: Fix several node initialization issuesWladimir J. van der Laan
9d4eb9a Do diskspace check before import thread is started (Pieter Wuille) aa59f2e Add extra message to avoid a long 'Loading banlist' (Pieter Wuille) 0fd2a33 Use a signal to continue init after genesis activation (Pieter Wuille)
2016-08-03Merge #8189: rename mapAddrCount to mapNetGroupNodesWladimir J. van der Laan
657fc19 rename mapAddrCount to mapNetGroupNodes (instagibbs)