diff options
author | 2008-03-31 22:27:41 +0000 | |
---|---|---|
committer | 2008-03-31 22:27:41 +0000 | |
commit | f0729d1937a3d10645124dc026749e61f60fd781 (patch) | |
tree | 8c8efea1eaddb40cfc4cfb552e1671aae4c391b3 /sys/kern/subr_disk.c | |
parent | Switch bootloaders to mi loadfile(). (diff) | |
download | wireguard-openbsd-f0729d1937a3d10645124dc026749e61f60fd781.tar.xz wireguard-openbsd-f0729d1937a3d10645124dc026749e61f60fd781.zip |
Refine "netboot" interface group semantics to indicate the interface we
booted from to the most precision; preferring the boot device, or if that
is not known, the root device
discussed with miod and reyk
tested by beck
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r-- | sys/kern/subr_disk.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index d0e30cfd706..afcda8e9bef 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.70 2008/03/30 20:24:32 miod Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.71 2008/03/31 22:27:41 deraadt Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -58,6 +58,11 @@ #include <sys/proc.h> #include <uvm/uvm_extern.h> +#include <sys/socket.h> +#include <sys/socketvar.h> + +#include <net/if.h> + #include <dev/rndvar.h> #include <dev/cons.h> @@ -1059,6 +1064,7 @@ setroot(struct device *bootdv, int part, int exitflags) struct swdevt *swp; struct device *rootdv, *dv; dev_t nrootdev, nswapdev = NODEV, temp = NODEV; + struct ifnet *ifp = NULL; char buf[128]; #if defined(NFSCLIENT) extern char *nfsbootdevname; @@ -1197,6 +1203,14 @@ gotswap: rootdv = parsedisk(buf, strlen(buf), 0, &nrootdev); } + if (rootdv && rootdv == bootdv && rootdv->dv_class == DV_IFNET) + ifp = ifunit(rootdv->dv_xname); + else if (bootdv && bootdv->dv_class == DV_IFNET) + ifp = ifunit(bootdv->dv_xname); + + if (ifp) + if_addgroup(ifp, "netboot"); + switch (rootdv->dv_class) { #if defined(NFSCLIENT) case DV_IFNET: |