MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ieee80211_sta_join1

Function ieee80211_sta_join1

freebsd/net80211/ieee80211_node.c:837–903  ·  view source on GitHub ↗

* Join the specified IBSS/BSS network. The node is assumed to * be passed in with a held reference. */

Source from the content-addressed store, hash-verified

835 * be passed in with a held reference.
836 */
837static int
838ieee80211_sta_join1(struct ieee80211_node *selbs)
839{
840 struct ieee80211vap *vap = selbs->ni_vap;
841 struct ieee80211com *ic = selbs->ni_ic;
842 struct ieee80211_node *obss;
843 int canreassoc;
844
845 /*
846 * Committed to selbs, setup state.
847 */
848 obss = vap->iv_bss;
849 /*
850 * Check if old+new node have the same address in which
851 * case we can reassociate when operating in sta mode.
852 */
853 canreassoc = (obss != NULL &&
854 vap->iv_state == IEEE80211_S_RUN &&
855 IEEE80211_ADDR_EQ(obss->ni_macaddr, selbs->ni_macaddr));
856 vap->iv_bss = selbs; /* NB: caller assumed to bump refcnt */
857 if (obss != NULL) {
858 struct ieee80211_node_table *nt = obss->ni_table;
859
860 copy_bss(selbs, obss);
861 ieee80211_node_decref(obss); /* iv_bss reference */
862
863 IEEE80211_NODE_LOCK(nt);
864 node_reclaim(nt, obss); /* station table reference */
865 IEEE80211_NODE_UNLOCK(nt);
866
867 obss = NULL; /* NB: guard against later use */
868 }
869
870 /*
871 * Delete unusable rates; we've already checked
872 * that the negotiated rate set is acceptable.
873 */
874 ieee80211_fix_rate(vap->iv_bss, &vap->iv_bss->ni_rates,
875 IEEE80211_F_DODEL | IEEE80211_F_JOIN);
876
877 ieee80211_setcurchan(ic, selbs->ni_chan);
878 /*
879 * Set the erp state (mostly the slot time) to deal with
880 * the auto-select case; this should be redundant if the
881 * mode is locked.
882 */
883 ieee80211_vap_reset_erp(vap);
884 ieee80211_wme_initparams(vap);
885
886 if (vap->iv_opmode == IEEE80211_M_STA) {
887 if (canreassoc) {
888 /* Reassociate */
889 ieee80211_new_state(vap, IEEE80211_S_ASSOC, 1);
890 } else {
891 /*
892 * Act as if we received a DEAUTH frame in case we
893 * are invoked from the RUN state. This will cause
894 * us to try to re-authenticate if we are operating

Callers 3

ieee80211_node.cFile · 0.85
ieee80211_ibss_mergeFunction · 0.85
ieee80211_sta_joinFunction · 0.85

Calls 7

copy_bssFunction · 0.85
node_reclaimFunction · 0.85
ieee80211_fix_rateFunction · 0.85
ieee80211_setcurchanFunction · 0.85
ieee80211_vap_reset_erpFunction · 0.85
ieee80211_wme_initparamsFunction · 0.85
ieee80211_new_stateFunction · 0.85

Tested by

no test coverage detected