dhcp: add static-keys argument to nm_dhcp_option_create_options_dict()

This is so that we can use the same function also to create the
hash for dhclient plugin.

(cherry picked from commit 492818b529)
This commit is contained in:
Thomas Haller 2022-12-13 08:31:16 +01:00
parent 2987bb7e8d
commit 63a6bc1bc9
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
4 changed files with 7 additions and 6 deletions

View file

@ -624,7 +624,7 @@ lease_to_ip4_config(NMDhcpNettools *self, NDhcp4ClientLease *lease, GError **err
l3cd = nm_dhcp_client_create_l3cd(NM_DHCP_CLIENT(self));
options = nm_dhcp_option_create_options_dict();
options = nm_dhcp_option_create_options_dict(TRUE);
if (!lease_parse_address(self, lease, l3cd, iface, options, &lease_address, error))
return NULL;

View file

@ -460,7 +460,7 @@ nm_dhcp_option_add_requests_to_options(GHashTable *options, int addr_family)
}
GHashTable *
nm_dhcp_option_create_options_dict(void)
nm_dhcp_option_create_options_dict(gboolean static_keys)
{
return g_hash_table_new_full(nm_str_hash, g_str_equal, NULL, g_free);
return g_hash_table_new_full(nm_str_hash, g_str_equal, static_keys ? NULL : g_free, g_free);
}

View file

@ -222,7 +222,8 @@ void nm_dhcp_option_add_option_in_addr(GHashTable *options,
in_addr_t value);
void
nm_dhcp_option_add_option_u64(GHashTable *options, int addr_family, guint option, guint64 value);
void nm_dhcp_option_add_requests_to_options(GHashTable *options, int addr_family);
GHashTable *nm_dhcp_option_create_options_dict(void);
void nm_dhcp_option_add_requests_to_options(GHashTable *options, int addr_family);
GHashTable *nm_dhcp_option_create_options_dict(gboolean static_keys);
#endif /* __NM_DHCP_OPTIONS_H__ */

View file

@ -86,7 +86,7 @@ lease_to_ip6_config(NMDhcpSystemd *self, sd_dhcp6_lease *lease, gint32 ts, GErro
l3cd = nm_dhcp_client_create_l3cd(NM_DHCP_CLIENT(self));
options = nm_dhcp_option_create_options_dict();
options = nm_dhcp_option_create_options_dict(TRUE);
if (!nm_dhcp_client_get_config(NM_DHCP_CLIENT(self))->v6.info_only) {
gboolean has_any_addresses = FALSE;