]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
tftpd: Run with mapfile
authoralberand <albershteyn.andrey@gmail.com>
Wed, 24 Feb 2021 17:16:06 +0000 (18:16 +0100)
committerMichal Sojka <michal.sojka@cvut.cz>
Mon, 28 Jun 2021 06:18:02 +0000 (08:18 +0200)
This mapfile is needed as some pxeclient add zero byte \x00 to the end
of the filename. This is a known bug. The mapfile contains rule to
remove that byte.

novaboot

index 5e8ed5462642e78567c23077f17ffd0398a655e9..d6a60edc6aa376dc9192e670f0b1ef1cd06debf8 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -1151,9 +1151,15 @@ host server {
 
 if (defined $dhcp_tftp || defined $tftp) {
     $tftp_port ||= 69;
+    # Generate TFTP mapfile
+    open(my $fh, '>', "$builddir/mapfile");
+    print $fh "# Some PXE clients (mainly UEFI) have bug. They add zero byte to the end of the
+# path name. This rule removes it
+r     \\.efi.*   \\.efi";
+    close($fh);
     # Unfortunately, tftpd requires root privileges even with
     # non-privileged (>1023) port due to initgroups().
-    system_verbose("sudo in.tftpd --listen --secure -v -v -v --pidfile tftpd.pid  --address :$tftp_port $builddir");
+    system_verbose("sudo in.tftpd --listen --secure -v -v -v --pidfile tftpd.pid -m mapfile --address :$tftp_port $builddir");
 
     # Kill server when we die
     $SIG{__DIE__} = sub { system_verbose('sudo pkill --pidfile=dhcpd.pid') if (defined $dhcp_tftp);