From 63641877ec76864e0e3561b31a545edcbd9be0e3 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 18 Jul 2018 17:11:24 +0200 Subject: [rfs-*] Use SMBIOS UUID as UID for DHCP requests This is what the PXE rom does, so by using the same uid we make sure that we keep the same address in case the client is running in a dynamic address pool. --- .../dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'core/modules/dhcpc-busybox') diff --git a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ index 2f8b878d..4548d1d1 100755 --- a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ +++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ @@ -4,7 +4,15 @@ NET_IF="$1" NET_IP="$(ip addr show dev "${NET_IF}" | grep -m1 '^\s*inet ' | awk -F " " '{print $2}' | awk -F "/" '{print $1}')" UDHCPC_OPTS="" -[ ! -z "$NET_IP" ] && UDHCPC_OPTS=" -r $NET_IP" +if [ -n "$NET_IP" ]; then + UDHCPC_OPTS="$UDHCPC_OPTS -r $NET_IP" +fi + +UID=$(dmidecode -s system-uuid | sed -r 's/^(..)(..)(..)(..)-(..)(..)-(..)(..)-(....)-/00\4\3\2\1\6\5\8\7\9/') +if [ "${#UID}" = 34 ]; then + echo "Using SMBIOS UID for DHCP" + UDHCPC_OPTS="$UDHCPC_OPTS -x 0x3d:$UID" +fi mkdir -p /run/udhcpc || echo "Could not create '/run/udhcpc'." @@ -12,7 +20,7 @@ mkdir -p /run/udhcpc || echo "Could not create '/run/udhcpc'." RET=$? if [ "$RET" != 0 ]; then - slxlog "udhcpc" "Could not run 'udhcpc${UDHCPC_OPTS}' on ${NET_IF}." + slxlog "udhcpc" "Could not run 'udhcpc ${UDHCPC_OPTS}' on ${NET_IF}." fi exit "$RET" -- cgit v1.2.3-55-g7522