diff options
author | Thomas Haller <thaller@redhat.com> | 2022-12-12 16:21:31 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-12-19 11:33:43 +0100 |
commit | 34d3898427bc12f87ccf606765c3f2627c4294cf (patch) | |
tree | 2ade6a40078c52ac82417fee97d2ed2de7ce18db | |
parent | 2535395a8cf34ded6d4d5c8d2a25eec6ab1abe1d (diff) | |
download | NetworkManager-34d3898427bc12f87ccf606765c3f2627c4294cf.tar.gz |
dhcp: add and use nm_dhcp_client_create_options_dict()
This will be used to pre-fill the lease with client-specific options.
(cherry picked from commit c020f618ed9446ab163980b2456766a840ed7f65)
-rw-r--r-- | src/core/dhcp/nm-dhcp-client.c | 12 | ||||
-rw-r--r-- | src/core/dhcp/nm-dhcp-client.h | 2 | ||||
-rw-r--r-- | src/core/dhcp/nm-dhcp-nettools.c | 2 | ||||
-rw-r--r-- | src/core/dhcp/nm-dhcp-systemd.c | 2 |
4 files changed, 15 insertions, 3 deletions
diff --git a/src/core/dhcp/nm-dhcp-client.c b/src/core/dhcp/nm-dhcp-client.c index 7f507e2e1c..ffd4bacbc9 100644 --- a/src/core/dhcp/nm-dhcp-client.c +++ b/src/core/dhcp/nm-dhcp-client.c @@ -237,6 +237,16 @@ nm_dhcp_client_create_l3cd(NMDhcpClient *self) NM_IP_CONFIG_SOURCE_DHCP); } +GHashTable * +nm_dhcp_client_create_options_dict(NMDhcpClient *self, gboolean static_keys) +{ + GHashTable *options; + + options = nm_dhcp_option_create_options_dict(static_keys); + + return options; +} + /*****************************************************************************/ void @@ -1612,7 +1622,7 @@ nm_dhcp_client_handle_event(gpointer unused, GVariant *value; /* Copy options */ - str_options = nm_dhcp_option_create_options_dict(FALSE); + str_options = nm_dhcp_client_create_options_dict(self, FALSE); g_variant_iter_init(&iter, options); while (g_variant_iter_next(&iter, "{&sv}", &name, &value)) { maybe_add_option(self, str_options, name, value); diff --git a/src/core/dhcp/nm-dhcp-client.h b/src/core/dhcp/nm-dhcp-client.h index f570e45a75..d57d446e9f 100644 --- a/src/core/dhcp/nm-dhcp-client.h +++ b/src/core/dhcp/nm-dhcp-client.h @@ -279,6 +279,8 @@ GBytes *nm_dhcp_client_get_effective_client_id(NMDhcpClient *self); NML3ConfigData *nm_dhcp_client_create_l3cd(NMDhcpClient *self); +GHashTable *nm_dhcp_client_create_options_dict(NMDhcpClient *self, gboolean static_keys); + /***************************************************************************** * Client data *****************************************************************************/ diff --git a/src/core/dhcp/nm-dhcp-nettools.c b/src/core/dhcp/nm-dhcp-nettools.c index 04bedb878c..df88362e62 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(TRUE); + options = nm_dhcp_client_create_options_dict(NM_DHCP_CLIENT(self), TRUE); if (!lease_parse_address(self, lease, l3cd, iface, options, &lease_address, error)) return NULL; diff --git a/src/core/dhcp/nm-dhcp-systemd.c b/src/core/dhcp/nm-dhcp-systemd.c index 0bed14a82a..7ce15d301e 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(TRUE); + options = nm_dhcp_client_create_options_dict(NM_DHCP_CLIENT(self), TRUE); if (!nm_dhcp_client_get_config(NM_DHCP_CLIENT(self))->v6.info_only) { gboolean has_any_addresses = FALSE; |