You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getnameinfo() combines gethostbyaddr() and getservbyport(), and currently in lsof, the latter is queried from both getservbyport() and the port mapper via rpc. I wonder if getnameinfo() queries the port mapper? The manpage does not reveal the detail, and I am unsure whether port map is still extensively used today.
Update: yes, port map is still used today, e.g. NFS server + rpcbind. The rpcbind process provides the port mapper. getservbyport()/getnameinfo() does not query port mapper via rpc.
Update 2: although gethostbyaddr() is obsoleted, it fits well in the current code: there is a host cache for gethostbyaddr(), a port cache for getservbyport() + port mapper. If we want to migrate to getaddrinfo(), we will need to merge the two calls and caches, or simply provide an empty port to gethostbyaddr() to only replace gethostbyaddr(). Is it worth it?
(should be POSIX-safe across platforms)
The text was updated successfully, but these errors were encountered: