mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#ifndef MAIN
|
#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)
|
static my_bool memcpy_and_test(uchar *to, uchar *from, uint len)
|
||||||
{
|
{
|
||||||
uint i, res= 1;
|
uint i, res= 1;
|
||||||
@@ -74,7 +74,7 @@ err:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__linux__) || defined(__sun)
|
#elif defined(_AIX) || defined(__linux__) || defined(__sun)
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <net/if_arp.h>
|
#include <net/if_arp.h>
|
||||||
@@ -87,11 +87,15 @@ err:
|
|||||||
my_bool my_gethwaddr(uchar *to)
|
my_bool my_gethwaddr(uchar *to)
|
||||||
{
|
{
|
||||||
int fd, res= 1;
|
int fd, res= 1;
|
||||||
|
#ifdef _AIX
|
||||||
|
struct ifhwaddr_req ifr[32];
|
||||||
|
#else
|
||||||
struct ifreq ifr[32];
|
struct ifreq ifr[32];
|
||||||
|
#endif
|
||||||
struct ifconf ifc;
|
struct ifconf ifc;
|
||||||
DBUG_ENTER("my_gethwaddr");
|
DBUG_ENTER("my_gethwaddr");
|
||||||
|
|
||||||
ifc.ifc_req= ifr;
|
ifc.ifc_req= (struct ifreq *) ifr;
|
||||||
ifc.ifc_len= sizeof(ifr);
|
ifc.ifc_len= sizeof(ifr);
|
||||||
|
|
||||||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
@@ -106,9 +110,14 @@ my_bool my_gethwaddr(uchar *to)
|
|||||||
uint i;
|
uint i;
|
||||||
for (i= 0; res && i < ifc.ifc_len / sizeof(ifr[0]); 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)
|
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);
|
ETHER_ADDR_LEN);
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
|
@@ -179,21 +179,21 @@ if ($USE_CHILD_GROUP2)
|
|||||||
--connection child2_1
|
--connection child2_1
|
||||||
if ($USE_GENERAL_LOG)
|
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_ARGUMENT1;
|
||||||
}
|
}
|
||||||
eval $CHILD2_1_SELECT_TABLES;
|
eval $CHILD2_1_SELECT_TABLES;
|
||||||
--connection child2_2
|
--connection child2_2
|
||||||
if ($USE_GENERAL_LOG)
|
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_ARGUMENT1;
|
||||||
}
|
}
|
||||||
eval $CHILD2_2_SELECT_TABLES;
|
eval $CHILD2_2_SELECT_TABLES;
|
||||||
--connection child2_3
|
--connection child2_3
|
||||||
if ($USE_GENERAL_LOG)
|
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_ARGUMENT1;
|
||||||
}
|
}
|
||||||
eval $CHILD2_3_SELECT_TABLES;
|
eval $CHILD2_3_SELECT_TABLES;
|
||||||
|
Reference in New Issue
Block a user