[net8021] Pull out the ibss check code into a public function.

The ath(4) driver now sees beacons and management frames for different
BSSIDs in IBSS mode, which is a problem when you're in a very busy
IBSS environment.

So, expose this function so drivers can use it to check if the current
RX node is actually for a BSS we need to pay attention to or not.

PR:		kern/208644
Sponsored by:	Eva Automation. Inc.
This commit is contained in:
Adrian Chadd 2016-04-09 00:55:55 +00:00
parent 6966317aba
commit adad5b4564
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297728
2 changed files with 30 additions and 15 deletions

View File

@ -556,6 +556,33 @@ check_bss_debug(struct ieee80211vap *vap, struct ieee80211_node *ni)
}
#endif /* IEEE80211_DEBUG */
int
ieee80211_ibss_merge_check(struct ieee80211_node *ni)
{
struct ieee80211vap *vap = ni->ni_vap;
if (ni == vap->iv_bss ||
IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) {
/* unchanged, nothing to do */
return 0;
}
if (!check_bss(vap, ni)) {
/* capabilities mismatch */
IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
"%s: merge failed, capabilities mismatch\n", __func__);
#ifdef IEEE80211_DEBUG
if (ieee80211_msg_assoc(vap))
check_bss_debug(vap, ni);
#endif
vap->iv_stats.is_ibss_capmismatch++;
return 0;
}
return 1;
}
/*
* Handle 802.11 ad hoc network merge. The
* convention, set by the Wireless Ethernet Compatibility Alliance
@ -576,22 +603,9 @@ ieee80211_ibss_merge(struct ieee80211_node *ni)
struct ieee80211com *ic = ni->ni_ic;
#endif
if (ni == vap->iv_bss ||
IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) {
/* unchanged, nothing to do */
if (! ieee80211_ibss_merge_check(ni))
return 0;
}
if (!check_bss(vap, ni)) {
/* capabilities mismatch */
IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
"%s: merge failed, capabilities mismatch\n", __func__);
#ifdef IEEE80211_DEBUG
if (ieee80211_msg_assoc(vap))
check_bss_debug(vap, ni);
#endif
vap->iv_stats.is_ibss_capmismatch++;
return 0;
}
IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
"%s: new bssid %s: %s preamble, %s slot time%s\n", __func__,
ether_sprintf(ni->ni_bssid),

View File

@ -330,6 +330,7 @@ void ieee80211_setupcurchan(struct ieee80211com *,
struct ieee80211_channel *);
void ieee80211_setcurchan(struct ieee80211com *, struct ieee80211_channel *);
void ieee80211_update_chw(struct ieee80211com *);
int ieee80211_ibss_merge_check(struct ieee80211_node *);
int ieee80211_ibss_merge(struct ieee80211_node *);
struct ieee80211_scan_entry;
int ieee80211_sta_join(struct ieee80211vap *, struct ieee80211_channel *,