3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

ip-pool: Use inet_ntop instead of inet_ntoa

This commit is contained in:
Denis Kenzior 2021-06-04 14:11:25 -05:00
parent e7529fc7de
commit 6f99368935

View File

@ -141,6 +141,7 @@ int ip_pool_select_addr4(const char **addr_str_list, uint8_t subnet_prefix_len,
struct in_addr ia; struct in_addr ia;
const struct l_queue_entry *entry; const struct l_queue_entry *entry;
int err = -EINVAL; int err = -EINVAL;
char ipstr[INET_ADDRSTRLEN];
/* Build a sorted list of used/unavailable subnets */ /* Build a sorted list of used/unavailable subnets */
for (entry = l_queue_get_entries((struct l_queue *) used_addr4_list); for (entry = l_queue_get_entries((struct l_queue *) used_addr4_list);
@ -242,7 +243,10 @@ check_avail:
done: done:
err = 0; err = 0;
ia.s_addr = htonl(host_addr); ia.s_addr = htonl(host_addr);
*out_addr = l_rtnl_address_new(inet_ntoa(ia), subnet_prefix_len); if (L_WARN_ON(!inet_ntop(AF_INET, &ia, ipstr, INET_ADDRSTRLEN)))
err = -errno;
else
*out_addr = l_rtnl_address_new(ipstr, subnet_prefix_len);
cleanup: cleanup:
l_queue_destroy(ranges, l_free); l_queue_destroy(ranges, l_free);