diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-03-31 22:27:44 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-03-31 22:27:44 +0000 |
commit | efc5bb557d06da81f2f64af5355b44544bed7c5d (patch) | |
tree | 6fd725894bc021fe6c14eaf5448a53b0c48b68e1 /sys/kern/subr_disk.c | |
parent | 1eece723201592688a98dd2c3fff9b70d644f0d2 (diff) |
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: |