Page MenuHomePhabricator

net: avoid extra dns query per seed
ClosedPublic

Authored by deadalnix on Sep 10 2018, 23:00.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

schancel added a subscriber: schancel.
schancel added inline comments.
src/chainparams.cpp
166 ↗(On Diff #4868)

Can we please get rid of this one? It requires NS delegation which cloudlfare does not support. We can register a completely different domain.

This revision is now accepted and ready to land.Sep 11 2018, 18:21
This revision was automatically updated to reflect the committed changes.