From patchwork Thu May 2 07:31:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peer, Ilan" X-Patchwork-Id: 240908 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 070012C00BC for ; Thu, 2 May 2013 18:30:44 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 42F8E9C1AC; Thu, 2 May 2013 04:30:40 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fPokUco-NuFw; Thu, 2 May 2013 04:30:40 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A0E319C0A9; Thu, 2 May 2013 04:30:35 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 277139C053 for ; Thu, 2 May 2013 04:30:34 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aRc+8rf7kEXV for ; Thu, 2 May 2013 04:30:29 -0400 (EDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id DE1219C1B3 for ; Thu, 2 May 2013 04:30:28 -0400 (EDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 02 May 2013 01:30:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,595,1363158000"; d="scan'208";a="331153919" Received: from ipeer-e6430-1.jer.intel.com ([10.12.217.180]) by fmsmga002.fm.intel.com with ESMTP; 02 May 2013 01:30:26 -0700 From: ilan.peer@intel.com To: hostap@lists.shmoo.com Subject: [PATCH] nl80211: Fix max_remain_on_chan capability reading Date: Thu, 2 May 2013 10:31:01 +0300 Message-Id: <1367479861-9646-1-git-send-email-ilan.peer@intel.com> X-Mailer: git-send-email 1.7.10.4 X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Ilan Peer 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 --- src/drivers/driver_nl80211.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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);