* Handle bookkeeping for station deauthentication/disassociation * when operating as an ap. */
| 2936 | * when operating as an ap. |
| 2937 | */ |
| 2938 | void |
| 2939 | ieee80211_node_leave(struct ieee80211_node *ni) |
| 2940 | { |
| 2941 | struct ieee80211com *ic = ni->ni_ic; |
| 2942 | struct ieee80211vap *vap = ni->ni_vap; |
| 2943 | struct ieee80211_node_table *nt = ni->ni_table; |
| 2944 | |
| 2945 | IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, ni, |
| 2946 | "station with aid %d leaves", IEEE80211_NODE_AID(ni)); |
| 2947 | |
| 2948 | KASSERT(vap->iv_opmode != IEEE80211_M_STA, |
| 2949 | ("unexpected operating mode %u", vap->iv_opmode)); |
| 2950 | /* |
| 2951 | * If node wasn't previously associated all |
| 2952 | * we need to do is reclaim the reference. |
| 2953 | */ |
| 2954 | /* XXX ibss mode bypasses 11g and notification */ |
| 2955 | if (ni->ni_associd == 0) |
| 2956 | goto done; |
| 2957 | /* |
| 2958 | * Tell the authenticator the station is leaving. |
| 2959 | * Note that we must do this before yanking the |
| 2960 | * association id as the authenticator uses the |
| 2961 | * associd to locate it's state block. |
| 2962 | */ |
| 2963 | if (vap->iv_auth->ia_node_leave != NULL) |
| 2964 | vap->iv_auth->ia_node_leave(ni); |
| 2965 | |
| 2966 | IEEE80211_LOCK(ic); |
| 2967 | IEEE80211_AID_CLR(vap, ni->ni_associd); |
| 2968 | vap->iv_sta_assoc--; |
| 2969 | |
| 2970 | if (IEEE80211_IS_CHAN_VHT(ic->ic_bsschan)) |
| 2971 | ieee80211_vht_node_leave(ni); |
| 2972 | if (IEEE80211_IS_CHAN_HT(ic->ic_bsschan)) |
| 2973 | ieee80211_ht_node_leave(ni); |
| 2974 | if (IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan) && |
| 2975 | IEEE80211_IS_CHAN_FULL(ic->ic_bsschan)) |
| 2976 | ieee80211_node_leave_11g(ni); |
| 2977 | IEEE80211_UNLOCK(ic); |
| 2978 | /* |
| 2979 | * Cleanup station state. In particular clear various |
| 2980 | * state that might otherwise be reused if the node |
| 2981 | * is reused before the reference count goes to zero |
| 2982 | * (and memory is reclaimed). |
| 2983 | */ |
| 2984 | ieee80211_sta_leave(ni); |
| 2985 | done: |
| 2986 | /* |
| 2987 | * Remove the node from any table it's recorded in and |
| 2988 | * drop the caller's reference. Removal from the table |
| 2989 | * is important to insure the node is not reprocessed |
| 2990 | * for inactivity. |
| 2991 | */ |
| 2992 | if (nt != NULL) { |
| 2993 | IEEE80211_NODE_LOCK(nt); |
| 2994 | node_reclaim(nt, ni); |
| 2995 | IEEE80211_NODE_UNLOCK(nt); |
no test coverage detected