netboot: Send client architecture and handle path prefix

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 <mihajlov@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Viktor Mihajlovski
2018-06-27 14:55:37 +02:00
committed by Jan Höppner
parent ca30cfd341
commit c856f28e11
2 changed files with 7 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ Release history for s390-tools (MIT version)
Bug Fixes:
- mon_procd: fix parsing of /proc/<pid>/stat
- netboot: Include compressed kernel modules in initramfs
- netboot: Send client architecture and handle path prefix
* __v2.5.0 (2018-06-08)__

View File

@@ -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=""