dhcp: add and use nm_dhcp_client_create_options_dict()

This will be used to pre-fill the lease with client-specific options.
This commit is contained in:
Thomas Haller 2022-12-12 16:21:31 +01:00
parent ccbe76b81d
commit c020f618ed
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
4 changed files with 15 additions and 3 deletions

View file

@ -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
@ -1613,7 +1623,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);

View file

@ -280,6 +280,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
*****************************************************************************/

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(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;

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(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;