paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.com/
1.92k stars 707 forks source link

Ignore .local dns addresses from global DHT #545

Open jordy25519 opened 4 years ago

jordy25519 commented 4 years ago

Is it possible the Kademlia DHT can be filled with .local addresses from the likes of kubernetes clusters? or will they be removed automatically by failed connection attempts etc.?

https://github.com/paritytech/substrate/blob/f74de63d23214b530ac24ac3ea4ead1180e22e83/client/network/src/discovery.rs#L396-L397

bkchr commented 4 years ago

Cc @tomaka

tomaka commented 4 years ago

Multiaddresses in general are indeed removed from the k-buckets if we fail to connect to them.

Multiaddresses are added only at initialization, or if a node reports that it's listening on this address. Nodes never report that they're listening on a domain name, unless you pass this domain name with --public-addr.

In other words, the only way to somehow insert a domain name in the DHT is to pass it manually using --bootnodes, --reserved-nodes or --public-addr.