Skip to content

Conversation

@nodece
Copy link
Member

@nodece nodece commented Apr 22, 2025

Motivation

#4588 uses java.net.InetAddress#getCanonicalHostName to resolve the hostname. However, if the operating system is unable to resolve a hostname for the given IP address, this method may simply return the IP address. This can lead to unexpected behavior when useHostNameAsBookieID is enabled — in such cases, we expect a hostname, not an IP.

Additionally, the advertised address should not be a loopback address unless explicitly allowed by allowLoopback.

If the user uses the loopback address as advertised, this change may introduce a breaking change.

Changes

  • Validate that the advertised address is not a loopback address when allowLoopback is false.
  • Ensure that the resolved hostname is valid and not equal to the raw IP.
  • Adjust test to provide a valid advertised address.

@merlimat merlimat merged commit cdd854f into apache:master Apr 22, 2025
23 checks passed
@nodece nodece deleted the strict-hostname-resolution-and-loopback-check branch April 23, 2025 01:31
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.

4 participants