Author: adrian
Date: Sat Apr  9 00:55:55 2016
New Revision: 297728
URL: https://svnweb.freebsd.org/changeset/base/297728

Log:
  [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.

Modified:
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_node.h

Modified: head/sys/net80211/ieee80211_node.c
==============================================================================
--- head/sys/net80211/ieee80211_node.c  Sat Apr  9 00:54:02 2016        
(r297727)
+++ head/sys/net80211/ieee80211_node.c  Sat Apr  9 00:55:55 2016        
(r297728)
@@ -556,6 +556,33 @@ check_bss_debug(struct ieee80211vap *vap
 }
 #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_no
        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),

Modified: head/sys/net80211/ieee80211_node.h
==============================================================================
--- head/sys/net80211/ieee80211_node.h  Sat Apr  9 00:54:02 2016        
(r297727)
+++ head/sys/net80211/ieee80211_node.h  Sat Apr  9 00:55:55 2016        
(r297728)
@@ -330,6 +330,7 @@ void        ieee80211_setupcurchan(struct ieee8
            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 *,
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to