Skip to content

Commit baa37e3

Browse files
committed
[yugabyte#4851] Default to IPv4 addresses only for resolution and local addr selection
Summary: In yugabyte@5a88e2f, a getaddrinfo call was changed to use AF_UNSPEC instead of AF_INET to return both IPv4 and IPv6 results for resolution. This means that localhost now resolves to both 127.0.0.1 and [::1] on most modern systems that have these entries in /etc/hosts. However, in https://github.com/yugabyte/yugabyte-db/runs/787021393, it seems there is a github workflow host that resolves localhost to [::1] but has an error binding to [::1]. The issue doesn't happen on a vanilla Ubuntu 18.04 GCP host with a similar IPv6 entry added for localhost. I'm not sure how many hosts exist with this issue but to be safe, I am restricting DNS resolution and local address seletion to only use IPv4 hosts. This behavior should be roughly similar to earlier. Test Plan: Ran this fix through the workflow as part of a PR and verified that the create snapshot failure no longer occurs. Reviewers: bogdan, sergei, mikhail Reviewed By: mikhail Subscribers: ybase Differential Revision: https://phabricator.dev.yugabyte.com/D8734
1 parent 3cc749a commit baa37e3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/yb/rpc/rpc_stub-test.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,8 @@ TEST_F(RpcStubTest, TestRpcPerformance) {
760760
}
761761

762762
TEST_F(RpcStubTest, IPv6) {
763+
google::FlagSaver saver;
764+
FLAGS_net_address_filter = "all";
763765
std::vector<IpAddress> addresses;
764766
GetLocalAddresses(&addresses, AddressFilter::ANY);
765767

src/yb/util/net/net_util.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ using strings::Substitute;
8181

8282
DEFINE_string(
8383
net_address_filter,
84-
"ipv4_external,ipv4_all,ipv6_external,ipv6_non_link_local,all",
84+
"ipv4_external,ipv4_all",
8585
"Order in which to select ip addresses returned by the resolver"
8686
"Can be set to something like \"ipv4_all,ipv6_all\" to prefer IPv4 over "
8787
"IPv6 addresses."

0 commit comments

Comments
 (0)