aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Karels <karels@FreeBSD.org>2022-11-02 15:57:59 +0000
committerMike Karels <karels@FreeBSD.org>2022-12-03 15:16:46 +0000
commitf395174bbb2c6a0a7bba7b08364e8e5e289ef780 (patch)
tree3db06affe9209dec72d9f6659e58bc9c5808f827 /include
parenta467b5003320b53ff153c91f8dccdf40f29e6181 (diff)
downloadsrc-f395174bbb2c6a0a7bba7b08364e8e5e289ef780.tar.gz
src-f395174bbb2c6a0a7bba7b08364e8e5e289ef780.zip
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 (cherry picked from commit 144361386696582c04592f200a4c2e3339c81a25)
Diffstat (limited to 'include')
-rw-r--r--include/nsswitch.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/nsswitch.h b/include/nsswitch.h
index f7131292dd78..2be7a59fd1b9 100644
--- a/include/nsswitch.h
+++ b/include/nsswitch.h
@@ -53,6 +53,7 @@
#define NS_NOTFOUND (1<<2) /* source responded 'no such entry' */
#define NS_TRYAGAIN (1<<3) /* source busy, may respond to retry */
#define NS_RETURN (1<<4) /* stop search, e.g. for ERANGE */
+#define NS_ADDRFAMILY (1<<5) /* no addr for fam, getaddrinfo only */
#define NS_TERMINATE (NS_SUCCESS|NS_RETURN) /* flags that end search */
#define NS_STATUSMASK 0x000000ff /* bitmask to get the status flags */