7.1 The Module
The shim's obligations are PSPU §6.10. This chapter describes the module resolvd's source tree builds.
7.1.1 The object #
libnss_peios_net.so.2is installed bydev.peios.resolvd-nssat/usr/lib/x86_64-linux-peios/libnss_peios_net.so.2.- It is built from the
nsscrate, with the native channel codec compiled in. Its only shared-object dependencies arelibc.so.6and the dynamic loader,ld-linux-x86-64.so.2. The GCC unwinder required by Rust is linked statically, with its symbols private to the module; name lookups do not loadlibgcc_s.so.1. The identity shim,libnss_peios.so.2, uses the same static-unwinder arrangement. Neither shim links libpeios.
7.1.1.1 The entry points #
The module exports six entry points:
| Entry point | Asks |
|---|---|
_nss_peios_net_gethostbyname4_r | lookup, family any |
_nss_peios_net_gethostbyname3_r | lookup, family from af |
_nss_peios_net_gethostbyname2_r | as gethostbyname3_r, with no TTL or canonical name out |
_nss_peios_net_gethostbyname_r | as gethostbyname3_r, with af AF_INET |
_nss_peios_net_gethostbyaddr2_r | reverse |
_nss_peios_net_gethostbyaddr_r | as gethostbyaddr2_r, with no TTL out |
7.1.2 One connection per call #
- Every call that needs resolvd opens a new connection to
/run/resolvd/resolv.sock, sends one request, reads one reply, and closes the connection. - Nothing is kept between calls: no connection, no cache, no configuration. The module reads no file.
7.1.2.1 The ten-second socket timeouts #
Each connection is given ten-second read and write timeouts, which
apply to each read and write on the socket. Ten seconds is longer than
the six seconds a question's three timed-out attempts take in resolvd,
TCP retries included (§4.6), so a slow upstream normally reaches the
caller as unavailable from resolvd rather than as a timeout here. A
question can still reach the timeout when many search candidates each
answer NXDOMAIN slowly, since those answers do not spend the attempt
budget; that is reported as the table below shows.
7.1.3 Results #
The missing-family row above describes
source b4f7085:
a found name with no address of the family asked is reported exactly as
a name that does not exist. This does not meet PSPU §6.10's requirement
that found without an address of that family return NO_DATA.
The proposed source correction preserves
NOTFOUND and ENOENT, but sets h_errno to NO_DATA when a found
reply has no usable address of the requested family. A found reverse
reply with no PTR record has the same result. Explicit notfound
still returns HOST_NOT_FOUND; unavailable and transport failures keep
their distinct results in the table. This describes proposed source
behavior, not a released package or an installed module. Check the
installed module's source revision before relying on this distinction.
7.1.3.1 AF_UNSPEC #
AF_UNSPEC is accepted only by gethostbyname4_r, which always asks
for both families.
7.1.4 The caller's buffer #
Every string, pointer array and address the module returns is placed in the buffer glibc passes in; the module allocates nothing that outlives the call. When the buffer cannot hold the result, the call returns as in the table, and nothing written to the buffer is valid.