Author: adrian
Date: Fri Feb  3 06:04:06 2017
New Revision: 313137
URL: https://svnweb.freebsd.org/changeset/base/313137

Log:
  [net80211] don't update quiet time counter values every probe request.
  
  The quiet time counter update is happening each time the IE is added,
  which also means it happens for each quiet time IE addition to the probe
  response.
  
  Only update the countdown if we request ie (ie, beacon updates.)

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==============================================================================
--- head/sys/net80211/ieee80211_output.c        Fri Feb  3 05:15:35 2017        
(r313136)
+++ head/sys/net80211/ieee80211_output.c        Fri Feb  3 06:04:06 2017        
(r313137)
@@ -2016,16 +2016,23 @@ ieee80211_add_supportedchannels(uint8_t 
  * Add an 11h Quiet time element to a frame.
  */
 static uint8_t *
-ieee80211_add_quiet(uint8_t *frm, struct ieee80211vap *vap)
+ieee80211_add_quiet(uint8_t *frm, struct ieee80211vap *vap, int update)
 {
        struct ieee80211_quiet_ie *quiet = (struct ieee80211_quiet_ie *) frm;
 
        quiet->quiet_ie = IEEE80211_ELEMID_QUIET;
        quiet->len = 6;
-       if (vap->iv_quiet_count_value == 1)
-               vap->iv_quiet_count_value = vap->iv_quiet_count;
-       else if (vap->iv_quiet_count_value > 1)
-               vap->iv_quiet_count_value--;
+
+       /*
+        * Only update every beacon interval - otherwise probe responses
+        * would update the quiet count value.
+        */
+       if (update) {
+               if (vap->iv_quiet_count_value == 1)
+                       vap->iv_quiet_count_value = vap->iv_quiet_count;
+               else if (vap->iv_quiet_count_value > 1)
+                       vap->iv_quiet_count_value--;
+       }
 
        if (vap->iv_quiet_count_value == 0) {
                /* value 0 is reserved as per 802.11h standerd */
@@ -2812,7 +2819,7 @@ ieee80211_alloc_proberesp(struct ieee802
                if (IEEE80211_IS_CHAN_DFS(ic->ic_bsschan) &&
                    (vap->iv_flags_ext & IEEE80211_FEXT_DFS)) {
                        if (vap->iv_quiet)
-                               frm = ieee80211_add_quiet(frm, vap);
+                               frm = ieee80211_add_quiet(frm, vap, 0);
                }
        }
        if (IEEE80211_IS_CHAN_ANYG(bss->ni_chan))
@@ -3161,7 +3168,7 @@ ieee80211_beacon_construct(struct mbuf *
                if (IEEE80211_IS_CHAN_DFS(ic->ic_bsschan) &&
                    (vap->iv_flags_ext & IEEE80211_FEXT_DFS)) {
                        if (vap->iv_quiet)
-                               frm = ieee80211_add_quiet(frm,vap);
+                               frm = ieee80211_add_quiet(frm,vap, 0);
                }
        } else
                bo->bo_quiet = frm;
@@ -3596,7 +3603,7 @@ ieee80211_beacon_update(struct ieee80211
                if (IEEE80211_IS_CHAN_DFS(ic->ic_bsschan) &&
                    (vap->iv_flags_ext & IEEE80211_FEXT_DFS) ){
                        if (vap->iv_quiet)
-                               ieee80211_add_quiet(bo->bo_quiet, vap);
+                               ieee80211_add_quiet(bo->bo_quiet, vap, 1);
                }
                if (isset(bo->bo_flags, IEEE80211_BEACON_ERP)) {
                        /*
_______________________________________________
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