mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:15:15 +00:00
Driver: fortconf: Fix fort_mem_cmp()
This commit is contained in:
parent
cd73f49f83
commit
53bb7f48ad
@ -42,8 +42,6 @@ static BOOL fort_conf_ip4_find(const UINT32 *iparr, UINT32 ip, UINT32 count, BOO
|
|||||||
return high >= 0 && ip >= iparr[high] && ip <= iparr[count + high];
|
return high >= 0 && ip >= iparr[high] && ip <= iparr[count + high];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define fort_ip6_cmp(l, r) fort_mem_cmp(l, r, sizeof(ip6_addr_t))
|
|
||||||
|
|
||||||
static BOOL fort_conf_ip6_find(
|
static BOOL fort_conf_ip6_find(
|
||||||
const ip6_addr_t *iparr, const ip6_addr_t *ip, UINT32 count, BOOL is_range)
|
const ip6_addr_t *iparr, const ip6_addr_t *ip, UINT32 count, BOOL is_range)
|
||||||
{
|
{
|
||||||
@ -97,7 +95,7 @@ static BOOL fort_conf_ip6_find(
|
|||||||
FORT_API int fort_mem_cmp(const void *p1, const void *p2, UINT32 len)
|
FORT_API int fort_mem_cmp(const void *p1, const void *p2, UINT32 len)
|
||||||
{
|
{
|
||||||
const size_t n = RtlCompareMemory(p1, p2, len);
|
const size_t n = RtlCompareMemory(p1, p2, len);
|
||||||
return (n == len) ? 0 : (((const char *) p1)[n] - ((const char *) p2)[n]);
|
return (n == len) ? 0 : (((unsigned char *) p1)[n] - ((unsigned char *) p2)[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORT_API BOOL fort_mem_eql(const void *p1, const void *p2, UINT32 len)
|
FORT_API BOOL fort_mem_eql(const void *p1, const void *p2, UINT32 len)
|
||||||
|
@ -347,6 +347,8 @@ extern "C" {
|
|||||||
|
|
||||||
FORT_API int fort_mem_cmp(const void *p1, const void *p2, UINT32 len);
|
FORT_API int fort_mem_cmp(const void *p1, const void *p2, UINT32 len);
|
||||||
|
|
||||||
|
#define fort_ip6_cmp(l, r) fort_mem_cmp(l, r, sizeof(ip6_addr_t))
|
||||||
|
|
||||||
FORT_API BOOL fort_mem_eql(const void *p1, const void *p2, UINT32 len);
|
FORT_API BOOL fort_mem_eql(const void *p1, const void *p2, UINT32 len);
|
||||||
|
|
||||||
FORT_API BOOL fort_conf_ip_inlist(
|
FORT_API BOOL fort_conf_ip_inlist(
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "iprange.h"
|
#include "iprange.h"
|
||||||
|
|
||||||
|
#include <common/fortconf.h>
|
||||||
|
|
||||||
#include <util/stringutil.h>
|
#include <util/stringutil.h>
|
||||||
|
|
||||||
#include "netutil.h"
|
#include "netutil.h"
|
||||||
@ -16,9 +18,9 @@ inline bool checkIp6MaskBitsCount(const int nbits)
|
|||||||
return (nbits >= 0 && nbits <= 128);
|
return (nbits >= 0 && nbits <= 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool compareLessIp6(const ip6_addr_t l, const ip6_addr_t r)
|
inline bool compareLessIp6(const ip6_addr_t &l, const ip6_addr_t &r)
|
||||||
{
|
{
|
||||||
return memcmp(&l, &r, sizeof(ip6_addr_t)) < 0;
|
return fort_ip6_cmp(&l, &r) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void sortIp6Array(ip6_arr_t &array)
|
inline void sortIp6Array(ip6_arr_t &array)
|
||||||
|
Loading…
Reference in New Issue
Block a user