]> git.bitcoin.ninja Git - dnsseed-rust/commitdiff
Never allow non-resolving-to-ASN IPs
authorMatt Corallo <git@bluematt.me>
Fri, 23 Aug 2019 04:39:27 +0000 (00:39 -0400)
committerMatt Corallo <git@bluematt.me>
Fri, 23 Aug 2019 04:39:27 +0000 (00:39 -0400)
src/datastore.rs

index c8ef0e0aed812f52599ac6d1ca47dcde0692e48b..c00bc0165a71d98ef8ed80d17a0d88a5e970d4a5 100644 (file)
@@ -499,10 +499,12 @@ impl Store {
                                                }
                                        }
                                        let mut asn_set = HashSet::with_capacity(cmp::max(v4_set.len(), v6_set.len()));
+                                       asn_set.insert(0);
                                        for a in v4_set.iter().filter(|a| asn_set.insert(bgp_client.get_asn(**a))).choose_multiple(&mut rng, 21) {
                                                dns_buff += &format!("x{:x}.dnsseed\tIN\tA\t{}\n", i, a);
                                        }
                                        asn_set.clear();
+                                       asn_set.insert(0);
                                        for a in v6_set.iter().filter(|a| asn_set.insert(bgp_client.get_asn(**a))).choose_multiple(&mut rng, 12) {
                                                dns_buff += &format!("x{:x}.dnsseed\tIN\tAAAA\t{}\n", i, a);
                                        }