summaryrefslogtreecommitdiff
path: root/scripts/init/vyos-router
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-10-24 21:20:44 +0200
committerChristian Poessinger <christian@poessinger.com>2021-10-24 21:22:18 +0200
commit3c600cab7ca96a3aafdaa802266e04ef93e2a602 (patch)
tree350b1a9ddfa65adf703332e5a127d7a3097014ab /scripts/init/vyos-router
parent71d9aca5c4d898649bbba429c7337eaf5514f2e0 (diff)
downloadvyatta-cfg-3c600cab7ca96a3aafdaa802266e04ef93e2a602.tar.gz
vyatta-cfg-3c600cab7ca96a3aafdaa802266e04ef93e2a602.zip
vyos-router: dhcpv6: T3885: add alternative UUID source
Not all boards/devices ship the /sys/class/dmi/id/product_uuid file, thus a fallback is used (e.g. on PCEngines APU4 board) which feeds the device specific UUID from /sys/class/dmi/id/product_serial (cherry picked from commit 224941480bb5e41ee6b43e3bf0f357568f18d44f)
Diffstat (limited to 'scripts/init/vyos-router')
-rwxr-xr-xscripts/init/vyos-router6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/init/vyos-router b/scripts/init/vyos-router
index 7863bd9..2582736 100755
--- a/scripts/init/vyos-router
+++ b/scripts/init/vyos-router
@@ -178,12 +178,16 @@ gen_duid ()
{
DUID_FILE="/var/lib/dhcpv6/dhcp6c_duid"
UUID_FILE="/sys/class/dmi/id/product_uuid"
- if [ ! -f ${UUID_FILE} ]; then
+ UUID_FILE_ALT="/sys/class/dmi/id/product_serial"
+ if [ ! -f ${UUID_FILE} ] && [ ! -f ${UUID_FILE_ALT} ]; then
return 1
fi
# DUID is based on the BIOS/EFI UUID. We omit additional - characters
UUID=$(cat ${UUID_FILE} | tr -d -)
+ if [ -z ${UUID} ]; then
+ UUID=$(uuidgen --sha1 --namespace @dns --name $(cat ${UUID_FILE_ALT}) | tr -d -)
+ fi
# Add DUID type4 (UUID) information
DUID_TYPE="0004"