3
0
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:
Denis Kenzior 2021-06-04 14:00:27 -05:00
parent 094537efc6
commit e7529fc7de

View File

@ -162,6 +162,7 @@ static void ip_prefix_test(const void *data)
uint32_t end;
uint32_t mask;
struct in_addr ia;
char ip[INET_ADDRSTRLEN];
assert(util_ip_prefix_tohl(valid[i].ip_prefix,
&prefix, &start, &end, &mask));
@ -169,13 +170,16 @@ static void ip_prefix_test(const void *data)
assert(valid[i].prefix == prefix);
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);
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);
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);
}
}