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

Add possibility to prefer IPv6, IPv4 or unspecified #1096

Merged
merged 1 commit into from
Sep 1, 2022

Conversation

zuiderkwast
Copy link
Contributor

@zuiderkwast zuiderkwast commented Sep 1, 2022

Adds options to select preferred IP stack.

  • REDIS_OPT_PREFER_IPV4 = Try IPv4 first, then IPv6 if no IPv4 was found

  • REDIS_OPT_PREFER_IPV6 = Try IPv6 first, then IPv4 if no IPv4 was found

  • Both flags set = Use getaddrinfo() with AF_UNSPEC. This allows the user or sysadmin to configure preferred IP stacks in /etc/gai.conf.

  • None of these flags set = Try IPv4 first, for historical reasons.

Fixes #696.

@zuiderkwast
Copy link
Contributor Author

Open questions:

  • Docs: I think redisConnectWithOptions should be mentioned in README under Connecting. All the options should be listed. Perhaps this is material for a different PR?
  • Decide if "prefer IPv4 over IPv6" should remain the default. Should we switch to "unspecified" for the default? Would it require a major or minor version bump?

Copy link
Contributor

@bjosv bjosv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@michael-grunder michael-grunder merged commit 10c78c6 into redis:master Sep 1, 2022
@michael-grunder
Copy link
Collaborator

Awesome, this is a nice improvement. I'm happy to update our docs.

@zuiderkwast zuiderkwast deleted the option-prefer-ip-stack branch September 1, 2022 19:29
michael-grunder added a commit that referenced this pull request Sep 1, 2022
Additionally document the new `REDIS_OPT_PREFER_IPV4`,
`REDIS_OPT_PREFER_IPV6` as well as the rest of our existing options.

See #1096
michael-grunder added a commit that referenced this pull request Sep 2, 2022
Additionally document the new `REDIS_OPT_PREFER_IPV4`,
`REDIS_OPT_PREFER_IPV6` as well as the rest of our existing options.

See #1096
michael-grunder added a commit that referenced this pull request Sep 2, 2022
michael-grunder added a commit that referenced this pull request Sep 2, 2022
Add REDIS_OPT_PREFER_UNSPEC

See: #1099, #1096

Co-authored-by: Viktor Söderqvist <[email protected]>
Co-authored-by: Viktor Söderqvist <[email protected]>
Co-authored-by: Viktor Söderqvist <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resolve IPv6 address takes too much time
3 participants