diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-10-24 21:20:44 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-10-24 21:20:44 +0200 |
commit | 224941480bb5e41ee6b43e3bf0f357568f18d44f (patch) | |
tree | fde1f1ccb5060d6ea84dbd310e06d201a11cfb55 | |
parent | 6a94fc44e95735b9f6bd4fc162c3775b902dc0eb (diff) | |
download | vyatta-cfg-224941480bb5e41ee6b43e3bf0f357568f18d44f.tar.gz vyatta-cfg-224941480bb5e41ee6b43e3bf0f357568f18d44f.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
-rw-r--r-- | debian/control | 1 | ||||
-rwxr-xr-x | scripts/init/vyos-router | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/debian/control b/debian/control index 0d821c5..f5b686d 100644 --- a/debian/control +++ b/debian/control @@ -19,6 +19,7 @@ Depends: sed (>= 4.1.5), libvyatta-cfg1 (>=${binary:Version}), unionfs-fuse, systemd, + uuid-runtime, libboost-filesystem1.67.0 | libboost-filesystem1.74.0, libapt-pkg4.12 | libapt-pkg5.0 | libapt-pkg6.0, ${perl:Depends}, ${shlibs:Depends} diff --git a/scripts/init/vyos-router b/scripts/init/vyos-router index bc0517c..c6d84a6 100755 --- a/scripts/init/vyos-router +++ b/scripts/init/vyos-router @@ -231,12 +231,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" |