dhcp/nettools: normalize subnet netmask in nettools client

For an IPv4 subnet mask we expect that all the leading bits are set (no
"holes"). But _nm_utils_ip4_netmask_to_prefix() does not enforce that,
and tries to make the best of it.

In face of a netmask with holes, normalize the mask.
This commit is contained in:
Thomas Haller
2022-06-21 11:26:23 +02:00
parent 57dfa999f7
commit c06e6390a4

View File

@@ -254,7 +254,8 @@ lease_parse_address(NDhcp4ClientLease *lease,
"could not get netmask from lease");
return FALSE;
}
a_plen = _nm_utils_ip4_netmask_to_prefix(a_netmask);
a_plen = _nm_utils_ip4_netmask_to_prefix(a_netmask);
a_netmask = _nm_utils_ip4_prefix_to_netmask(a_plen);
}
nm_dhcp_option_add_option_in_addr(options,