diff options
author | Daniil Baturin <daniil@vyos.io> | 2023-11-22 00:08:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-22 00:08:43 +0000 |
commit | d1750790419d9db3e4d71974005190752c7928e0 (patch) | |
tree | 9f6521de731c1617d7a66062836dd20a1cf5a6e0 /data | |
parent | 916adfaf0774df0731522bf3cbd886d794735c50 (diff) | |
parent | 30bbf2278f2b30d4cb67331292c27d09f9a81bf0 (diff) | |
download | vyos-1x-d1750790419d9db3e4d71974005190752c7928e0.tar.gz vyos-1x-d1750790419d9db3e4d71974005190752c7928e0.zip |
Merge pull request #2510 from vyos/mergify/bp/sagitta/pr-2506
dhcp-client: T5760: add CLI option to pass user-class parameter (backport #2506)
Diffstat (limited to 'data')
-rw-r--r-- | data/templates/dhcp-client/ipv4.j2 | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/data/templates/dhcp-client/ipv4.j2 b/data/templates/dhcp-client/ipv4.j2 index cc5ddf09c..77905e054 100644 --- a/data/templates/dhcp-client/ipv4.j2 +++ b/data/templates/dhcp-client/ipv4.j2 @@ -9,14 +9,30 @@ interface "{{ ifname }}" { send host-name "{{ dhcp_options.host_name }}"; {% if dhcp_options.client_id is vyos_defined %} {% set client_id = dhcp_options.client_id %} -{# 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 dhcp_options.client_id.split(':') | length >= 5 %} -{% set client_id = '"' + dhcp_options.client_id + '"' %} +{# 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 client_id.split(':') | length >= 3 %} +{% set client_id = '"' ~ dhcp_options.client_id ~ '"' %} {% endif %} send dhcp-client-identifier {{ client_id }}; {% endif %} {% if dhcp_options.vendor_class_id is vyos_defined %} - send vendor-class-identifier "{{ dhcp_options.vendor_class_id }}"; +{% set vendor_class_id = dhcp_options.vendor_class_id %} +{# 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 vendor_class_id.split(':') | length >= 3 %} +{% 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. |