summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2009-06-06 07:57:28 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2009-06-06 07:57:28 +0000
commitd34138cae376a2b9b00d469124798b9fb695c64a (patch)
tree7a43025ba70acc4edb00b3c3253996d40121adae
parent29c64955e22701fd41fb56911397f0d7a5a1389f (diff)
In SIOCS80211SCAN, fail if the interface is not up *and* running.
There are cases where the interface can be up but not running, for instance if the driver's if_init routine fails halfway for whatever reason (firmware file not found, hardware switch turned off etc...) This is because in sys/net/if.c, the returned code of the driver is ignored for SIOCSIFFLAGS and the IFF_UP flags is left set. netintro(4) does not say anything about values returned by SIOCSIFFLAGS, so I don't know whether it is the expected behavior or not. pointed out by halex@ and jacekm@ who noticed it was possible to trigger a scan on wpi(4) even when the hardware switch was turned off.
-rw-r--r--sys/net80211/ieee80211_ioctl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 7f2a978f16a..d79c9afcd3f 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_ioctl.c,v 1.31 2009/02/15 08:34:36 damien Exp $ */
+/* $OpenBSD: ieee80211_ioctl.c,v 1.32 2009/06/06 07:57:27 damien Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */
/*-
@@ -628,7 +628,8 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
break;
#endif
- if ((ifp->if_flags & IFF_UP) == 0) {
+ if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
+ (IFF_UP | IFF_RUNNING)) {
error = ENETDOWN;
break;
}