Commit e8b0894d authored by Daniel Black's avatar Daniel Black

MDEV-28243: AIX missing my_gethwaddr implementation

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
parent 4834a0d1
......@@ -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;
......@@ -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>
......@@ -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);
......@@ -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
/*
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment