Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 May 2005 09:09:28 +0200
From:      Jose M Rodriguez <josemi@freebsd.jazztel.es>
To:        stable@freebsd.org
Cc:        re@freebsd.org
Subject:   Re: MFC pxe fixes
Message-ID:  <200505040909.29085.josemi@redesjm.local>
In-Reply-To: <200504281542.43241.josemi@redesjm.local>
References:  <200504281542.43241.josemi@redesjm.local>

next in thread | previous in thread | raw e-mail | index | archive | help
El Jueves, 28 de Abril de 2005 15:42, Jose M Rodriguez escribi=F3:
> Hi,
>
> I note that the long standing bug that prevents do a nfsroot mount
> after operate pxeloader in tftp mode is recent solved in -CURRENT
> pxe.c
>
> I think this can be missed for 5.4 REL, but I'll be glad to see this
> MFC as time permitting.
>

I pointing to changes in revs 1.21 and 1.22 of=20
src/sys/boot/i386/libi386/pxe.c

In special, rev 1.21, from kan, 7 weeks ago.

I can't see this breaking any ABI, but making things work as documented. =20
Tested on RELENG_5_4 as attached patch

=2D-
  josemi

=2D-- pxe.diff begins here ---
Index: pxe.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/cvs/freebsd/src/sys/boot/i386/libi386/pxe.c,v
retrieving revision 1.20
diff -u -r1.20 pxe.c
=2D-- pxe.c	25 Aug 2003 23:28:31 -0000	1.20
+++ pxe.c	28 Apr 2005 17:49:35 -0000
@@ -27,7 +27,7 @@
  */
=20
 #include <sys/cdefs.h>
=2D__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/pxe.c,v 1.20 2003/08/25=20
23:28:31 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/pxe.c,v 1.22 2005/04/17=20
21:38:22 wollman Exp $");
=20
 #include <stand.h>
 #include <string.h>
@@ -308,6 +308,7 @@
 		}
 		setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
 		setenv("boot.nfsroot.path", rootpath, 1);
+		setenv("dhcp.host-name", hostname, 1);
 	}
     }
     pxe_opens++;
@@ -413,6 +414,22 @@
 	/* structure truncated here */
 };
 extern struct	nfs_iodesc nfs_root_node;
+extern int      rpc_port;
+
+static void
+pxe_rpcmountcall()
+{
+	struct	iodesc *d;
+	int     error;
+
+	if (!(d =3D socktodesc(pxe_sock)))
+		return;
+        d->myport =3D htons(--rpc_port);
+        d->destip =3D rootip;
+	if ((error =3D nfs_getrootfh(d, rootpath, nfs_root_node.fh)) !=3D 0)=20
+		printf("NFS MOUNT RPC error: %d\n", error);
+	nfs_root_node.iodesc =3D d;
+}
=20
 static void
 pxe_setnfshandle(char *rootpath)
@@ -421,6 +438,14 @@
 	u_char	*fh;
 	char	buf[2 * NFS_FHSIZE + 3], *cp;
=20
+	/*
+	 * If NFS files were never opened, we need to do mount call
+	 * ourselves. Use nfs_root_node.iodesc as flag indicating
+	 * previous NFS usage.
+	 */
+	if (nfs_root_node.iodesc =3D=3D NULL)
+		pxe_rpcmountcall();
+
 	fh =3D &nfs_root_node.fh[0];
 	buf[0] =3D 'X';
 	cp =3D &buf[1];
=2D-- pxe.diff ends here ---



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200505040909.29085.josemi>