replace type in_addr_t to in_addr_64_t
parent
4eb30adb1a
commit
700a5bcaec
3
HISTORY
3
HISTORY
|
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
Version 1.71 2023-11-24
|
||||||
|
* full support IPv6 by pull request #47
|
||||||
|
|
||||||
Version 1.70 2023-09-30
|
Version 1.70 2023-09-30
|
||||||
* get full mac address of infiniband NIC under Linux
|
* get full mac address of infiniband NIC under Linux
|
||||||
* struct fast_task_info add field conn for RDMA connection
|
* struct fast_task_info add field conn for RDMA connection
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,8 @@ const char *get_next_local_ip(const char *previous_ip)
|
||||||
for (p=g_local_host_ip_addrs; p<pEnd; p+=IP_ADDRESS_SIZE)
|
for (p=g_local_host_ip_addrs; p<pEnd; p+=IP_ADDRESS_SIZE)
|
||||||
{
|
{
|
||||||
if (strcmp(p, LOCAL_LOOPBACK_IPv4) != 0 &&
|
if (strcmp(p, LOCAL_LOOPBACK_IPv4) != 0 &&
|
||||||
strcmp(p, LOCAL_LOOPBACK_IPv6) !=0 )
|
strcmp(p, LOCAL_LOOPBACK_IPv6) != 0 &&
|
||||||
|
strcasecmp(p, "fe80::1") != 0)
|
||||||
{
|
{
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include "common_define.h"
|
#include "common_define.h"
|
||||||
|
|
||||||
#define FAST_IF_ALIAS_PREFIX_MAX_SIZE 32
|
#define FAST_IF_ALIAS_PREFIX_MAX_SIZE 32
|
||||||
#define FAST_MAX_LOCAL_IP_ADDRS 16
|
#define FAST_MAX_LOCAL_IP_ADDRS 32
|
||||||
|
|
||||||
#define LOCAL_LOOPBACK_IPv4 "127.0.0.1"
|
#define LOCAL_LOOPBACK_IPv4 "127.0.0.1"
|
||||||
#define LOCAL_LOOPBACK_IPv6 "::1"
|
#define LOCAL_LOOPBACK_IPv6 "::1"
|
||||||
|
|
|
||||||
|
|
@ -2005,7 +2005,7 @@ static int parse_cidr_ips(const char *ip_addr, in_addr_64_t **allow_ip_addrs,
|
||||||
int host_bits;
|
int host_bits;
|
||||||
int bits;
|
int bits;
|
||||||
uint32_t hip;
|
uint32_t hip;
|
||||||
in_addr_t nip;
|
in_addr_64_t nip;
|
||||||
int h;
|
int h;
|
||||||
int count;
|
int count;
|
||||||
int result;
|
int result;
|
||||||
|
|
@ -2237,7 +2237,7 @@ static int parse_range_hosts(const char *value, char *pStart, char *pEnd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int load_allow_hosts(IniContext *pIniContext, \
|
int load_allow_hosts(IniContext *pIniContext,
|
||||||
in_addr_64_t **allow_ip_addrs, int *allow_ip_count)
|
in_addr_64_t **allow_ip_addrs, int *allow_ip_count)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
@ -2252,7 +2252,7 @@ int load_allow_hosts(IniContext *pIniContext, \
|
||||||
int nHeadLen;
|
int nHeadLen;
|
||||||
int nValueLen;
|
int nValueLen;
|
||||||
int i;
|
int i;
|
||||||
in_addr_t addr;
|
in_addr_64_t addr;
|
||||||
char hostname[256];
|
char hostname[256];
|
||||||
|
|
||||||
if ((pItemStart=iniGetValuesEx(NULL, "allow_hosts", \
|
if ((pItemStart=iniGetValuesEx(NULL, "allow_hosts", \
|
||||||
|
|
@ -2359,13 +2359,13 @@ int load_allow_hosts(IniContext *pIniContext, \
|
||||||
|
|
||||||
if (*allow_ip_count == 0)
|
if (*allow_ip_count == 0)
|
||||||
{
|
{
|
||||||
logWarning("file: "__FILE__", line: %d, " \
|
logWarning("file: "__FILE__", line: %d, "
|
||||||
"allow ip count: 0", __LINE__);
|
"allow ip count: 0", __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*allow_ip_count > 0)
|
if (*allow_ip_count > 0)
|
||||||
{
|
{
|
||||||
qsort(*allow_ip_addrs, *allow_ip_count, sizeof(in_addr_t), \
|
qsort(*allow_ip_addrs, *allow_ip_count, sizeof(in_addr_64_t),
|
||||||
cmp_by_ip_addr_t);
|
cmp_by_ip_addr_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2384,7 +2384,7 @@ int load_allow_hosts(IniContext *pIniContext, \
|
||||||
|
|
||||||
int cmp_by_ip_addr_t(const void *p1, const void *p2)
|
int cmp_by_ip_addr_t(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
return memcmp((in_addr_t *)p1, (in_addr_t *)p2, sizeof(in_addr_t));
|
return memcmp((in_addr_64_t *)p1, (in_addr_64_t *)p2, sizeof(in_addr_64_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_bytes(const char *pStr, const int default_unit_bytes, int64_t *bytes)
|
int parse_bytes(const char *pStr, const int default_unit_bytes, int64_t *bytes)
|
||||||
|
|
|
||||||
|
|
@ -1117,7 +1117,7 @@ in_addr_64_t getIpaddr(getnamefunc getname, int sock,
|
||||||
if (convert.sa.addr.sa_family == AF_INET) {
|
if (convert.sa.addr.sa_family == AF_INET) {
|
||||||
return convert.sa.addr4.sin_addr.s_addr;
|
return convert.sa.addr4.sin_addr.s_addr;
|
||||||
} else {
|
} else {
|
||||||
return *((in_addr_64_t *)&convert.sa.addr6.sin6_addr);
|
return *((in_addr_64_t *)((char *)&convert.sa.addr6.sin6_addr + 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1218,7 +1218,7 @@ in_addr_64_t getIpaddrByName(const char *name, char *buff, const int bufferSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ip_addr = *((in_addr_64_t *)&ipv6->sin6_addr);
|
ip_addr = *((in_addr_64_t *)((char *)&ipv6->sin6_addr + 8));
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
return ip_addr;
|
return ip_addr;
|
||||||
}
|
}
|
||||||
|
|
@ -1268,7 +1268,7 @@ int getIpaddrsByName(const char *name,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
addr = (struct sockaddr_in *) res->ai_addr;
|
addr = (struct sockaddr_in *)res->ai_addr;
|
||||||
if (inet_ntop(res->ai_family, &addr->sin_addr,
|
if (inet_ntop(res->ai_family, &addr->sin_addr,
|
||||||
ip_addr_arr[ip_count].ip_addr, INET6_ADDRSTRLEN) == NULL)
|
ip_addr_arr[ip_count].ip_addr, INET6_ADDRSTRLEN) == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
static bool g_continue_flag = true;
|
static bool g_continue_flag = true;
|
||||||
static int64_t produce_count = 0;
|
static int64_t produce_count = 0;
|
||||||
static int64_t consume_count = 0;
|
static int64_t consume_count = 0;
|
||||||
|
static struct fast_task_queue free_queue;
|
||||||
static struct fast_blocked_queue blocked_queue;
|
static struct fast_blocked_queue blocked_queue;
|
||||||
|
|
||||||
#define MAX_USLEEP 10000
|
#define MAX_USLEEP 10000
|
||||||
|
|
@ -51,7 +52,7 @@ void *producer_thread(void *arg)
|
||||||
printf("produce count: %"PRId64"\n", count);
|
printf("produce count: %"PRId64"\n", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
pTask = free_queue_pop();
|
pTask = free_queue_pop(&free_queue);
|
||||||
if (pTask != NULL) {
|
if (pTask != NULL) {
|
||||||
blocked_queue_push(&blocked_queue, pTask);
|
blocked_queue_push(&blocked_queue, pTask);
|
||||||
}
|
}
|
||||||
|
|
@ -99,7 +100,7 @@ int main(int argc, char *argv[])
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = free_queue_init(1024, min_buff_size, \
|
result = free_queue_init(&free_queue, 1024, min_buff_size,
|
||||||
max_buff_size, arg_size);
|
max_buff_size, arg_size);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue