Skip to content

[th/n-dhcp4-max-client-id-len] dhcp: truncate client-id for n-dhcp4 client at arbitrary limit

Thomas Haller requested to merge th/n-dhcp4-max-client-id-len into master

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

Merge request reports