From 30bbf2278f2b30d4cb67331292c27d09f9a81bf0 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Sun, 19 Nov 2023 21:47:31 +0100 Subject: dhcp-client: T5760: add CLI option to pass user-class parameter Example: set interfaces ethernet eth0 dhcp-options user-class VyOS or set interfaces ethernet eth0 dhcp-options user-class 56:79:4f:53 (cherry picked from commit 260645d0c6ff078cc89601f3a586195902f9c18e) --- data/templates/dhcp-client/ipv4.j2 | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'data/templates') diff --git a/data/templates/dhcp-client/ipv4.j2 b/data/templates/dhcp-client/ipv4.j2 index 4a5d5e54d..77905e054 100644 --- a/data/templates/dhcp-client/ipv4.j2 +++ b/data/templates/dhcp-client/ipv4.j2 @@ -24,6 +24,15 @@ interface "{{ ifname }}" { {% set vendor_class_id = '"' ~ dhcp_options.vendor_class_id ~ '"' %} {% endif %} send vendor-class-identifier {{ vendor_class_id }}; +{% endif %} +{% if dhcp_options.user_class is vyos_defined %} +{% set user_class = dhcp_options.user_class %} +{# Use HEX representation of client-id as it is send in MAC-address style using hex characters. #} +{# If not HEX, use double quotes ASCII format #} +{% if not user_class.split(':') | length >= 3 %} +{% set user_class = '"' ~ dhcp_options.user_class ~ '"' %} +{% endif %} + send user-class {{ user_class }}; {% endif %} # The request statement causes the client to request that any server responding to the # client send the client its values for the specified options. -- cgit v1.2.3