HomePhabricator

net: avoid extra dns query per seed

Description

net: avoid extra dns query per seed

Summary:

  • net: add an internal subnet for representing unresolved hostnames

We currently do two resolves for dns seeds: one for the results, and one to
serve in addrman as the source for those addresses.

There's no requirement that the source hostname resolves to the stored
identifier, only that the mapping is unique. So rather than incurring the
second lookup, combine a private subnet with a hash of the hostname.

The resulting v6 ip is guaranteed not to be publicy routable, and has only a
negligible chance of colliding with a user's internal network (which would be
of no consequence anyway).

  • net: switch to dummy internal ip for dns seed source

This addresss the TODO to avoid resolving twice.

  • net: do not allow resolving to an internal address

In order to prevent mixups, our internal range is never allowed as a resolve
result. This means that no user-provided string will ever be confused with an
internal address.

  • net: use an internal address for fixed seeds
  • chainparams: make supported service bits option explicit

This is a backport of Core PR10446

Test Plan: make check

Reviewers: #bitcoin_abc, schancel

Reviewed By: #bitcoin_abc, schancel

Subscribers: schancel, teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1759

Details

Provenance
Cory Fields <cory-nospam-@coryfields.com>Authored on May 24 2017, 00:04
deadalnixCommitted on Sep 11 2018, 23:57
deadalnixPushed on Sep 11 2018, 23:57
Reviewer
Restricted Project
Differential Revision
D1759: net: avoid extra dns query per seed
Parents
rABC4dc3053b730e: Nits in httprpc.h
Branches
Unknown
Tags
Unknown

Event Timeline