mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 07:50:17 +01:00
dhcp: implement dhcp-vendor-class-identifier option for systemd's DHCP
client https://bugzilla.redhat.com/show_bug.cgi?id=1871042 Signed-off-by: Antonio Cardace <acardace@redhat.com>
This commit is contained in:
parent
f8a7290153
commit
5da0939a3f
1 changed files with 19 additions and 0 deletions
|
|
@ -569,6 +569,7 @@ ip4_start (NMDhcpClient *client,
|
|||
int arp_type;
|
||||
GBytes *client_id;
|
||||
gs_unref_bytes GBytes *client_id_new = NULL;
|
||||
GBytes *vendor_class_identifier;
|
||||
const uint8_t *client_id_arr;
|
||||
size_t client_id_len;
|
||||
struct in_addr last_addr = { 0 };
|
||||
|
|
@ -698,6 +699,24 @@ ip4_start (NMDhcpClient *client,
|
|||
}
|
||||
}
|
||||
|
||||
vendor_class_identifier = nm_dhcp_client_get_vendor_class_identifier (client);
|
||||
if (vendor_class_identifier) {
|
||||
const char *option_data;
|
||||
gsize len;
|
||||
|
||||
option_data = g_bytes_get_data (vendor_class_identifier, &len);
|
||||
nm_assert (option_data);
|
||||
nm_assert (len <= 255);
|
||||
|
||||
option_data = nm_strndup_a (300, option_data, len, NULL);
|
||||
|
||||
r = sd_dhcp_client_set_vendor_class_identifier (sd_client, option_data);
|
||||
if (r < 0) {
|
||||
nm_utils_error_set_errno (error, r, "failed to set DHCP vendor class identifier: %s");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
r = sd_dhcp_client_set_callback (sd_client, dhcp_event_cb, client);
|
||||
if (r < 0) {
|
||||
nm_utils_error_set_errno (error, r, "failed to set callback: %s");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue