aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
AgeCommit message (Collapse)Author
2016-10-31net: Use deterministic randomness for CNode's nonce, and make it constCory Fields
2016-10-31net: constify a few CNode vars to indicate that they're threadsafeCory Fields
2016-10-18Merge #8914: Kill insecure_random and associated global stateWladimir J. van der Laan
5eaaa83 Kill insecure_random and associated global state (Wladimir J. van der Laan)
2016-10-17Kill insecure_random and associated global stateWladimir J. van der Laan
There are only a few uses of `insecure_random` outside the tests. This PR replaces uses of insecure_random (and its accompanying global state) in the core code with an FastRandomContext that is automatically seeded on creation. This is meant to be used for inner loops. The FastRandomContext can be in the outer scope, or the class itself, then rand32() is used inside the loop. Useful e.g. for pushing addresses in CNode or the fee rounding, or randomization for coin selection. As a context is created per purpose, thus it gets rid of cross-thread unprotected shared usage of a single set of globals, this should also get rid of the potential race conditions. - I'd say TxMempool::check is not called enough to warrant using a special fast random context, this is switched to GetRand() (open for discussion...) - The use of `insecure_rand` in ConnectThroughProxy has been replaced by an atomic integer counter. The only goal here is to have a different credentials pair for each connection to go on a different Tor circuit, it does not need to be random nor unpredictable. - To avoid having a FastRandomContext on every CNode, the context is passed into PushAddress as appropriate. There remains an insecure_random for test usage in `test_random.h`.
2016-10-15Display minimum ping in debug window.R E Broadley
2016-10-04gui: fix ban from qt consoleCory Fields
Rather than doing a circle and re-resolving the node's IP, just use the one from nodestats directly. This requires syncing the addr field from CNode.
2016-09-22Comment on CConnman::nLocalServices meaninginstagibbs
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-19Move static global randomizer seeds into CConnmanPieter Wuille
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-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-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-15Do not shadow variables in networking codePavel Janík
2016-07-31net: narrow include scope after moving to netaddressCory Fields
Net functionality is no longer needed for CAddress/CAddrman/etc. now that CNetAddr/CService/CSubNet are dumb storage classes.
2016-06-22BIP141: Other consensus critical limits, and BIP145Pieter Wuille
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
2016-06-22BIP144: Handshake and relay (receiver side)Pieter Wuille
Service bit logic by Nicolas Dorier. Only download blocks from witness peers after fork.
2016-06-22BIP144: Serialization, hashes, relay (sender side)Pieter Wuille
Contains refactorings by Eric Lombrozo. Contains fixup by Nicolas Dorier. Contains cleanup of CInv::GetCommand by Alex Morcos
2016-06-19Add ability to fetch CNode by NodeIdMatt Corallo
2016-06-16Merge #8113: Rework addnode behaviourWladimir J. van der Laan
1a5a4e6 Randomize name lookup result in ConnectSocketByName (Pieter Wuille) f9f5cfc Prevent duplicate connections where one is by name and another by ip (Pieter Wuille) 1111b80 Rework addnode behaviour (Pieter Wuille)
2016-06-16Merge #8084: Add recently accepted blocks and txn to AttemptToEvictConnection.Wladimir J. van der Laan
6ee7f05 Allow disconnecting a netgroup with only one member in eviction. (Gregory Maxwell) 5d0ca81 Add recently accepted blocks and txn to AttemptToEvictConnection. (Gregory Maxwell)