dhcp: implement dhcp-vendor-class-identifier option for internal DHCP client

https://bugzilla.redhat.com/show_bug.cgi?id=1871042
Signed-off-by: Antonio Cardace <acardace@redhat.com>
This commit is contained in:
Antonio Cardace 2020-08-24 18:14:04 +02:00
parent f71f40bc20
commit f8a7290153
No known key found for this signature in database
GPG key ID: 6BF80ABD43E377D3

View file

@ -1333,6 +1333,7 @@ ip4_start (NMDhcpClient *client,
struct in_addr last_addr = { 0 };
const char *hostname;
const char *mud_url;
GBytes *vendor_class_identifier;
int r, i;
g_return_val_if_fail (!priv->probe, FALSE);
@ -1454,6 +1455,25 @@ ip4_start (NMDhcpClient *client,
}
}
vendor_class_identifier = nm_dhcp_client_get_vendor_class_identifier (client);
if (vendor_class_identifier) {
const void *option_data;
gsize option_size;
option_data = g_bytes_get_data (vendor_class_identifier, &option_size);
nm_assert (option_data);
nm_assert (option_size <= 255);
r = n_dhcp4_client_probe_config_append_option (config,
NM_DHCP_OPTION_DHCP4_VENDOR_CLASS_IDENTIFIER,
option_data,
option_size);
if (r) {
set_error_nettools (error, r, "failed to set vendor class identifier");
return FALSE;
}
}
g_free (priv->lease_file);
priv->lease_file = g_steal_pointer (&lease_file);