Skip to content

Commit 1253b16

Browse files
gupurushgupurush
authored andcommitted
Fixed dhcp Option 60 encoding
1 parent 6e37b4b commit 1253b16

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

files/dhcp/dhclient.conf.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ option provisioning-script-url code 239 = text;
2828
option dhcp6.user-class code 15 = text;
2929
option dhcp6.provisioning-script-url code 239 = text;
3030
option dhcp6.boot-file-url code 59 = text;
31+
option vendor-class code 60 = text;
3132

3233
send host-name = gethostname();
3334
request subnet-mask, broadcast-address, time-offset, routers,
@@ -43,3 +44,5 @@ send dhcp6.user-class "SONiC-ZTP";
4344
send dhcp-client-identifier "SONiC##{{ ZTP['mode']['product-name'] }}##{{ ZTP['mode']['serial-no'] }}";
4445
retry 60;
4546
{% endif %}
47+
48+
send vendor-class "{{VENDOR_NAME}}:{{PRODUCT_NAME}}";

files/image_config/interfaces/interfaces-config.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@ else
6363
echo "{ \"ZTP_DHCP_DISABLED\" : \"true\" }" > /tmp/ztp_input.json
6464
fi
6565

66+
VENDOR_NAME=$(decode-syseeprom -v | tr -dc '[[:print:]]')
67+
PRODUCT_NAME=$(decode-syseeprom -p | tr -dc '[[:print:]]')
6668
# Create /e/n/i file for existing and active interfaces, dhcp6 sytcl.conf and dhclient.conf
67-
CFGGEN_PARAMS=" \
69+
sonic-cfggen -a "{\"VENDOR_NAME\": \"${VENDOR_NAME}\", \
70+
\"PRODUCT_NAME\":\"{$PRODUCT_NAME}\"}" \
6871
-d -j /tmp/ztp_input.json \
6972
-t /usr/share/sonic/templates/interfaces.j2,/etc/network/interfaces \
7073
-t /usr/share/sonic/templates/90-dhcp6-systcl.conf.j2,/etc/sysctl.d/90-dhcp6-systcl.conf \
71-
-t /usr/share/sonic/templates/dhclient.conf.j2,/etc/dhcp/dhclient.conf \
72-
"
73-
sonic-cfggen $CFGGEN_PARAMS
74+
-t /usr/share/sonic/templates/dhclient.conf.j2,/etc/dhcp/dhclient.conf
7475

7576
[[ -f /var/run/dhclient.eth0.pid ]] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid
7677
[[ -f /var/run/dhclient6.eth0.pid ]] && kill `cat /var/run/dhclient6.eth0.pid` && rm -f /var/run/dhclient6.eth0.pid

0 commit comments

Comments
 (0)