aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discover/table_test.go
Commit message (Collapse)AuthorAgeFilesLines
* p2p/discover, p2p/discv5: prevent relay of invalid IPs and low portsFelix Lange2016-11-231-0/+1
| | | | | | | | | | | | | | | | | | | | | The discovery DHT contains a number of hosts with LAN and loopback IPs. These get relayed because some implementations do not perform any checks on the IP. go-ethereum already prevented relay in most cases because it verifies that the host actually exists before adding it to the local table. But this verification causes other issues. We have received several reports where people's VPSs got shut down by hosting providers because sending packets to random LAN hosts is indistinguishable from a slow port scan. The new check prevents sending random packets to LAN by discarding LAN IPs sent by Internet hosts (and loopback IPs from LAN and Internet hosts). The new check also blacklists almost all currently registered special-purpose networks assigned by IANA to avoid inciting random responses from services in the LAN. As another precaution against abuse of the DHT, ports below 1024 are now considered invalid.
* all: Rename crypto.Sha3{,Hash}() to crypto.Keccak256{,Hash}()Ricardo Catalinas Jiménez2016-02-221-2/+2
| | | | As we aren't really using the standarized SHA-3
* p2p/discover: support incomplete node URLs, add ResolveFelix Lange2015-12-181-3/+3
|
* node: customizable protocol and service stacksPéter Szilágyi2015-11-271-4/+4
|
* p2p/discover: fix race involving the seed node iteratorFelix Lange2015-09-301-3/+0
| | | | | | | | | | | | | | | | | | | nodeDB.querySeeds was not safe for concurrent use but could be called concurrenty on multiple goroutines in the following case: - the table was empty - a timed refresh started - a lookup was started and initiated refresh These conditions are unlikely to coincide during normal use, but are much more likely to occur all at once when the user's machine just woke from sleep. The root cause of the issue is that querySeeds reused the same leveldb iterator until it was exhausted. This commit moves the refresh scheduling logic into its own goroutine (so only one refresh is ever active) and changes querySeeds to not use a persistent iterator. The seed node selection is now more random and ignores nodes that have not been contacted in the last 5 days.
* p2p/discover: unlock the table during ping replacementFelix Lange2015-08-111-3/+3
| | | | | | Table.mutex was being held while waiting for a reply packet, which effectively made many parts of the whole stack block on that packet, including the net_peerCount RPC call.
* p2p/discover: close Table during testingFelix Lange2015-08-061-3/+5
| | | | Not closing the table used to be fine, but now the table has a database.
* all: fix license headers one more timeFelix Lange2015-07-241-1/+1
| | | | I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
* all: update license headers to distiguish GPL/LGPLFelix Lange2015-07-231-4/+4
| | | | | All code outside of cmd/ is licensed as LGPL. The headers now reflect this by calling the whole work "the go-ethereum library".
* all: update license informationFelix Lange2015-07-071-0/+16
|
* p2p/discover: use separate rand.Source instances in testsFelix Lange2015-06-101-4/+5
| | | | rand.Source isn't safe for concurrent use.
* p2p/discover: add ReadRandomNodesFelix Lange2015-05-251-1/+34
|
* p2p/discover: new distance metric based on sha3(id)Felix Lange2015-05-061-55/+297
| | | | | | | The previous metric was pubkey1^pubkey2, as specified in the Kademlia paper. We missed that EC public keys are not uniformly distributed. Using the hash of the public keys addresses that. It also makes it a bit harder to generate node IDs that are close to a particular node.
* p2p/discover: track sha3(ID) in NodeFelix Lange2015-04-301-1/+1
|
* p2p/discover: new endpoint formatFelix Lange2015-04-301-2/+2
| | | | | | This commit changes the discovery protocol to use the new "v4" endpoint format, which allows for separate UDP and TCP ports and makes it possible to discover the UDP address after NAT.
* cmd/bootnode, eth, p2p, p2p/discover: use a fancier db designPéter Szilágyi2015-04-241-3/+3
|
* cmd/bootnode, eth, p2p, p2p/discover: clean up the seeder and mesh into eth.Péter Szilágyi2015-04-241-3/+3
|
* p2p/discovery: fix broken tests due to API updatePéter Szilágyi2015-04-241-3/+3
|
* p2p/discover: fix off by one error causing buckets to contain duplicatesFelix Lange2015-04-011-0/+42
|
* p2p/discover: implement node bondingFelix Lange2015-04-011-100/+70
| | | | | | | | | | | | | | | | This a fix for an attack vector where the discovery protocol could be used to amplify traffic in a DDOS attack. A malicious actor would send a findnode request with the IP address and UDP port of the target as the source address. The recipient of the findnode packet would then send a neighbors packet (which is 16x the size of findnode) to the victim. Our solution is to require a 'bond' with the sender of findnode. If no bond exists, the findnode packet is not processed. A bond between nodes α and β is created when α replies to a ping from β. This (initial) version of the bonding implementation might still be vulnerable against replay attacks during the expiration time window. We will add stricter source address validation later.
* p2p/discover: deflake UDP testsFelix Lange2015-02-091-0/+12
|
* p2p/discover: add node URL functions, distinguish TCP/UDP portsFelix Lange2015-02-071-110/+6
| | | | | The discovery RPC protocol does not yet distinguish TCP and UDP ports. But it can't hurt to do so in our internal model.
* p2p/discover: add some helper functionsFelix Lange2015-02-061-3/+3
|
* p2p/discover: new package implementing the Node Discovery ProtocolFelix Lange2015-02-061-0/+403