Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gethostbyaddr() obsoleted. Change to getaddrinfo()? #162

Open
jrybar-rh opened this issue Jul 20, 2021 · 2 comments
Open

gethostbyaddr() obsoleted. Change to getaddrinfo()? #162

jrybar-rh opened this issue Jul 20, 2021 · 2 comments

Comments

@jrybar-rh
Copy link
Contributor

(should be POSIX-safe across platforms)

@jrybar-rh
Copy link
Contributor Author

This issue created for tracking purposes.
It originated from rpminspect warning about obsoleted functions from netdb.h.

@jiegec
Copy link
Contributor

jiegec commented Jan 20, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants