Skip to content

Conversation

@mjeanson
Copy link

When running the check on an ipv6 address with a sticky onredirect policy like in this example:

check_curl -6 -H example.com -I ::1 -f sticky

It results in a getaddrinfo error:

HTTP CRITICAL - Unable to lookup IP address for '[::1]': getaddrinfo returned -3 - Temporary failure in name resolution

This happens because in check_http() if the content of server_addr is an ipv6 address enclosing brackets are added and on redirection a subsequent call to check_http() will pass this now bracketed value to getaddrinfo resulting in the error.

To work around this, keep a pointer to the original server_addr value and use it when a non-bracketed address is expected.

@waja waja added this to the 2.4.1 milestone Jun 25, 2025
@RincewindsHat
Copy link
Member

Hi @mjeanson,
thanks for the contribution. I will take a look at it when time and energy allows it.
In the meantime, could you take a look at what causes the tests to fail?

@mjeanson
Copy link
Author

mjeanson commented Jul 3, 2025

It should pass the tests now.

When running the check on an ipv6 address with a sticky onredirect
policy like in this example:

  check_curl -6 -H example.com -I ::1 -f sticky

It results in a getaddrinfo error:

  HTTP CRITICAL - Unable to lookup IP address for '[::1]': getaddrinfo returned -3 - Temporary failure in name resolution

This happens because in check_http() if the content of server_addr is an
ipv6 address enclosing brackets are added and on redirection a
subsequent call to check_http() will pass this now bracketed value to
getaddrinfo resulting in the error.

To work around this, strip the brackets from the address prior to the
lookup_host() call.

Signed-off-by: Michael Jeanson <[email protected]>
@RincewindsHat
Copy link
Member

Hello again,
sorry for the delay. When these changes came up I was already working on a refactoring of check_curl which sadly made this patch unapplicable.
I adapted the modifications in #2188 though, after verifying that the issue still existed.

Thank you a lot for finding and fixing this :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants