From 70836c5adb4e51bf46f79700b57b9a1437776793 Mon Sep 17 00:00:00 2001
From: Viacheslav <v.gletenko@vyos.io>
Date: Thu, 14 Oct 2021 12:35:17 +0000
Subject: dhclient: T3832: Add hexadecimal format for client-id

The hedadecimal option dhcp-cliend-identifier format is required
to set values without quotes, separated by colons.
---
 data/templates/dhcp-client/ipv4.tmpl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'data')

diff --git a/data/templates/dhcp-client/ipv4.tmpl b/data/templates/dhcp-client/ipv4.tmpl
index c934b7cdb..11e961166 100644
--- a/data/templates/dhcp-client/ipv4.tmpl
+++ b/data/templates/dhcp-client/ipv4.tmpl
@@ -7,7 +7,12 @@ retry 300;
 interface "{{ ifname }}" {
     send host-name "{{ dhcp_options.host_name }}";
 {% if dhcp_options.client_id is defined and dhcp_options.client_id is not none %}
-    send dhcp-client-identifier "{{ dhcp_options.client_id }}";
+{%   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 + '"' %}
+{%   endif %}
+    send dhcp-client-identifier {{ client_id  }};
 {% endif %}
 {% if dhcp_options.vendor_class_id is defined and dhcp_options.vendor_class_id is not none %}
     send vendor-class-identifier "{{ dhcp_options.vendor_class_id }}";
-- 
cgit v1.2.3