diff options
author | Antonio Cardace <acardace@redhat.com> | 2020-08-24 18:14:04 +0200 |
---|---|---|
committer | Antonio Cardace <acardace@redhat.com> | 2020-08-26 09:44:10 +0200 |
commit | f8a729015380b367bd2ecff66f31cb6253793e50 (patch) | |
tree | 74a1700da9da741b8c1b72d8da30d4db0f46bd1c | |
parent | f71f40bc20ea085bf49f2a31fed5476bce0eee91 (diff) | |
download | NetworkManager-f8a729015380b367bd2ecff66f31cb6253793e50.tar.gz |
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>
-rw-r--r-- | src/dhcp/nm-dhcp-nettools.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c index 2ceed09537..ec24a77f42 100644 --- a/src/dhcp/nm-dhcp-nettools.c +++ b/src/dhcp/nm-dhcp-nettools.c @@ -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); |