good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 6ef4495a authored by Felix Lange's avatar Felix Lange Committed by GitHub
Browse files

p2p/discover: require table nodes to have an IP (#21330)

This fixes a corner case in discv5. The issue cannot happen in discv4
because it performs IP checks on all incoming node information.
parent 79addac6
No related branches found
No related tags found
Loading
...@@ -520,6 +520,9 @@ func (tab *Table) delete(node *node) { ...@@ -520,6 +520,9 @@ func (tab *Table) delete(node *node) {
} }
func (tab *Table) addIP(b *bucket, ip net.IP) bool { func (tab *Table) addIP(b *bucket, ip net.IP) bool {
if len(ip) == 0 {
return false // Nodes without IP cannot be added.
}
if netutil.IsLAN(ip) { if netutil.IsLAN(ip) {
return true return true
} }
......
...@@ -58,7 +58,7 @@ func testPingReplace(t *testing.T, newNodeIsResponding, lastInBucketIsResponding ...@@ -58,7 +58,7 @@ func testPingReplace(t *testing.T, newNodeIsResponding, lastInBucketIsResponding
// Fill up the sender's bucket. // Fill up the sender's bucket.
pingKey, _ := crypto.HexToECDSA("45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8") pingKey, _ := crypto.HexToECDSA("45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8")
pingSender := wrapNode(enode.NewV4(&pingKey.PublicKey, net.IP{}, 99, 99)) pingSender := wrapNode(enode.NewV4(&pingKey.PublicKey, net.IP{127, 0, 0, 1}, 99, 99))
last := fillBucket(tab, pingSender) last := fillBucket(tab, pingSender)
// Add the sender as if it just pinged us. Revalidate should replace the last node in // Add the sender as if it just pinged us. Revalidate should replace the last node in
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment