-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support IPv6 addresses across all YugabyteDB servers & CLIs #3644
Comments
So I took a look at the source.. Looks like most of the problems can be fixed in yb/util/net/net_util.cc:
Wherever there is 0.0.0.0, it should be replaced by ::, IPv6 sockets also listen on IPv4 by default (except on OpenBSD or when this is explicitly disabled, in which case you'll want to bind to multiple sockets as well, one on 0.0.0.0 and one on ::). |
Hi @synnack, Awesome thanks for going through the code and pointing out the fix, we will definitely take a look at this! Also, if you're interested in contributing a fix, we'd love to work with you on enabling you. cc @iSignal @bmatican Do you also mind adding your self to the contributors list: https://github.com/yugabyte/yugabyte-db/blob/master/CONTRIBUTORS.md |
I have something working:
Parsing succeeds, listens and connects over IPv6 (this socket still also accepts IPv4 traffic): Still requires a bit more testing/validation before I make a pull request, but all in all I think it is working. |
Possibly concerned about the lack of StripWhitespace in ParseString now, doesn't really seem to be the right place for it though, and did not want to modify the string from the parent. |
…nssl, curl from thirdparty Summary: The patch to squeasel (yugabyte/yugabyte-db-thirdparty@764fea2) changed the return type of get_bound_addresses to be sockaddr_storage that is big enough to hold both IPv4 and IPv6 addresses. This diff uses this API. The patch also enabled IPv6 address handling in squeasel. Test Plan: * Verified master web ui looks good on linux dev server * Built a release package and deployed on portal, Ran sample apps SQL and CQL workloads. * Jenkins Reviewers: bogdan, sergei, mikhail Reviewed By: mikhail Subscribers: ybase, bogdan Differential Revision: https://phabricator.dev.yugabyte.com/D8616
…dresses Summary: The primary goal of this diff is to allow yugabyte to work in IPv6-only environments without disturbing much of how it works presently in IPv4 environments. Some of the behavior in dual stack environments may still need fixes in future diffs. 1. Allow resolution to return IPv6 addresses 2. Add the ability to prefer IPv4/IPv6 addresses of certain types when multiple addresses are available. This is the case when a single domain name resolves to multiple IP addrs (via getaddrinfo, family AF_UNSPEC). This is also the case when bind to 0.0.0.0 or [::] is specified and multiple local addresses are available to advertise to other nodes (AddHostPortPBs -> GetLocalAddresses). In particular, IPv6 link local addresses like 'fe80::1%lo' which are commonly present on macbooks are not browser friendly, so added an ipv6_non_link_local filter that prefers loopback address like [::1] over [fe80::1%lo] when both are available. 3. Include HostPort parsing from the PR #3765 and fix some of the behavior within. Test Plan: 1. Test yb-ctl on local dev server, verify IP4 behavior is unchanged. 2. Tested on dual stack nodes with both IPv4 and IPv6 addresses. Verified that when 0.0.0.0 is specified and local_address_filter, resolve_address_filter are at default values (preferring ipv4), the server binds to and advertises IPv4 interfaces. When '[::]' is specified and local_address_filter, resolve_address_filter are changed to 'ipv6_external,ipv4_non_link_local,ipv6_all', verify that the server binds to and advertises IPv6 IPs. 3. Verified binding to DNS names with local_address_filter, resolve_address_filter set to 'ipv6_external,ipv6_non_link_local,ipv6_all' that the rpc and web server bind to IPv6 IPs. pgsql_proxy_bind_address works differently with postgres binding to both IPv4 and IPv6 addresses when a DNS name with both IPv4 and IPv6 addresses is specified (because it does not understand these filter flags). 4. Added some unit tests to verify the bind address parsing and the address filtering functionality. Reviewers: bogdan, sergei Reviewed By: sergei Subscribers: ybase Differential Revision: https://phabricator.dev.yugabyte.com/D8675
…s to openssl, curl from thirdparty Summary: The patch to squeasel (yugabyte/yugabyte-db-thirdparty@764fea2) changed the return type of get_bound_addresses to be sockaddr_storage that is big enough to hold both IPv4 and IPv6 addresses. This diff uses this API. The patch also enabled IPv6 address handling in squeasel. Test Plan: * Verified master web ui looks good on linux dev server * Built a release package and deployed on portal, Ran sample apps SQL and CQL workloads. * Jenkins Reviewers: bogdan, sergei, mikhail Reviewed By: mikhail Subscribers: ybase, bogdan Differential Revision: https://phabricator.dev.yugabyte.com/D8616
… bind addresses Summary: The primary goal of this diff is to allow yugabyte to work in IPv6-only environments without disturbing much of how it works presently in IPv4 environments. Some of the behavior in dual stack environments may still need fixes in future diffs. 1. Allow resolution to return IPv6 addresses 2. Add the ability to prefer IPv4/IPv6 addresses of certain types when multiple addresses are available. This is the case when a single domain name resolves to multiple IP addrs (via getaddrinfo, family AF_UNSPEC). This is also the case when bind to 0.0.0.0 or [::] is specified and multiple local addresses are available to advertise to other nodes (AddHostPortPBs -> GetLocalAddresses). In particular, IPv6 link local addresses like 'fe80::1%lo' which are commonly present on macbooks are not browser friendly, so added an ipv6_non_link_local filter that prefers loopback address like [::1] over [fe80::1%lo] when both are available. 3. Include HostPort parsing from the PR yugabyte#3765 and fix some of the behavior within. Test Plan: 1. Test yb-ctl on local dev server, verify IP4 behavior is unchanged. 2. Tested on dual stack nodes with both IPv4 and IPv6 addresses. Verified that when 0.0.0.0 is specified and local_address_filter, resolve_address_filter are at default values (preferring ipv4), the server binds to and advertises IPv4 interfaces. When '[::]' is specified and local_address_filter, resolve_address_filter are changed to 'ipv6_external,ipv4_non_link_local,ipv6_all', verify that the server binds to and advertises IPv6 IPs. 3. Verified binding to DNS names with local_address_filter, resolve_address_filter set to 'ipv6_external,ipv6_non_link_local,ipv6_all' that the rpc and web server bind to IPv6 IPs. pgsql_proxy_bind_address works differently with postgres binding to both IPv4 and IPv6 addresses when a DNS name with both IPv4 and IPv6 addresses is specified (because it does not understand these filter flags). 4. Added some unit tests to verify the bind address parsing and the address filtering functionality. Reviewers: bogdan, sergei Reviewed By: sergei Subscribers: ybase Differential Revision: https://phabricator.dev.yugabyte.com/D8675
The functionality is checked in. I will document the net_address_filter flag needed at #5813. |
Today only IPv4 addresses are supported for all the various YugabyteDB servers and CLIs. This should be enhanced to support IPv6 addresses as well.
Some context from https://en.wikipedia.org/wiki/IPv6_address
IPv6 is the successor to the first addressing infrastructure of the Internet, Internet Protocol version 4 (IPv4). In contrast to IPv4, which defined an IP address as a 32-bit value, IPv6 addresses have a size of 128 bits. Therefore, IPv6 has a vastly enlarged address space compared to IPv4.
An IPv6 address is represented as eight groups of four hexadecimal digits, each group representing 16 bits (two octets, a group sometimes also called a hextet[6][7]). The groups are separated by colons (:). An example of an IPv6 address is: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
The text was updated successfully, but these errors were encountered: