Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Feb 2017 06:04:06 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313137 - head/sys/net80211
Message-ID:  <201702030604.v13646eL009841@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)) {
 			/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702030604.v13646eL009841>