From 519740bc2ebcc40e8e61b547b2b49e26efb53bb2 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 13 Mar 2019 15:04:02 +0100 Subject: [rootfs-stage31/dhcpc-busybox] Back to old DHCP behavior Since the PXE spec abolished th practive of having the PXE ROM set the uid field of the DHCP request to the system's UUID, we also shouldn't be doing it. Make it a KCL option called dhcpuuid. --- .../dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ | 2 +- core/rootfs/rootfs-stage31/data/inc/parse_kcl | 4 ++++ core/rootfs/rootfs-stage31/data/inc/setup_network | 12 +++++++----- 3 files changed, 12 insertions(+), 6 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 4487b2c8..7d7dfc68 100755 --- a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ +++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ @@ -13,7 +13,7 @@ fi primary="br0" [ -n "$SLX_BRIDGE" ] && primary="$SLX_BRIDGE" -if [ "$primary" = "$net_if" ]; then +if [ "$primary" = "$net_if" ] && [ "$SLX_NET_DHCP_UUID" = "yes" ]; then 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" diff --git a/core/rootfs/rootfs-stage31/data/inc/parse_kcl b/core/rootfs/rootfs-stage31/data/inc/parse_kcl index e0f5a752..95f7daf5 100644 --- a/core/rootfs/rootfs-stage31/data/inc/parse_kcl +++ b/core/rootfs/rootfs-stage31/data/inc/parse_kcl @@ -47,6 +47,10 @@ for opts in ${KCL}; do GFX=amdgpu ;; radeon) GFX=radeon ;; + dhcpuuid) + USE_DHCP_UUID=yes + echo "SLX_NET_DHCP_UUID='yes'" >> "/run/config" + ;; esac done diff --git a/core/rootfs/rootfs-stage31/data/inc/setup_network b/core/rootfs/rootfs-stage31/data/inc/setup_network index 6787027d..1f7b2ec0 100644 --- a/core/rootfs/rootfs-stage31/data/inc/setup_network +++ b/core/rootfs/rootfs-stage31/data/inc/setup_network @@ -102,10 +102,12 @@ if [ -n "$GATEWAY" ]; then echo -n "$GATEWAY" > "/run/firstgw" 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" - PARAM="$PARAM -x 0x3d:$UID" +if [ "$USE_DHCP_UUID" = "yes" ]; then + 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" + PARAM="$PARAM -x 0x3d:$UID" + fi fi # save our variables for retry on fail ff. @@ -114,7 +116,7 @@ echo "GATEWAY=$GATEWAY" >> /run/network.conf echo "BRIDGE=$BRIDGE" >> /run/network.conf echo "UID=$UID" >> /run/network.conf -udhcpc $PARAM -x "0x3d:$UID" -O ntpsrv -O domain -O wpad -O search -t 4 -T 3 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE" +udhcpc $PARAM -O ntpsrv -O domain -O wpad -O search -t 4 -T 3 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE" URET=$? # udhcpc return value will be return value of this script [ -z "$CLIENTIP" ] && CLIENTIP=$(cat /run/firstip) -- cgit v1.2.3-55-g7522