summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-12-13 08:31:16 +0100
committerThomas Haller <thaller@redhat.com>2022-12-19 11:29:12 +0100
commit492818b52940f70d4fd7c553c07770030b56de2e (patch)
tree7a84452182f4a8bcbf06f03274743fc6f49a9486
parent84b90fbdd38aa6b39a7ac018e9216aecbb6f298c (diff)
downloadNetworkManager-492818b52940f70d4fd7c553c07770030b56de2e.tar.gz
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.
-rw-r--r--src/core/dhcp/nm-dhcp-nettools.c2
-rw-r--r--src/core/dhcp/nm-dhcp-options.c4
-rw-r--r--src/core/dhcp/nm-dhcp-options.h5
-rw-r--r--src/core/dhcp/nm-dhcp-systemd.c2
4 files changed, 7 insertions, 6 deletions
diff --git a/src/core/dhcp/nm-dhcp-nettools.c b/src/core/dhcp/nm-dhcp-nettools.c
index 12f5620547..38a8686c1f 100644
--- a/src/core/dhcp/nm-dhcp-nettools.c
+++ b/src/core/dhcp/nm-dhcp-nettools.c
@@ -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;
diff --git a/src/core/dhcp/nm-dhcp-options.c b/src/core/dhcp/nm-dhcp-options.c
index 9831765601..d95fe01658 100644
--- a/src/core/dhcp/nm-dhcp-options.c
+++ b/src/core/dhcp/nm-dhcp-options.c
@@ -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);
}
diff --git a/src/core/dhcp/nm-dhcp-options.h b/src/core/dhcp/nm-dhcp-options.h
index bdad8c94e8..fcc6f9cd08 100644
--- a/src/core/dhcp/nm-dhcp-options.h
+++ b/src/core/dhcp/nm-dhcp-options.h
@@ -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__ */
diff --git a/src/core/dhcp/nm-dhcp-systemd.c b/src/core/dhcp/nm-dhcp-systemd.c
index af7f6c3244..c415ca63f3 100644
--- a/src/core/dhcp/nm-dhcp-systemd.c
+++ b/src/core/dhcp/nm-dhcp-systemd.c
@@ -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;