summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormvs <mvs@openbsd.org>2020-08-24 10:02:07 +0000
committermvs <mvs@openbsd.org>2020-08-24 10:02:07 +0000
commitf812a5316fbc19b14c154e5d79031dc4b58a4457 (patch)
tree359853eb3a6e4cf2e103b009ec71cd81e80e74f5
parentmerge unbound 1.11.0 (diff)
downloadwireguard-openbsd-f812a5316fbc19b14c154e5d79031dc4b58a4457.tar.xz
wireguard-openbsd-f812a5316fbc19b14c154e5d79031dc4b58a4457.zip
According the code `nfsbootdevname' is always set to network device name
we expected. Remove the `else' path from nfs_boot_init(). If `nfsbootdevname' is not set something goes wrong and this is the panic condition. Also we exclude the case where we can get `ifp' which we don't expect. OK mpi@
-rw-r--r--sys/nfs/nfs_boot.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/nfs/nfs_boot.c b/sys/nfs/nfs_boot.c
index 1263befffc2..22d4f585d36 100644
--- a/sys/nfs/nfs_boot.c
+++ b/sys/nfs/nfs_boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_boot.c,v 1.45 2018/07/30 12:22:14 mpi Exp $ */
+/* $OpenBSD: nfs_boot.c,v 1.46 2020/08/24 10:02:07 mvs Exp $ */
/* $NetBSD: nfs_boot.c,v 1.26 1996/05/07 02:51:25 thorpej Exp $ */
/*
@@ -136,17 +136,9 @@ nfs_boot_init(struct nfs_diskless *nd, struct proc *procp)
/*
* Find a network interface.
*/
- if (nfsbootdevname)
- ifp = ifunit(nfsbootdevname);
- else {
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
- if ((ifp->if_flags &
- (IFF_LOOPBACK|IFF_POINTOPOINT)) == 0)
- break;
- }
- }
- if (ifp == NULL)
+ if (nfsbootdevname == NULL || (ifp = ifunit(nfsbootdevname)) == NULL)
panic("nfs_boot: no suitable interface");
+
bcopy(ifp->if_xname, ireq.ifr_name, IFNAMSIZ);
printf("nfs_boot: using interface %s, with revarp & bootparams\n",
ireq.ifr_name);