mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
unit: Use inet_ntop instead of inet_ntoa
This commit is contained in:
parent
094537efc6
commit
e7529fc7de
@ -162,6 +162,7 @@ static void ip_prefix_test(const void *data)
|
|||||||
uint32_t end;
|
uint32_t end;
|
||||||
uint32_t mask;
|
uint32_t mask;
|
||||||
struct in_addr ia;
|
struct in_addr ia;
|
||||||
|
char ip[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
assert(util_ip_prefix_tohl(valid[i].ip_prefix,
|
assert(util_ip_prefix_tohl(valid[i].ip_prefix,
|
||||||
&prefix, &start, &end, &mask));
|
&prefix, &start, &end, &mask));
|
||||||
@ -169,13 +170,16 @@ static void ip_prefix_test(const void *data)
|
|||||||
assert(valid[i].prefix == prefix);
|
assert(valid[i].prefix == prefix);
|
||||||
|
|
||||||
ia.s_addr = htonl(start);
|
ia.s_addr = htonl(start);
|
||||||
assert(strcmp(inet_ntoa(ia), valid[i].start) == 0);
|
assert(inet_ntop(AF_INET, &ia, ip, INET_ADDRSTRLEN));
|
||||||
|
assert(strcmp(ip, valid[i].start) == 0);
|
||||||
|
|
||||||
ia.s_addr = htonl(end);
|
ia.s_addr = htonl(end);
|
||||||
assert(strcmp(inet_ntoa(ia), valid[i].end) == 0);
|
assert(inet_ntop(AF_INET, &ia, ip, INET_ADDRSTRLEN));
|
||||||
|
assert(strcmp(ip, valid[i].end) == 0);
|
||||||
|
|
||||||
ia.s_addr = htonl(mask);
|
ia.s_addr = htonl(mask);
|
||||||
assert(strcmp(inet_ntoa(ia), valid[i].mask) == 0);
|
assert(inet_ntop(AF_INET, &ia, ip, INET_ADDRSTRLEN));
|
||||||
|
assert(strcmp(ip, valid[i].mask) == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user