Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26171

wsrep_sst_receive_address does not parse IPv6 address in wsrep_node_address correctly

Details

    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'
      

      Attachments

        Activity

          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.

          wedwards William Edwards added a comment - 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.

          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.

          c0m1c5an5 Max Kondratenko added a comment - 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.

          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

          c0m1c5an5 Max Kondratenko added a comment - 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

          ok to push

          jplindst Jan Lindström (Inactive) added a comment - ok to push
          sysprg Julius Goryavsky added a comment - Fixed, https://github.com/MariaDB/server/commit/1a8cf23b7b6b381aeb97f6546f52b81749155ee0

          People

            sysprg Julius Goryavsky
            wedwards William Edwards
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.