summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_proto.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2003-07-20 21:36:08 +0000
committersam <sam@FreeBSD.org>2003-07-20 21:36:08 +0000
commit51c8bf1aebf18e644d2c3354aa5e0e5048baab1e (patch)
tree6b4b08b659abfee0261b08146037555ec5351239 /sys/net80211/ieee80211_proto.c
parent6d201c6f71fac3e288a6c52e28186f84237bdb36 (diff)
downloadFreeBSD-src-51c8bf1aebf18e644d2c3354aa5e0e5048baab1e.zip
FreeBSD-src-51c8bf1aebf18e644d2c3354aa5e0e5048baab1e.tar.gz
o change ieee80211_new_state handling to use a proper method that drivers
override in their sub-class; this eliminates the hack of interpreting the EINPROGRESS return value to mean "don't do any of the normal work" o correct active scanning so the first channel is only scanned once and so per-channel passive mode is properly honored o expose 802.11 FSM state names so every driver doesn't keep a private copy o eliminate node parameter to ieee80211_begin_scan; it was not being used
Diffstat (limited to 'sys/net80211/ieee80211_proto.c')
-rw-r--r--sys/net80211/ieee80211_proto.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c
index 7445dae..5520597 100644
--- a/sys/net80211/ieee80211_proto.c
+++ b/sys/net80211/ieee80211_proto.c
@@ -78,6 +78,15 @@ const char *ieee80211_mgt_subtype_name[] = {
"beacon", "atim", "disassoc", "auth",
"deauth", "reserved#13", "reserved#14", "reserved#15"
};
+const char *ieee80211_state_name[IEEE80211_S_MAX] = {
+ "INIT", /* IEEE80211_S_INIT */
+ "SCAN", /* IEEE80211_S_SCAN */
+ "AUTH", /* IEEE80211_S_AUTH */
+ "ASSOC", /* IEEE80211_S_ASSOC */
+ "RUN" /* IEEE80211_S_RUN */
+};
+
+static int ieee80211_newstate(struct ieee80211com *, enum ieee80211_state, int);
void
ieee80211_proto_attach(struct ifnet *ifp)
@@ -96,6 +105,9 @@ ieee80211_proto_attach(struct ifnet *ifp)
mtx_init(&ic->ic_mgtq.ifq_mtx, ifp->if_name, "mgmt send q", MTX_DEF);
+ /* protocol state change handler */
+ ic->ic_newstate = ieee80211_newstate;
+
/* initialize management frame handlers */
ic->ic_recv_mgmt = ieee80211_recv_mgmt;
ic->ic_send_mgmt = ieee80211_send_mgmt;
@@ -275,30 +287,17 @@ ieee80211_fix_rate(struct ieee80211com *ic, struct ieee80211_node *ni, int flags
#undef RV
}
-int
-ieee80211_new_state(struct ifnet *ifp, enum ieee80211_state nstate, int mgt)
+static int
+ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int mgt)
{
- struct ieee80211com *ic = (void *)ifp;
+ struct ifnet *ifp = &ic->ic_if;
struct ieee80211_node *ni;
- int error, ostate;
-#ifdef IEEE80211_DEBUG
- static const char *stname[] =
- { "INIT", "SCAN", "AUTH", "ASSOC", "RUN" };
-#endif
+ enum ieee80211_state ostate;
ostate = ic->ic_state;
IEEE80211_DPRINTF(("%s: %s -> %s\n", __func__,
- stname[ostate], stname[nstate]));
- if (ic->ic_newstate) {
- error = (*ic->ic_newstate)(ic->ic_softc, nstate);
- if (error == EINPROGRESS)
- return 0;
- if (error != 0)
- return error;
- }
-
- /* state transition */
- ic->ic_state = nstate;
+ ieee80211_state_name[ostate], ieee80211_state_name[nstate]));
+ ic->ic_state = nstate; /* state transition */
ni = ic->ic_bss; /* NB: no reference held */
switch (nstate) {
case IEEE80211_S_INIT:
@@ -378,7 +377,7 @@ ieee80211_new_state(struct ifnet *ifp, enum ieee80211_state nstate, int mgt)
*/
ieee80211_create_ibss(ic, ic->ic_des_chan);
} else {
- ieee80211_begin_scan(ifp, ni);
+ ieee80211_begin_scan(ifp);
}
break;
case IEEE80211_S_SCAN:
@@ -406,7 +405,7 @@ ieee80211_new_state(struct ifnet *ifp, enum ieee80211_state nstate, int mgt)
ni->ni_fails++;
ieee80211_unref_node(&ni);
}
- ieee80211_begin_scan(ifp, ic->ic_bss);
+ ieee80211_begin_scan(ifp);
break;
}
break;
OpenPOWER on IntegriCloud