summaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_ioctl.c
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2008-08-27 09:05:05 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2008-08-27 09:05:05 +0000
commitae8d786435a0cd5b546644a9f5e3592c26c022e5 (patch)
tree3e8cc621792a9e7e11267f6eb127006e3f4e5810 /sys/net80211/ieee80211_ioctl.c
parent667d3188711dacb1f8a406d01c9c42412ed0c710 (diff)
introduce new IEEE80211_STA_ONLY kernel option that can be set to
remove IBSS and HostAP support from net80211 and 802.11 drivers. it can be used to shrink RAMDISK kernels for instance (like what was done for wi(4)). it also has the benefit of highlighting what is specific to IBSS and HostAP modes in the code. the cost is that we now have two code paths to maintain.
Diffstat (limited to 'sys/net80211/ieee80211_ioctl.c')
-rw-r--r--sys/net80211/ieee80211_ioctl.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 4445b113d5d..c1e799fe52a 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_ioctl.c,v 1.22 2008/08/12 19:29:07 damien Exp $ */
+/* $OpenBSD: ieee80211_ioctl.c,v 1.23 2008/08/27 09:05:04 damien Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */
/*-
@@ -473,8 +473,10 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ic->ic_flags |= IEEE80211_F_DESBSSID;
IEEE80211_ADDR_COPY(ic->ic_des_bssid, bssid->i_bssid);
}
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
break;
+#endif
switch (ic->ic_state) {
case IEEE80211_S_INIT:
case IEEE80211_S_SCAN:
@@ -493,10 +495,13 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
switch (ic->ic_state) {
case IEEE80211_S_INIT:
case IEEE80211_S_SCAN:
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
IEEE80211_ADDR_COPY(bssid->i_bssid,
ic->ic_myaddr);
- else if (ic->ic_flags & IEEE80211_F_DESBSSID)
+ else
+#endif
+ if (ic->ic_flags & IEEE80211_F_DESBSSID)
IEEE80211_ADDR_COPY(bssid->i_bssid,
ic->ic_des_bssid);
else
@@ -599,8 +604,10 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCS80211SCAN:
if ((error = suser(curproc, 0)) != 0)
break;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
break;
+#endif
if ((ifp->if_flags & IFF_UP) == 0) {
error = ENETDOWN;
break;
@@ -628,10 +635,12 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCS80211NODE:
if ((error = suser(curproc, 0)) != 0)
break;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
error = EINVAL;
break;
}
+#endif
nr = (struct ieee80211_nodereq *)data;
ni = ieee80211_find_node(ic, nr->nr_macaddr);
@@ -691,7 +700,9 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case SIOCG80211FLAGS:
flags = ic->ic_flags;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+#endif
flags &= ~IEEE80211_F_HOSTAPMASK;
ifr->ifr_flags = flags >> IEEE80211_F_USERSHIFT;
break;
@@ -699,11 +710,13 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((error = suser(curproc, 0)) != 0)
break;
flags = (u_int32_t)ifr->ifr_flags << IEEE80211_F_USERSHIFT;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
(flags & IEEE80211_F_HOSTAPMASK)) {
error = EINVAL;
break;
}
+#endif
ic->ic_flags = (ic->ic_flags & ~IEEE80211_F_USERMASK) | flags;
error = ENETRESET;
break;