Page MenuHomeFreeBSD

Add PF_LOCAL support to getaddrinfo(3) and getnameinfo(3)
ClosedPublic

Authored by hrs on Sep 11 2015, 2:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 28 2024, 10:49 AM
Unknown Object (File)
Feb 28 2024, 9:03 AM
Unknown Object (File)
Dec 20 2023, 3:06 AM
Unknown Object (File)
Nov 19 2023, 8:27 PM
Unknown Object (File)
Nov 10 2023, 9:28 PM
Unknown Object (File)
Nov 9 2023, 1:35 PM
Unknown Object (File)
Nov 8 2023, 3:38 AM
Unknown Object (File)
Nov 1 2023, 5:13 PM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

hrs retitled this revision from to Add PF_LOCAL support to getaddrinfo(3) and getnameinfo(3).
hrs updated this object.
hrs edited the test plan for this revision. (Show Details)
hrs added a reviewer: ume.
bjk added inline comments.
lib/libc/net/getnameinfo.3
79 ↗(On Diff #8671)

I think that .Pc is usually not followed by normal text on the same line.

hrs edited edge metadata.

Update the patch to support AF_UNSPEC and fix getnameinfo(3) manual page
based on a reviewer comment.

hrs marked an inline comment as done.Sep 18 2015, 10:20 PM
hrs added inline comments.
lib/libc/net/getnameinfo.3
80 ↗(On Diff #8839)

Fixed, thanks!

hrs edited edge metadata.
This revision was automatically updated to reflect the committed changes.
hrs marked an inline comment as done.