4.2 Synthetic Names
PSPU §6.7 lists the names a resolver answers before any network. resolvd checks them in a fixed order, on the name as asked and before any search expansion, and the first match answers the task.
4.2.1 The order #
localhost, or any name under it.127.0.0.1forA,::1forAAAA, both forANY. Sourcesynthetic.- A static name. An exact, case-insensitive match against the
Hosts\values (§2.3). The name's addresses of the asked family — IPv4 forA, IPv6 forAAAA, both forANY. Sourcehosts. - The machine's hostname. An exact, case-insensitive match against
the hostname (§3.3), answered with the machine's own addresses
(below). Source
synthetic. .local. The namelocalor any name under it isnotfound, whatever the type asked. Sourcesynthetic. No query is sent.- A reverse-mapping name, for
PTRorANYonly. See below.
A name that matches none of these goes on to search expansion and the network.
4.2.1.1 Static names beat the hostname and .local #
Because the order is fixed, a static name beats the hostname and
.local: a Hosts\ value named printer.local is answered with its
addresses, and one named after the machine overrides the machine's own
addresses.
4.2.1.2 localhost beats a static name #
localhost is checked first, so a Hosts\ value named localhost, or
a name under it such as printer.localhost, never answers a forward
question: the synthetic loopback answer is given instead. Its addresses
still answer reverse questions through the static-name row below,
except loopback addresses, which the loopback row takes first.
4.2.1.3 Record types #
For the three address-bearing kinds, the answer is found whatever type
was asked; a type other than A, AAAA or ANY, or a family the name
has no address in, gives found with no records. localhost asked for
MX is an empty found, not a notfound, and is not forwarded.
4.2.1.4 The machine's own addresses #
- They are every address of every scope at
addressedor better, whether or not the scope has servers, in snapshot order, link-local addresses included and loopback addresses excluded. - Repeated addresses are removed only when they are adjacent in that list, so an address on two interfaces that are not consecutive in the snapshot appears twice.
- When there are none, the hostname is answered with
127.0.0.1and::1.
4.2.2 Reverse names #
4.2.2.1 Reverse-mapping names #
A reverse-mapping name is one under in-addr.arpa with exactly four
labels before the suffix, or one under ip6.arpa with exactly 32. The
suffix is matched case-insensitively.
- Each
in-addr.arpalabel parses as a decimal number from 0 to 255. Leading zeros and a leading+are accepted, so1.0.0.0127.in-addr.arpaand+1.0.0.127.in-addr.arpaboth name127.0.0.1. - Each
ip6.arpalabel is a single hexadecimal digit, in either case.
A name of either shape whose labels do not parse is not a reverse-mapping name.
4.2.2.2 Synthetic reverse answers #
Asked for PTR or ANY, a reverse-mapping name is answered
synthetically when its address is:
The rows are tried in that order.
4.2.2.3 An address shared by static names #
When several static names list the same address, resolvd returns one PTR:
the name whose ASCII-lowercased presentation form sorts first in byte order.
For example, alpha.home wins over beta.home. The answer is independent
of registry insertion order, hash-table order, reloads and restarts while
the set of matching names stays the same. It changes when that set changes
and another name sorts first. The selected name retains its configured
spelling in the reply. This rule applies to IPv4 and IPv6, for both PTR
and ANY questions.
4.2.2.4 Other reverse questions #
A reverse name asked for any other type, and a reverse name whose address matches none of the rows, goes to the network.
4.2.3 Properties of every synthetic answer #
- Every synthetic record has TTL 0.
- Synthetic answers are never cached, and the
no_cacheflag has no effect on them. - Each one adds one to the
syntheticcounter (§4.10).
4.2.4 Expanded candidates are not checked #
Only the name as asked is checked. An expanded candidate is never
compared with the synthetic names, so with a static name printer.lan
and the search domain lan, a question for printer is expanded and
sent to the network as printer.lan.