diff options
author | Christian Breunig <christian@breunig.cc> | 2023-11-19 21:47:31 +0100 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2023-11-19 21:47:31 +0100 |
commit | 260645d0c6ff078cc89601f3a586195902f9c18e (patch) | |
tree | c1f0e44978b0f3186d08344647088fb40ae6e1d4 /data/templates/dhcp-client | |
parent | bed1cd01904ef89b5d31bd47de0f230214900f16 (diff) | |
download | vyos-1x-260645d0c6ff078cc89601f3a586195902f9c18e.tar.gz vyos-1x-260645d0c6ff078cc89601f3a586195902f9c18e.zip |
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
Diffstat (limited to 'data/templates/dhcp-client')
-rw-r--r-- | data/templates/dhcp-client/ipv4.j2 | 9 |
1 files changed, 9 insertions, 0 deletions
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 @@ -25,6 +25,15 @@ interface "{{ ifname }}" { {% 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. request subnet-mask, broadcast-address,{{ " routers," if dhcp_options.no_default_route is not vyos_defined }} domain-name-servers, |