gai_strerror.[c3]: re-enable EAI_ADDRFAMILY, EAI_NODATA

gai_strerror.c still has messages for EAI_ADDRFAMILY and EAI_NODATA,
but not the man page.  Re-add to the man page, and update comments
in the source.  Document the errors that are not in RFC 3493 or
POSIX.

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

Reviewed by:    bz, pauamma
MFC after:      1 month
This commit is contained in:
Mike Karels 2022-11-02 10:55:32 -05:00
parent 40e4e12bd8
commit e34adc71d3
2 changed files with 20 additions and 7 deletions

View File

@ -18,7 +18,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd December 23, 2018
.Dd November 2, 2022
.Dt GAI_STRERROR 3
.Os
.Sh NAME
@ -42,7 +42,9 @@ or
The following error codes and their meaning are defined in
.In netdb.h :
.Pp
.Bl -tag -width ".Dv EAI_BADFLAGS" -offset indent -compact
.Bl -tag -width ".Dv EAI_ADDRFAMILY" -offset indent -compact
.It Dv EAI_ADDRFAMILY
Address family for hostname not supported
.It Dv EAI_AGAIN
Name could not be resolved at this time
.It Dv EAI_BADFLAGS
@ -56,6 +58,8 @@ Non-recoverable failure in name resolution
Address family was not recognized
.It Dv EAI_MEMORY
Memory allocation failure
.It Dv EAI_NODATA
No address associated with hostname
.It Dv EAI_NONAME
Name does not resolve
.It Dv EAI_OVERFLOW
@ -83,7 +87,14 @@ is out of range, an implementation-specific error message string is returned.
.Xr getaddrinfo 3 ,
.Xr getnameinfo 3
.Sh STANDARDS
.Bl -tag -width ".It RFC 2743"
.Bl -tag -width ".It RFC 3493"
.It RFC 3493
Basic Socket Interface Extensions for IPv6
.El
.Pp
EAI_ADDRFAMILY and EAI_NODATA were in previous RFCs, but not in RFC 3493.
They are not in POSIX (IEEE Std 1003.1-2017).
They were in
.Fx
before 5.2, and were re-added for 14.0.
EAI_BADHINTS, EAI_OVERFLOW, and EAI_PROTOCOL are not in RFC 3493 or POSIX.

View File

@ -44,17 +44,19 @@ __FBSDID("$FreeBSD$");
#endif
#include "un-namespace.h"
/* Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) are obsoleted, but left */
/* for backwards compatibility with userland code prior to RFC2553bis-02 */
/*
* Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) were omitted from RFC 3493,
* but are or may be used as extensions or in old code.
*/
static const char *ai_errlist[] = {
"Success", /* 0 */
"Address family for hostname not supported", /* 1: Obsolete */
"Address family for hostname not supported", /* EAI_ADDRFAMILY */
"Name could not be resolved at this time", /* EAI_AGAIN */
"Flags parameter had an invalid value", /* EAI_BADFLAGS */
"Non-recoverable failure in name resolution", /* EAI_FAIL */
"Address family not recognized", /* EAI_FAMILY */
"Memory allocation failure", /* EAI_MEMORY */
"No address associated with hostname", /* 7: Obsolete*/
"No address associated with hostname", /* EAI_NODATA*/
"Name does not resolve", /* EAI_NONAME */
"Service was not recognized for socket type", /* EAI_SERVICE */
"Intended socket type was not recognized", /* EAI_SOCKTYPE */