From c856f28e11f793a2b0fd5fa273d5f4938deae0d7 Mon Sep 17 00:00:00 2001 From: Viktor Mihajlovski Date: Wed, 27 Jun 2018 14:55:37 +0200 Subject: [PATCH] netboot: Send client architecture and handle path prefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Client architecture aware DHCP configurations may send a bootfile for the wrong architecture, if the DHCP request doesn't include the client architecture identifier 0x001f. Further, the DHCP reply may include the pxepathprefix option, which points to the base directory to use for TFT requests. If the value is not honored by the client, the wrong configuration file, kernel, etc. could be loaded. Both issues are fixed by this commit. Signed-off-by: Viktor Mihajlovski Signed-off-by: Jan Höppner --- CHANGELOG.md | 1 + netboot/mk-pxelinux-ramfs | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9c83d63..69494453 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Release history for s390-tools (MIT version) Bug Fixes: - mon_procd: fix parsing of /proc//stat - netboot: Include compressed kernel modules in initramfs + - netboot: Send client architecture and handle path prefix * __v2.5.0 (2018-06-08)__ diff --git a/netboot/mk-pxelinux-ramfs b/netboot/mk-pxelinux-ramfs index 33e028b6..d89c10a4 100755 --- a/netboot/mk-pxelinux-ramfs +++ b/netboot/mk-pxelinux-ramfs @@ -170,7 +170,7 @@ cat <<'EOF' > $builddir/init /bin/mount -t tmpfs none /run /sbin/modprobe virtio_net -/sbin/udhcpc -O pxeconffile -O pxepathprefix & +/sbin/udhcpc -O pxeconffile -O pxepathprefix -x 93:001F & /sbin/pxeboot.script EOF @@ -237,6 +237,7 @@ case "$1" in echo " router: $router" echo " domain: $domain $dns" echo " tftp: $siaddr" + echo " pxepathprefix: $pxepathprefix" # flush routes /sbin/ip route flush table all # setup if link @@ -272,6 +273,7 @@ case "$1" in echo "siaddr=$siaddr" > $PXECONF echo "interface=$interface" >> $PXECONF echo "ip=$ip" >> $PXECONF + echo "pxepathprefix=$pxepathprefix" >> $PXECONF fi ;; @@ -354,7 +356,7 @@ then for c in $CONFIGS do echo "fetching config pxelinux.cfg/$c from $siaddr" - if /usr/bin/tftp -g -l /tmp/config -r pxelinux.cfg/$c $siaddr + if /usr/bin/tftp -g -l /tmp/config -r ${pxepathprefix}pxelinux.cfg/$c $siaddr then break fi @@ -378,13 +380,13 @@ then exit else echo fetch kernel $kernel from $siaddr - /usr/bin/tftp -g -l /tmp/kernel -r $kernel $siaddr + /usr/bin/tftp -g -l /tmp/kernel -r $pxepathprefix$kernel $siaddr fi if [ -n "$initrd" ] then echo fetch initrd $initrd from $siaddr - /usr/bin/tftp -g -l /tmp/initrd -r $initrd $siaddr + /usr/bin/tftp -g -l /tmp/initrd -r $pxepathprefix$initrd $siaddr INITRD="--initrd=/tmp/initrd" else INITRD=""