diff mbox

nl80211: Fix max_remain_on_chan capability reading

Message ID 1367479861-9646-1-git-send-email-ilan.peer@intel.com
State Accepted
Commit b691dcb129b09d42a1740a1706d28bc6562e7fa0
Headers show

Commit Message

Peer, Ilan May 2, 2013, 7:31 a.m. UTC
From: Ilan Peer <ilan.peer@intel.com>

In case that NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP is supported,
wiphy_info_handler() is called several times, where
NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION is present only in one
of these calls. Thus capa->max_remain_on_chan is overridden in
all other calls.

Fix it so the default value is set only after all the wiphy info was
received

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
---
 src/drivers/driver_nl80211.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Jouni Malinen May 4, 2013, 8:29 a.m. UTC | #1
On Thu, May 02, 2013 at 10:31:01AM +0300, ilan.peer@intel.com wrote:
> In case that NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP is supported,
> wiphy_info_handler() is called several times, where
> NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION is present only in one
> of these calls. Thus capa->max_remain_on_chan is overridden in
> all other calls.
> 
> Fix it so the default value is set only after all the wiphy info was
> received

Thanks, applied.
diff mbox

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 1c2f943..0433ca6 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2738,9 +2738,6 @@  static void wiphy_info_supp_cmds(struct wiphy_info_data *info,
 static void wiphy_info_max_roc(struct wpa_driver_capa *capa,
 			       struct nlattr *tb)
 {
-	/* default to 5000 since early versions of mac80211 don't set it */
-	capa->max_remain_on_chan = 5000;
-
 	if (tb)
 		capa->max_remain_on_chan = nla_get_u32(tb);
 }
@@ -2932,6 +2929,11 @@  static int wpa_driver_nl80211_get_info(struct wpa_driver_nl80211_data *drv,
 			   "concurrent (driver advertised support)");
 		drv->capa.flags |= WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT;
 	}
+
+	/* default to 5000 since early versions of mac80211 don't set it */
+	if (!drv->capa.max_remain_on_chan)
+		drv->capa.max_remain_on_chan = 5000;
+
 	return 0;
 nla_put_failure:
 	nlmsg_free(msg);