← Back to team overview

maria-developers team mailing list archive

MariaDB 10.4 on AIX. Issue with: sql/wsrep_mysqld.cc : ip_len

 

Hi,

In my environment (AIX & MariaDB v10.4.3 or 10.4.4), the following line of sql/wsrep_mysqld.cc :

       size_t const ip_len= wsrep_host_len(node_addr.c_str(), node_addr.size());

is preprocessed (gcc -E) as:

       size_t const
                   ip_ff.ip_vhltl.ip_x.ip_xlen
                         = wsrep_host_len(node_addr.c_str(), node_addr.size());

where "ip_len" becomes: ip_ff.ip_vhltl.ip_x.ip_xlen , which is wrong and breaks.

This is due to the following macro in AIX /usr/include/netinet/ip.h :

#define       ip_len  ip_ff.ip_flen


The attached patch (replace ip_len by ip_len_mdb) is an easy work-around for fixing the issue. However, it may not be the perfect appropriate change.
Since I do not master MariaDB, I'd like someone to propose a fully correct fix.


Thanks/Regards,

Tony Reix
--- ./sql/wsrep_mysqld.cc.ORIGIN	2019-04-15 18:32:16 -0500
+++ ./sql/wsrep_mysqld.cc	2019-04-15 18:29:44 -0500
@@ -527,11 +527,11 @@
     {
       if (node_addr.size())
       {
-        size_t const ip_len= wsrep_host_len(node_addr.c_str(), node_addr.size());
-        if (ip_len + 7 /* :55555\0 */ < inc_addr_max)
+        size_t const ip_len_mdb= wsrep_host_len(node_addr.c_str(), node_addr.size());
+        if (ip_len_mdb + 7 /* :55555\0 */ < inc_addr_max)
         {
-          memcpy (inc_addr, node_addr.c_str(), ip_len);
-          snprintf(inc_addr + ip_len, inc_addr_max - ip_len, ":%u",
+          memcpy (inc_addr, node_addr.c_str(), ip_len_mdb);
+          snprintf(inc_addr + ip_len_mdb, inc_addr_max - ip_len_mdb, ":%u",
                    (int)mysqld_port);
         }
         else