aboutsummaryrefslogtreecommitdiff
path: root/sys/nfs
diff options
context:
space:
mode:
authorAlfredo Dal'Ava Junior <alfredo@FreeBSD.org>2022-05-31 19:03:43 +0000
committerAlfredo Dal'Ava Junior <alfredo@FreeBSD.org>2022-05-31 19:07:27 +0000
commit3cb9f1976c260821e43e6eae9d46e4ec97a8d4f1 (patch)
tree53b5fdcd685626322a7c4f409f4e7929b2c2b169 /sys/nfs
parent9792c7d3eb41dc1e3709e00a98734c3312d1b4fe (diff)
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/bootp_subr.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c
index e64a6b40640c..62fcb06fbc5d 100644
--- a/sys/nfs/bootp_subr.c
+++ b/sys/nfs/bootp_subr.c
@@ -1514,6 +1514,7 @@ bootpc_init(void)
struct thread *td;
int timeout;
int delay;
+ char *s;
timeout = BOOTP_IFACE_WAIT_TIMEOUT * hz;
delay = hz / 10;
@@ -1527,6 +1528,21 @@ bootpc_init(void)
if (nfs_diskless_valid != 0)
return;
+ /*
+ * If "vfs.root.mountfrom" is set and the value is something other
+ * than "nfs:", it means the user doesn't want to mount root via nfs,
+ * there's no reason to continue with bootpc
+ */
+ if ((s = kern_getenv("vfs.root.mountfrom")) != NULL) {
+ if ((strncmp(s, "nfs:", 4)) != 0) {
+ printf("%s: vfs.root.mountfrom set to %s. "
+ "BOOTP aborted.\n", __func__, s);
+ freeenv(s);
+ return;
+ }
+ freeenv(s);
+ }
+
gctx = malloc(sizeof(*gctx), M_TEMP, M_WAITOK | M_ZERO);
STAILQ_INIT(&gctx->interfaces);
gctx->xid = ~0xFFFF;