[MDEV-26171] wsrep_sst_receive_address does not parse IPv6 address in wsrep_node_address correctly Created: 2021-07-17  Updated: 2022-04-26  Resolved: 2022-04-12

Status: Closed
Project: MariaDB Server
Component/s: Galera SST
Affects Version/s: 10.5.11, 10.9.0, 10.3.34, 10.4.24, 10.6.7, 10.7.3, 10.8.2
Fix Version/s: 10.3.35, 10.4.25, 10.5.16, 10.6.8, 10.7.4, 10.8.3, 10.9.1

Type: Bug Priority: Critical
Reporter: William Edwards Assignee: Julius Goryavsky
Resolution: Fixed Votes: 1
Labels: None

Attachments: Text File ipv6.patch    

 Description   

`wsrep_sst_receive_address` defaults to `wsrep_node_address`.

When `wsrep_node_address` is set to an IPv6 address and `wsrep_sst_receive_address` is not set or set to its default value of 'AUTO', `wsrep_node_address`'s IPv6 address does not seem to be parsed correctly. SST fails with:

rsync: b6d:982:1aae:565:478:828:f51: invalid numeric value (in daemon mode)

I have not tested this with another SST method than rsync. Omitting brackets around the IPv6 address in `wsrep_node_address` does not make a difference.

Non-functional config:

wsrep_node_address = '[fc00:b6d:982:1aae:565:478:828:f51]'
wsrep_sst_receive_address = 'AUTO'

Functional config:

wsrep_node_address = '[fc00:b6d:982:1aae:565:478:828:f51]'
wsrep_sst_receive_address = '[fc00:b6d:982:1aae:565:478:828:f51]:4444'



 Comments   
Comment by William Edwards [ 2021-07-24 ]

For future readers: commit 7e8a89387b's commit message says:

 1) The ipv6 addresses were incorrectly handled in the SST script
    for rsync (incorrect address substitution for establishing a
    connection, incorrect address substitution for bind, and so on);

This issue is still present in MariaDB 10.3.30 and MariaDB 10.5.11, both of which include this commit.

Comment by Max Kondratenko [ 2021-10-18 ]

This behaviour is due to wsrep_sst.cc wsrep_sst_prepare function. Variable wsrep_sst_receive_address is being used as rsync address without parsing. When wsrep_sst_receive_address is not present or is "AUTO", wsrep_node_address is used to generate the address by parsing it through wsrep_utils.h wsp::Address, which returns ipv6 address without square brackets. Square brackets are used by wsrep_sst_common.sh to determine if the address is ipv6, so all ipv6 addreses passed through wsrep_node_address will be concidered ipv4 due to lack of square brackets.

There are possible solutions:
1. Change wsrep_sst_common.sh to understand ipv6 addreses without square brackets.
2. Remove address parsing for wsrep_node_address.
3. Check if parsed wsrep_node_address is ipv6 and add square brackets accordingly.

Comment by Max Kondratenko [ 2021-10-20 ]

Here is a small patch I made which both improves addres generation consistensy between methods and adds square brackets around ipv6 addreses. This is only tested to compile without errors, but I am having trouble running the tests right now, so their results will be posted later. I would appreciate if anyone else tested this. ipv6.patch

Comment by Jan Lindström (Inactive) [ 2022-04-12 ]

ok to push

Comment by Julius Goryavsky [ 2022-04-12 ]

Fixed, https://github.com/MariaDB/server/commit/1a8cf23b7b6b381aeb97f6546f52b81749155ee0

Generated at Thu Feb 08 09:43:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.