Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 May 2026 15:44:11 +0000
From:      Martin Cracauer <cracauer@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d2c21935e866 - main - pxeboot: warn and abort on TCP-only NFS server, which doesn't work for pxeboot
Message-ID:  <6a131ccb.262a1.1bf2c54a@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by cracauer:

URL: https://cgit.FreeBSD.org/src/commit/?id=d2c21935e8666f5e9a38e27701445f5acc82465d

commit d2c21935e8666f5e9a38e27701445f5acc82465d
Author:     Martin Cracauer <cracauer@FreeBSD.org>
AuthorDate: 2026-05-24 15:43:00 +0000
Commit:     Martin Cracauer <cracauer@FreeBSD.org>
CommitDate: 2026-05-24 15:43:00 +0000

    pxeboot: warn and abort on TCP-only NFS server, which doesn't work for pxeboot
    
    When pxeboot gets a 0 as a port number from portmapper (indicating an
    error), it currently happily sends NFS packets to the server's port 0
    in an endless loop. Change this to instead bail out with a useful
    message.
    
    This happens, for example, with recent Linux NFS servers as many
    distributions switched to TCP only NFS serving by default. FreeBSD's
    pxeboot must have UDP. In this situation pxeboot asks the server's
    portmapper for the UDP NFS port and since there is none gets 0.
    
    Also add a hint to the manpage explaining this and how to fix it.
    
    Reviewed by: ziaee, kevans, imp
---
 stand/i386/pxeldr/pxeboot.8 | 8 ++++++++
 stand/libsa/rpc.c           | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/stand/i386/pxeldr/pxeboot.8 b/stand/i386/pxeldr/pxeboot.8
index 496b244cf00f..aa6a5d5c5f7f 100644
--- a/stand/i386/pxeldr/pxeboot.8
+++ b/stand/i386/pxeldr/pxeboot.8
@@ -130,6 +130,14 @@ In all other respects,
 acts just like
 .Xr loader 8 .
 .Pp
+.Nm
+requires NFS over UDP.
+Many recent distributions of Linux only serve NFS over TCP.
+Enable UDP in some distributions by uncommenting
+.Ql udp=y
+in
+.Pa /etc/nfs.conf .
+.Pp
 For further information on Intel's PXE specifications and Wired for
 Management (WfM) systems, see
 .Li http://www.pix.net/software/pxeboot/archive/pxespec.pdf .
diff --git a/stand/libsa/rpc.c b/stand/libsa/rpc.c
index 6b11282a10be..bc5412f1efeb 100644
--- a/stand/libsa/rpc.c
+++ b/stand/libsa/rpc.c
@@ -415,6 +415,11 @@ rpc_getport(struct iodesc *d, n_long prog, n_long vers)
 		return (-1);
 	}
 	port = (int)ntohl(res->port);
+	if (port == 0) {
+		printf("Portmapper returned 0. TCP-only NFS server?\n");
+		free(pkt);
+		return (-1);
+	}
 	free(pkt);
 
 	rpc_pmap_putcache(d->destip, prog, vers, port);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a131ccb.262a1.1bf2c54a>