summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2014-03-30 19:48:04 +0000
committermiod <miod@openbsd.org>2014-03-30 19:48:04 +0000
commitce6e32ecc417dcd01a5eb7478b2b0fb5853d34fa (patch)
treee879d5921f52916a6aff1515cd51b7459daa9ffc
parentImplement the roff(7) .ll (line length) request. (diff)
downloadwireguard-openbsd-ce6e32ecc417dcd01a5eb7478b2b0fb5853d34fa.tar.xz
wireguard-openbsd-ce6e32ecc417dcd01a5eb7478b2b0fb5853d34fa.zip
Close the kernel fd before attempting to load /etc/random.seed, and reopen it
afterwards, for some prom misbehave if the network interface is opened twice; repairs boot.net operation on at least SS5 PROM v2.21; found the hard way by sebastia@. Crank boot version; verified not to hurt disk boot.
-rw-r--r--sys/arch/sparc/stand/boot/boot.c12
-rw-r--r--sys/arch/sparc/stand/common/version.c5
2 files changed, 14 insertions, 3 deletions
diff --git a/sys/arch/sparc/stand/boot/boot.c b/sys/arch/sparc/stand/boot/boot.c
index 8fa6a1096f7..a5f80f0268d 100644
--- a/sys/arch/sparc/stand/boot/boot.c
+++ b/sys/arch/sparc/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.11 2014/02/25 21:28:30 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.12 2014/03/30 19:48:04 miod Exp $ */
/* $NetBSD: boot.c,v 1.2 1997/09/14 19:27:21 pk Exp $ */
/*-
@@ -192,8 +192,18 @@ loadk(char *file, u_long *marks)
* one.
*/
if (rnd_loaded == 0) {
+ /*
+ * Some PROM do not like having a network device
+ * open()ed twice; better close and reopen after
+ * trying to get randomness.
+ */
+ close(fd);
+
rnd_loaded = loadrandom(BOOTRANDOM, rnddata,
sizeof(rnddata));
+
+ if ((fd = open(file, O_RDONLY)) < 0)
+ return (errno ? errno : ENOENT);
}
flags = LOAD_KERNEL;
diff --git a/sys/arch/sparc/stand/common/version.c b/sys/arch/sparc/stand/common/version.c
index e269f0e2d33..565b5789bc3 100644
--- a/sys/arch/sparc/stand/common/version.c
+++ b/sys/arch/sparc/stand/common/version.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: version.c,v 1.8 2014/02/25 21:28:30 miod Exp $ */
+/* $OpenBSD: version.c,v 1.9 2014/03/30 19:48:04 miod Exp $ */
/* $NetBSD: version.c,v 1.4 1995/09/16 23:20:39 pk Exp $ */
/*
@@ -48,6 +48,7 @@
* 2.6 Support for larger kernels when booting from tape, and avoid
* stomping on PROM data below 4MB on sun4c
* 2.7 /etc/random.seed support
+ * 2.8 Fix network boot broken on some PROM by the 2.7 changes
*/
-char *version = "2.7";
+char *version = "2.8";