diff options
author | Simon Rettberg | 2018-07-18 17:11:24 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-07-18 17:11:24 +0200 |
commit | 63641877ec76864e0e3561b31a545edcbd9be0e3 (patch) | |
tree | 5c2dacc914bf774e3ac23ebd9ff4b5b7e0dc390c /core/modules/dhcpc-busybox/data/opt | |
parent | [pvs2] Fix iptables rules even more (diff) | |
download | mltk-63641877ec76864e0e3561b31a545edcbd9be0e3.tar.gz mltk-63641877ec76864e0e3561b31a545edcbd9be0e3.tar.xz mltk-63641877ec76864e0e3561b31a545edcbd9be0e3.zip |
[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.
Diffstat (limited to 'core/modules/dhcpc-busybox/data/opt')
-rwxr-xr-x | core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ | 12 |
1 files changed, 10 insertions, 2 deletions
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" |