diff --git sys/net80211/ieee80211_proto.c sys/net80211/ieee80211_proto.c index cf170463372b..c22c4f226ca1 100644 --- sys/net80211/ieee80211_proto.c +++ sys/net80211/ieee80211_proto.c @@ -2672,27 +2672,52 @@ ieee80211_new_state_locked(struct ieee80211vap *vap, * do not allow any other state changes * until this is completed. */ +#if 0 IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, - "%s: %s -> %s (%s) transition discarded\n", - __func__, +#else + if_printf(vap->iv_ifp, +#endif + "%s:%d: %s -> %s (%s) transition discarded\n", + __func__, __LINE__, ieee80211_state_name[vap->iv_state], ieee80211_state_name[nstate], ieee80211_state_name[vap->iv_nstate]); return -1; - } else if (vap->iv_state != vap->iv_nstate) { + } else if (vap->iv_nstate > IEEE80211_S_SCAN && + nstate == IEEE80211_S_SCAN) { + /* + * We have an ongoing state transition which + * has not run yet or dropped the ic lock in + * between. + * Running to the end of this function and + * queueing another state change would overwrite + * the state on the vap and possibly lead to + * a problem. + */ #if 0 - /* Warn if the previous state hasn't completed. */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, - "%s: pending %s -> %s transition lost\n", __func__, +#else + if_printf(vap->iv_ifp, +#endif + "%s:%d: %s -> %s (%s) scan request discarded\n", + __func__, __LINE__, ieee80211_state_name[vap->iv_state], + ieee80211_state_name[nstate], ieee80211_state_name[vap->iv_nstate]); + return (EAGAIN); + + } else if (vap->iv_state != vap->iv_nstate) { +#if 0 + /* Warn if the previous state hasn't completed. */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, #else /* XXX temporarily enable to identify issues */ if_printf(vap->iv_ifp, - "%s: pending %s -> %s transition lost\n", - __func__, ieee80211_state_name[vap->iv_state], - ieee80211_state_name[vap->iv_nstate]); #endif + "%s:%d: pending %s -> %s transition lost\n", + __func__, __LINE__, + ieee80211_state_name[vap->iv_state], + ieee80211_state_name[vap->iv_nstate]); } }