ieee80211_node.c (330458) | ieee80211_node.c (337951) |
---|---|
1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: stable/11/sys/net80211/ieee80211_node.c 330458 2018-03-05 08:18:13Z eadler $"); | 28__FBSDID("$FreeBSD: stable/11/sys/net80211/ieee80211_node.c 337951 2018-08-17 03:05:09Z kevans $"); |
29 30#include "opt_wlan.h" 31 32#include <sys/param.h> | 29 30#include "opt_wlan.h" 31 32#include <sys/param.h> |
33#include <sys/systm.h> 34#include <sys/mbuf.h> | 33#include 34#include |
35#include <sys/malloc.h> 36#include <sys/kernel.h> 37 38#include <sys/socket.h> | 35#include <sys/malloc.h> 36#include <sys/kernel.h> 37 38#include <sys/socket.h> |
39 | 39 |
40#include <net/if.h> 41#include <net/if_var.h> 42#include <net/if_media.h> 43#include <net/ethernet.h> 44 45#include <net80211/ieee80211_var.h> 46#include <net80211/ieee80211_input.h> 47#ifdef IEEE80211_SUPPORT_SUPERG --- 81 unchanged lines hidden (view full) --- 129} 130 131void 132ieee80211_node_detach(struct ieee80211com *ic) 133{ 134 135 callout_drain(&ic->ic_inact); 136 ieee80211_node_table_cleanup(&ic->ic_sta); | 40#include <net/if.h> 41#include <net/if_var.h> 42#include <net/if_media.h> 43#include <net/ethernet.h> 44 45#include <net80211/ieee80211_var.h> 46#include <net80211/ieee80211_input.h> 47#ifdef IEEE80211_SUPPORT_SUPERG --- 81 unchanged lines hidden (view full) --- 129} 130 131void 132ieee80211_node_detach(struct ieee80211com *ic) 133{ 134 135 callout_drain(&ic->ic_inact); 136 ieee80211_node_table_cleanup(&ic->ic_sta); |
137 ieee80211_ageq_drain(&ic->ic_stageq); |
|
137 ieee80211_ageq_cleanup(&ic->ic_stageq); 138} 139 140void 141ieee80211_node_vattach(struct ieee80211vap *vap) 142{ 143 /* NB: driver can override */ 144 vap->iv_max_aid = IEEE80211_AID_DEF; --- 49 unchanged lines hidden (view full) --- 194 vap->iv_bss = NULL; 195 } 196 if (vap->iv_aid_bitmap != NULL) { 197 IEEE80211_FREE(vap->iv_aid_bitmap, M_80211_NODE); 198 vap->iv_aid_bitmap = NULL; 199 } 200} 201 | 138 ieee80211_ageq_cleanup(&ic->ic_stageq); 139} 140 141void 142ieee80211_node_vattach(struct ieee80211vap *vap) 143{ 144 /* NB: driver can override */ 145 vap->iv_max_aid = IEEE80211_AID_DEF; --- 49 unchanged lines hidden (view full) --- 195 vap->iv_bss = NULL; 196 } 197 if (vap->iv_aid_bitmap != NULL) { 198 IEEE80211_FREE(vap->iv_aid_bitmap, M_80211_NODE); 199 vap->iv_aid_bitmap = NULL; 200 } 201} 202 |
202/* | 203/* |
203 * Port authorize/unauthorize interfaces for use by an authenticator. 204 */ 205 206void 207ieee80211_node_authorize(struct ieee80211_node *ni) 208{ 209 struct ieee80211vap *vap = ni->ni_vap; 210 --- 154 unchanged lines hidden (view full) --- 365#endif 366 memset(ni->ni_bssid, 0, IEEE80211_ADDR_LEN); 367#ifdef IEEE80211_SUPPORT_MESH 368 } else if (vap->iv_opmode == IEEE80211_M_MBSS) { 369 ni->ni_meshidlen = vap->iv_mesh->ms_idlen; 370 memcpy(ni->ni_meshid, vap->iv_mesh->ms_id, ni->ni_meshidlen); 371#endif 372 } | 204 * Port authorize/unauthorize interfaces for use by an authenticator. 205 */ 206 207void 208ieee80211_node_authorize(struct ieee80211_node *ni) 209{ 210 struct ieee80211vap *vap = ni->ni_vap; 211 --- 154 unchanged lines hidden (view full) --- 366#endif 367 memset(ni->ni_bssid, 0, IEEE80211_ADDR_LEN); 368#ifdef IEEE80211_SUPPORT_MESH 369 } else if (vap->iv_opmode == IEEE80211_M_MBSS) { 370 ni->ni_meshidlen = vap->iv_mesh->ms_idlen; 371 memcpy(ni->ni_meshid, vap->iv_mesh->ms_id, ni->ni_meshidlen); 372#endif 373 } |
373 /* | 374 /* |
374 * Fix the channel and related attributes. 375 */ 376 /* clear DFS CAC state on previous channel */ 377 if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && 378 ic->ic_bsschan->ic_freq != chan->ic_freq && 379 IEEE80211_IS_CHAN_CACDONE(ic->ic_bsschan)) 380 ieee80211_dfs_cac_clear(ic, ic->ic_bsschan); 381 ic->ic_bsschan = chan; --- 163 unchanged lines hidden (view full) --- 545 fail & 0x02 ? '!' : ' '); 546 printf(" %3s%c ", 547 (ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) ? "wep" : "no", 548 fail & 0x04 ? '!' : ' '); 549 ieee80211_print_essid(ni->ni_essid, ni->ni_esslen); 550 printf("%s\n", fail & 0x10 ? "!" : ""); 551} 552#endif /* IEEE80211_DEBUG */ | 375 * Fix the channel and related attributes. 376 */ 377 /* clear DFS CAC state on previous channel */ 378 if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && 379 ic->ic_bsschan->ic_freq != chan->ic_freq && 380 IEEE80211_IS_CHAN_CACDONE(ic->ic_bsschan)) 381 ieee80211_dfs_cac_clear(ic, ic->ic_bsschan); 382 ic->ic_bsschan = chan; --- 163 unchanged lines hidden (view full) --- 546 fail & 0x02 ? '!' : ' '); 547 printf(" %3s%c ", 548 (ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) ? "wep" : "no", 549 fail & 0x04 ? '!' : ' '); 550 ieee80211_print_essid(ni->ni_essid, ni->ni_esslen); 551 printf("%s\n", fail & 0x10 ? "!" : ""); 552} 553#endif /* IEEE80211_DEBUG */ |
553 | |
554 | 554 |
555 |
|
555int 556ieee80211_ibss_merge_check(struct ieee80211_node *ni) 557{ 558 struct ieee80211vap *vap = ni->ni_vap; 559 560 if (ni == vap->iv_bss || 561 IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) { 562 /* unchanged, nothing to do */ --- 243 unchanged lines hidden (view full) --- 806 ieee80211_fix_rate(vap->iv_bss, &vap->iv_bss->ni_rates, 807 IEEE80211_F_DODEL | IEEE80211_F_JOIN); 808 809 ieee80211_setcurchan(ic, selbs->ni_chan); 810 /* 811 * Set the erp state (mostly the slot time) to deal with 812 * the auto-select case; this should be redundant if the 813 * mode is locked. | 556int 557ieee80211_ibss_merge_check(struct ieee80211_node *ni) 558{ 559 struct ieee80211vap *vap = ni->ni_vap; 560 561 if (ni == vap->iv_bss || 562 IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) { 563 /* unchanged, nothing to do */ --- 243 unchanged lines hidden (view full) --- 807 ieee80211_fix_rate(vap->iv_bss, &vap->iv_bss->ni_rates, 808 IEEE80211_F_DODEL | IEEE80211_F_JOIN); 809 810 ieee80211_setcurchan(ic, selbs->ni_chan); 811 /* 812 * Set the erp state (mostly the slot time) to deal with 813 * the auto-select case; this should be redundant if the 814 * mode is locked. |
814 */ | 815 */ |
815 ieee80211_reset_erp(ic); 816 ieee80211_wme_initparams(vap); 817 818 if (vap->iv_opmode == IEEE80211_M_STA) { 819 if (canreassoc) { 820 /* Reassociate */ 821 ieee80211_new_state(vap, IEEE80211_S_ASSOC, 1); 822 } else { --- 689 unchanged lines hidden (view full) --- 1512 /* XXX no rate negotiation; just dup */ 1513 ni->ni_rates = vap->iv_bss->ni_rates; 1514 if (ieee80211_iserp_rateset(&ni->ni_rates)) 1515 ni->ni_flags |= IEEE80211_NODE_ERP; 1516 if (vap->iv_opmode == IEEE80211_M_AHDEMO) { 1517 /* 1518 * In adhoc demo mode there are no management 1519 * frames to use to discover neighbor capabilities, | 816 ieee80211_reset_erp(ic); 817 ieee80211_wme_initparams(vap); 818 819 if (vap->iv_opmode == IEEE80211_M_STA) { 820 if (canreassoc) { 821 /* Reassociate */ 822 ieee80211_new_state(vap, IEEE80211_S_ASSOC, 1); 823 } else { --- 689 unchanged lines hidden (view full) --- 1513 /* XXX no rate negotiation; just dup */ 1514 ni->ni_rates = vap->iv_bss->ni_rates; 1515 if (ieee80211_iserp_rateset(&ni->ni_rates)) 1516 ni->ni_flags |= IEEE80211_NODE_ERP; 1517 if (vap->iv_opmode == IEEE80211_M_AHDEMO) { 1518 /* 1519 * In adhoc demo mode there are no management 1520 * frames to use to discover neighbor capabilities, |
1520 * so blindly propagate the local configuration | 1521 * so blindly propagate the local configuration |
1521 * so we can do interesting things (e.g. use 1522 * WME to disable ACK's). 1523 */ 1524 if (vap->iv_flags & IEEE80211_F_WME) 1525 ni->ni_flags |= IEEE80211_NODE_QOS; 1526#ifdef IEEE80211_SUPPORT_SUPERG 1527 if (vap->iv_flags & IEEE80211_F_FF) 1528 ni->ni_flags |= IEEE80211_NODE_FF; --- 565 unchanged lines hidden (view full) --- 2094 /* 2095 * Special case ourself; we may be idle for extended periods 2096 * of time and regardless reclaiming our state is wrong. 2097 * XXX run ic_node_age 2098 */ 2099 /* XXX before inact decrement? */ 2100 if (ni == vap->iv_bss) 2101 return; | 1522 * so we can do interesting things (e.g. use 1523 * WME to disable ACK's). 1524 */ 1525 if (vap->iv_flags & IEEE80211_F_WME) 1526 ni->ni_flags |= IEEE80211_NODE_QOS; 1527#ifdef IEEE80211_SUPPORT_SUPERG 1528 if (vap->iv_flags & IEEE80211_F_FF) 1529 ni->ni_flags |= IEEE80211_NODE_FF; --- 565 unchanged lines hidden (view full) --- 2095 /* 2096 * Special case ourself; we may be idle for extended periods 2097 * of time and regardless reclaiming our state is wrong. 2098 * XXX run ic_node_age 2099 */ 2100 /* XXX before inact decrement? */ 2101 if (ni == vap->iv_bss) 2102 return; |
2102 if (ni->ni_associd != 0 || | 2103 if (ni->ni_associd != 0 || |
2103 (vap->iv_opmode == IEEE80211_M_IBSS || 2104 vap->iv_opmode == IEEE80211_M_AHDEMO)) { 2105 /* 2106 * Age/drain resources held by the station. 2107 */ 2108 ic->ic_node_age(ni); 2109 /* 2110 * Probe the station before time it out. We --- 744 unchanged lines hidden --- | 2104 (vap->iv_opmode == IEEE80211_M_IBSS || 2105 vap->iv_opmode == IEEE80211_M_AHDEMO)) { 2106 /* 2107 * Age/drain resources held by the station. 2108 */ 2109 ic->ic_node_age(ni); 2110 /* 2111 * Probe the station before time it out. We --- 744 unchanged lines hidden --- |