* Test a scan candidate for suitability/compatibility. */
| 1012 | * Test a scan candidate for suitability/compatibility. |
| 1013 | */ |
| 1014 | static int |
| 1015 | match_bss(struct ieee80211vap *vap, |
| 1016 | const struct ieee80211_scan_state *ss, struct sta_entry *se0, |
| 1017 | int debug) |
| 1018 | { |
| 1019 | struct ieee80211com *ic = vap->iv_ic; |
| 1020 | struct ieee80211_scan_entry *se = &se0->base; |
| 1021 | uint8_t rate; |
| 1022 | int fail; |
| 1023 | |
| 1024 | fail = 0; |
| 1025 | if (isclr(ic->ic_chan_active, ieee80211_chan2ieee(ic, se->se_chan))) |
| 1026 | fail |= MATCH_CHANNEL; |
| 1027 | /* |
| 1028 | * NB: normally the desired mode is used to construct |
| 1029 | * the channel list, but it's possible for the scan |
| 1030 | * cache to include entries for stations outside this |
| 1031 | * list so we check the desired mode here to weed them |
| 1032 | * out. |
| 1033 | */ |
| 1034 | if (vap->iv_des_mode != IEEE80211_MODE_AUTO && |
| 1035 | (se->se_chan->ic_flags & IEEE80211_CHAN_ALLTURBO) != |
| 1036 | chanflags[vap->iv_des_mode]) |
| 1037 | fail |= MATCH_CHANNEL; |
| 1038 | if (vap->iv_opmode == IEEE80211_M_IBSS) { |
| 1039 | if ((se->se_capinfo & IEEE80211_CAPINFO_IBSS) == 0) |
| 1040 | fail |= MATCH_CAPINFO; |
| 1041 | #ifdef IEEE80211_SUPPORT_TDMA |
| 1042 | } else if (vap->iv_opmode == IEEE80211_M_AHDEMO) { |
| 1043 | /* |
| 1044 | * Adhoc demo network setup shouldn't really be scanning |
| 1045 | * but just in case skip stations operating in IBSS or |
| 1046 | * BSS mode. |
| 1047 | */ |
| 1048 | if (se->se_capinfo & (IEEE80211_CAPINFO_IBSS|IEEE80211_CAPINFO_ESS)) |
| 1049 | fail |= MATCH_CAPINFO; |
| 1050 | /* |
| 1051 | * TDMA operation cannot coexist with a normal 802.11 network; |
| 1052 | * skip if IBSS or ESS capabilities are marked and require |
| 1053 | * the beacon have a TDMA ie present. |
| 1054 | */ |
| 1055 | if (vap->iv_caps & IEEE80211_C_TDMA) { |
| 1056 | const struct ieee80211_tdma_param *tdma = |
| 1057 | (const struct ieee80211_tdma_param *)se->se_ies.tdma_ie; |
| 1058 | const struct ieee80211_tdma_state *ts = vap->iv_tdma; |
| 1059 | |
| 1060 | if (tdma == NULL) |
| 1061 | fail |= MATCH_TDMA_NOIE; |
| 1062 | else if (tdma->tdma_version != ts->tdma_version) |
| 1063 | fail |= MATCH_TDMA_VERSION; |
| 1064 | else if (tdma->tdma_slot != 0) |
| 1065 | fail |= MATCH_TDMA_NOTMASTER; |
| 1066 | else if (tdma_isfull(tdma)) |
| 1067 | fail |= MATCH_TDMA_NOSLOT; |
| 1068 | #if 0 |
| 1069 | else if (ieee80211_local_address(se->se_macaddr)) |
| 1070 | fail |= MATCH_TDMA_LOCAL; |
| 1071 | #endif |
no test coverage detected