[BP 7.2.1] - XDCR - ipv6 only mode + non-encrypted remote could lead to invalid IP address returned

Description

Found via unit test + a random luck that the IPs returned by localhost look up via net.LookupIP happens to return ipv4 in front of ipv6 address.

Essentially if the golang call of net.LookupIP returns addresses in a list and the IPv4 address is in the front of the list, and IPv6 only mode is in place, XDCR will return an invalid IPv6 address of:
[127.0.0.1]

============== Test case start: TestEnforceIP ================= NEIL DEBUG nonActive activeHostName connStr localhost NEIL DEBUG addrs [127.0.0.1 ::1] NEIL DEBUG ipv6 addr connStr localhost port 0 portErr No port number NEIL DEBUG ipv4 blocked true ipv6 blocked false mapping connStr localhost isFullEncryption false to [127.0.0.1] ============== Test case done: TestEnforceIP ================= --- FAIL: TestEnforceIP (0.00s) remote_cluster_ref_test.go:331: Error Trace: remote_cluster_ref_test.go:331 Error: Not equal: expected: "[::1]" actual : "[127.0.0.1]" Diff: --- Expected +++ Actual @@ -1 +1 @@ -[::1] +[127.0.0.1] Test: TestEnforceIP

We haven't seen this in the field yet probably because not many people are using IPv6 only mode, and considering that Capella currently uses IPv4 only mode.

However, if IPv6 only mode is ever used, this could lead to continuous HA outages as the MyConnectionStr() method is used throughout the code as a remote cluster reference string getter.

 

Issue

Resolution

Running ipv6 only mode + non-encrypted remote resulted in invalid IP addresses being returned leading to connection issues.

A valid IP address is now returned.

Components

Fix versions

Labels

Environment

None

Link to Log File, atop/blg, CBCollectInfo, Core dump

None

Release Notes Description

None

Activity

Show:

CB robot June 16, 2023 at 12:36 AM

Build couchbase-server-7.2.1-5797 contains goxdcr commit 64737a3 with commit message:
https://couchbasecloud.atlassian.net/browse/MB-57412#icft=MB-57412: ipv6 only mode could return invalid IPv6 address

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Is this a Regression?

No

Triage

Untriaged

Story Points

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created June 15, 2023 at 8:58 PM
Updated September 18, 2023 at 3:08 PM
Resolved June 15, 2023 at 11:16 PM
Instabug