mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-20 15:20:42 +02:00
dhcp: truncate client-id for n-dhcp4 client at arbitrary limit
RFC does not define how long the client ID can be. However, n-dhcp4 enforces that the server replies with a client ID that matches the request. Also, the client ID gets encoded as a DHCP option, hence it cannot be longer than 255 bytes. While n-dhcp4 doesn't enforce a certain length, a too long client ID is not going to work. Hence, truncate it at 133 bytes. This is the same limit that also systemd's DHCP client has. It's chosen to fit an RFC4361-complient client ID with a DUID of length MAX_DUID_LEN (which is 128 bytes according to RFC 3315 section 9.1). Fixes-test: @ipv4_set_very_long_dhcp_client_id See-also: https://github.com/nettools/n-dhcp4/pull/6 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/307
This commit is contained in:
parent
907bd28203
commit
7efc3c479f
1 changed files with 3 additions and 1 deletions
|
|
@ -1096,7 +1096,9 @@ nettools_create (NMDhcpNettools *self,
|
|||
n_dhcp4_client_config_set_transport (config, transport);
|
||||
n_dhcp4_client_config_set_mac (config, hwaddr_arr, hwaddr_len);
|
||||
n_dhcp4_client_config_set_broadcast_mac (config, bcast_hwaddr_arr, bcast_hwaddr_len);
|
||||
r = n_dhcp4_client_config_set_client_id (config, client_id_arr, client_id_len);
|
||||
r = n_dhcp4_client_config_set_client_id (config,
|
||||
client_id_arr,
|
||||
NM_MIN (client_id_len, 1 + _NM_SD_MAX_CLIENT_ID_LEN));
|
||||
if (r) {
|
||||
nm_utils_error_set_errno (error, r, "failed to set client-id: %s");
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue