Skip to content

Commit

Permalink
MDEV-28243: AIX missing my_gethwaddr implementation
Browse files Browse the repository at this point in the history
and failing spider partition test.

With some small datatype changes to the Linux/Solaris my_gethwaddr implementation
the hardware address of AIX can be returned. This is an important aspect
in Spider (and UUID).

Spider test change reviewed by Nayuta Yanagisawa.

my_gethwaddr review by Monty in #2081
  • Loading branch information
grooverdan committed Jun 8, 2022
1 parent 4834a0d commit e8b0894
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
19 changes: 14 additions & 5 deletions mysys/my_gethwaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#ifndef MAIN

#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__linux__) || defined(__sun) || defined(_WIN32)
#if defined(_AIX) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__linux__) || defined(__sun) || defined(_WIN32)
static my_bool memcpy_and_test(uchar *to, uchar *from, uint len)
{
uint i, res= 1;
Expand Down Expand Up @@ -74,7 +74,7 @@ my_bool my_gethwaddr(uchar *to)
return res;
}

#elif defined(__linux__) || defined(__sun)
#elif defined(_AIX) || defined(__linux__) || defined(__sun)
#include <net/if.h>
#include <sys/ioctl.h>
#include <net/if_arp.h>
Expand All @@ -87,11 +87,15 @@ my_bool my_gethwaddr(uchar *to)
my_bool my_gethwaddr(uchar *to)
{
int fd, res= 1;
#ifdef _AIX
struct ifhwaddr_req ifr[32];
#else
struct ifreq ifr[32];
#endif
struct ifconf ifc;
DBUG_ENTER("my_gethwaddr");

ifc.ifc_req= ifr;
ifc.ifc_req= (struct ifreq *) ifr;
ifc.ifc_len= sizeof(ifr);

fd = socket(AF_INET, SOCK_DGRAM, 0);
Expand All @@ -106,9 +110,14 @@ my_bool my_gethwaddr(uchar *to)
uint i;
for (i= 0; res && i < ifc.ifc_len / sizeof(ifr[0]); i++)
{
#ifdef __linux__
#if !defined(_AIX) || !defined(__linux__)
#if defined(__linux___)
#define HWADDR_DATA ifr[i].ifr_hwaddr.sa_data
#else
#define HWADDR_DATA ifr[i].ifr_hwaddr
#endif
if (ioctl(fd, SIOCGIFHWADDR, &ifr[i]) >= 0)
res= memcpy_and_test(to, (uchar *)&ifr[i].ifr_hwaddr.sa_data,
res= memcpy_and_test(to, (uchar *)&HWADDR_DATA,
ETHER_ADDR_LEN);
#else
/*
Expand Down
6 changes: 3 additions & 3 deletions storage/spider/mysql-test/spider/t/partition_mrr.test
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,21 @@ if ($USE_CHILD_GROUP2)
--connection child2_1
if ($USE_GENERAL_LOG)
{
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
--replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
--connection child2_2
if ($USE_GENERAL_LOG)
{
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
--replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_2_SELECT_ARGUMENT1;
}
eval $CHILD2_2_SELECT_TABLES;
--connection child2_3
if ($USE_GENERAL_LOG)
{
--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
--replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/
eval $CHILD2_3_SELECT_ARGUMENT1;
}
eval $CHILD2_3_SELECT_TABLES;
Expand Down

0 comments on commit e8b0894

Please sign in to comment.