Skip to content

Fix ares_getaddrinfo() numerical address fast path with AF_UNSPEC - #469

Merged
bradh352 merged 1 commit into
c-ares:mainfrom
ridgek:fake_addrinfo
May 30, 2022
Merged

Fix ares_getaddrinfo() numerical address fast path with AF_UNSPEC#469
bradh352 merged 1 commit into
c-ares:mainfrom
ridgek:fake_addrinfo

Conversation

@ridgek

@ridgek ridgek commented May 30, 2022

Copy link
Copy Markdown
Contributor

The conversion of numeric IPv4 addresses in fake_addrinfo() is broken when
the family is AF_UNSPEC. The initial call to ares_inet_pton with AF_INET
will succeed, but the subsequent call using AF_INET6 will fail. This results
in the fake_addrinfo() fast path failing, and ares_getaddrinfo() making a
query when none should be required.

Resolve this by only attempting the call to ares_inet_pton with AF_INET6
if the initial call with AF_INET was unsuccessful.

The conversion of numeric IPv4 addresses in fake_addrinfo() is broken when
the family is AF_UNSPEC. The initial call to ares_inet_pton with AF_INET
will succeed, but the subsequent call using AF_INET6 will fail. This results
in the fake_addrinfo() fast path failing, and ares_getaddrinfo() making a
query when none should be required.

Resolve this by only attempting the call to ares_inet_pton with AF_INET6
if the initial call with AF_INET was unsuccessful.
@ridgek
ridgek marked this pull request as ready for review May 30, 2022 01:55
@bradh352
bradh352 merged commit 5aa2594 into c-ares:main May 30, 2022
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.

2 participants