This patch adds PF_LOCAL support to getaddrinfo(3) and getnameinfo(3).
A UNIX-domain address must begin with '/', and PF_UNSPEC matches
PF_LOCAL in ai_family of getaddrinfo(3) only when the address begins with '/'.
This means PF_LOCAL is mutually exclusive with PF_INET or PF_INET6 and there should be no
bad side-effect in the existing programs which use the INET families. The patch includes the following changes:
getaddrinfo(3):
- A hostname which does not begin with '/' returns EAI_NONAME.
- Use symbolic name for WILD_* bit mask.
getnameinfo(3):
- Remove struct sockinet. struct sockaddr_in should work.
- Refactor struct afd for consistent sanity check and to eliminate switch() and #ifdef PF_* in getnameinfo().
Note that an implementation in UNIX network programming by W.R.Stevens uses servname for sun_path and constant hostname "/local" or "/unix" for PF_LOCAL. Although this looks reasonable, servname has a limitation of NI_MAXSERV which is 32-byte long. For this reason, this patchset uses hostname for a UNIX-domain address and no servname.