Skip to content

Replace deprecated gethostbyaddr() with getnameinfo()#57

Merged
folkertvanheusden merged 1 commit into
folkertvanheusden:masterfrom
mikelolasagasti:gethostbyaddr-deprecated
Jan 2, 2026
Merged

Replace deprecated gethostbyaddr() with getnameinfo()#57
folkertvanheusden merged 1 commit into
folkertvanheusden:masterfrom
mikelolasagasti:gethostbyaddr-deprecated

Conversation

@mikelolasagasti

Copy link
Copy Markdown
Contributor

The gethostbyaddr() function is deprecated (POSIX.1-2008) and has several issues:

  • Not thread-safe (uses static internal buffer)
  • Not IPv6 ready (only works with AF_INET)

Replaced with getnameinfo() in:

  • cv.c: CONVTYPE_IP4TOHOST conversion
  • mt.c: syslog sender IP resolution

Note: While getnameinfo() supports IPv6, the current implementation still only handles IPv4 addresses (matching the original functionality). Full IPv6 support would require additional changes.

This resolves rpmlint warnings about deprecated network functions.

Fixes #12

The `gethostbyaddr()` function is deprecated (POSIX.1-2008) and has
several issues:
- Not thread-safe (uses static internal buffer)
- Not IPv6 ready (only works with `AF_INET`)

Replaced with `getnameinfo()` in:
- cv.c: CONVTYPE_IP4TOHOST conversion
- mt.c: syslog sender IP resolution

Note: While `getnameinfo()` supports IPv6, the current implementation
still only handles IPv4 addresses (matching the original functionality).
Full IPv6 support would require additional changes.

This resolves rpmlint warnings about deprecated network functions.

Fixes folkertvanheusden#12

Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
@folkertvanheusden folkertvanheusden merged commit aee431b into folkertvanheusden:master Jan 2, 2026
2 checks passed
@mikelolasagasti mikelolasagasti deleted the gethostbyaddr-deprecated branch January 2, 2026 14:10
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

Successfully merging this pull request may close these issues.

gethostbyaddr deprecated

2 participants