HomeFreeBSD

getaddrinfo: distinguish missing addrs from unresolvable names

Description

getaddrinfo: distinguish missing addrs from unresolvable names

Rework getaddrinfo(3) to return different error values for unresolvable
names (same as before, EAI_NONAME) and those without a requested addr
(EAI_ADDRFAMILY) when using DNS. This is implemented via an added
error in the nsswitch layer, NS_ADDRFAMILY, which is used only by
getaddrinfo(). The error is passed through nsdispatch(3), but that
routine has no changes to handle this error. The error originates in
the getaddrinfo DNS layer called via nsdispatch(), and is processed
by the search layer that calls nsdispatch().

While here, add a little style to returns near those that were
modified.

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by: bz
MFC after: 1 month

Details

Provenance
karelsAuthored on Nov 2 2022, 3:57 PM
Parents
rGe34adc71d372: gai_strerror.[c3]: re-enable EAI_ADDRFAMILY, EAI_NODATA
Branches
Unknown
Tags
Unknown