update test case
This commit is contained in:
parent
4faa791ffd
commit
772e9c6627
|
@ -679,15 +679,8 @@ void subnetIp2int(const char* const ip_addr, uint8_t* dst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t subnetIpRang2Int(SIpV4Range* pRange) {
|
uint32_t subnetIpRang2Int(SIpV4Range* pRange) {
|
||||||
SIpV4Range range = {.ip = pRange->ip, .mask = 32};
|
uint32_t ip = pRange->ip;
|
||||||
uint8_t el[4] = {0};
|
return ((ip & 0xFF) << 24) | ((ip & 0xFF00) << 8) | ((ip & 0xFF0000) >> 8) | ((ip >> 24) & 0xFF);
|
||||||
|
|
||||||
el[0] = range.ip & 0xFF;
|
|
||||||
el[1] = (range.ip >> 8) & 0xFF;
|
|
||||||
el[2] = (range.ip >> 16) & 0xFF;
|
|
||||||
el[3] = (range.ip >> 24) & 0xFF;
|
|
||||||
|
|
||||||
return (el[0] << 24) | (el[1] << 16) | (el[2] << 8) | (el[3]);
|
|
||||||
}
|
}
|
||||||
int32_t subnetInit(SubnetUtils* pUtils, SIpV4Range* pRange) {
|
int32_t subnetInit(SubnetUtils* pUtils, SIpV4Range* pRange) {
|
||||||
if (pRange->mask == 32) {
|
if (pRange->mask == 32) {
|
||||||
|
@ -720,8 +713,8 @@ int32_t subnetCheckIp(SubnetUtils* pUtils, uint32_t ip) {
|
||||||
} else {
|
} else {
|
||||||
SIpV4Range range = {.ip = ip, .mask = 32};
|
SIpV4Range range = {.ip = ip, .mask = 32};
|
||||||
|
|
||||||
uint32_t ip = subnetIpRang2Int(&range);
|
uint32_t t = subnetIpRang2Int(&range);
|
||||||
return ip >= pUtils->network && ip <= pUtils->broadcast;
|
return t >= pUtils->network && t <= pUtils->broadcast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue