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

Function ieee80211_alloc_node

freebsd/net80211/ieee80211_node.c:1383–1435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1381}
1382
1383struct ieee80211_node *
1384ieee80211_alloc_node(struct ieee80211_node_table *nt,
1385 struct ieee80211vap *vap, const uint8_t macaddr[IEEE80211_ADDR_LEN])
1386{
1387 struct ieee80211com *ic = nt->nt_ic;
1388 struct ieee80211_node *ni;
1389
1390 ni = ic->ic_node_alloc(vap, macaddr);
1391 if (ni == NULL) {
1392 vap->iv_stats.is_rx_nodealloc++;
1393 return NULL;
1394 }
1395
1396 IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE,
1397 "%s %p<%s> in %s table\n", __func__, ni,
1398 ether_sprintf(macaddr), nt->nt_name);
1399
1400 IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr);
1401 ieee80211_node_initref(ni); /* mark referenced */
1402 ni->ni_chan = IEEE80211_CHAN_ANYC;
1403 ni->ni_authmode = IEEE80211_AUTH_OPEN;
1404 ni->ni_txpower = ic->ic_txpowlimit; /* max power */
1405 ni->ni_txparms = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
1406 ieee80211_crypto_resetkey(vap, &ni->ni_ucastkey, IEEE80211_KEYIX_NONE);
1407 ni->ni_avgrssi = IEEE80211_RSSI_DUMMY_MARKER;
1408 ni->ni_inact_reload = nt->nt_inact_init;
1409 ni->ni_inact = ni->ni_inact_reload;
1410 ni->ni_ath_defkeyix = 0x7fff;
1411 ieee80211_psq_init(&ni->ni_psq, "unknown");
1412#ifdef IEEE80211_SUPPORT_MESH
1413 if (vap->iv_opmode == IEEE80211_M_MBSS)
1414 ieee80211_mesh_node_init(vap, ni);
1415#endif
1416 IEEE80211_NODE_LOCK(nt);
1417 ieee80211_add_node_nt(nt, ni);
1418 ni->ni_vap = vap;
1419 ni->ni_ic = ic;
1420 IEEE80211_NODE_UNLOCK(nt);
1421
1422 /* handle failure; free node state */
1423 if (ic->ic_node_init(ni) != 0) {
1424 vap->iv_stats.is_rx_nodealloc++;
1425 ieee80211_psq_cleanup(&ni->ni_psq);
1426 ieee80211_ratectl_node_deinit(ni);
1427 _ieee80211_free_node(ni);
1428 return NULL;
1429 }
1430
1431 IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni,
1432 "%s: inact_reload %u", __func__, ni->ni_inact_reload);
1433
1434 return ni;
1435}
1436
1437/*
1438 * Craft a temporary node suitable for sending a management frame

Callers 5

ieee80211_node.cFile · 0.85
ieee80211_reset_bssFunction · 0.85
ieee80211_sta_joinFunction · 0.85
ieee80211_dup_bssFunction · 0.85

Calls 9

ether_sprintfFunction · 0.85
ieee80211_chan2modeFunction · 0.85
ieee80211_psq_initFunction · 0.85
ieee80211_mesh_node_initFunction · 0.85
ieee80211_add_node_ntFunction · 0.85
ieee80211_psq_cleanupFunction · 0.85
_ieee80211_free_nodeFunction · 0.85

Tested by

no test coverage detected