From patchwork Wed Jul 18 20:10:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arik Nemtsov X-Patchwork-Id: 171819 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]) by ozlabs.org (Postfix) with ESMTP id C24372C00B3 for ; Thu, 19 Jul 2012 06:10:43 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id DA2B99D1E0; Wed, 18 Jul 2012 16:10: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 hHuBM5zWj1vY; Wed, 18 Jul 2012 16:10:40 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 6C7BD9D1E1; Wed, 18 Jul 2012 16:10:33 -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 E34C79D1E3 for ; Wed, 18 Jul 2012 16:10:31 -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 5ORUqjEdTKMw for ; Wed, 18 Jul 2012 16:10:28 -0400 (EDT) Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id F33769D1E0 for ; Wed, 18 Jul 2012 16:10:27 -0400 (EDT) Received: by wgbdq11 with SMTP id dq11so1108953wgb.5 for ; Wed, 18 Jul 2012 13:10:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=taWK8Icf8Z5YhbZCwethbyoqIjA212XuNl5FczcuwBQ=; b=k6llBc8GwOQXU7noFMTAERxKsBhpW4jYHv80ssqUGBMiixj8/ydC/dCg2SGu1qXtuk ZSx1Us1VN9oQOl5IIc9meugvuWD7q6DZAVgSskIsphRqMMyuNWhdvWfjvnfp2T8U3WTT 6fpu4do+JtAXjirAvfVBBbr22i0wiTqs4GH+Dph874vR4ao5kRLUNdPiTOWbfi2E+mfC 75POo01ORgWKFCh70ox+hsmM/DVL3drUJ0TZfS09fz63IcYM6HDpz/qr0ftebyrJEodz JyQ2kcnKkTh0XTsJCklbTY+/FBcuSDjraBUQYK8bMZ7xk4bi7X9MTf6h+YIWy1U9pBxf G3Og== Received: by 10.216.236.163 with SMTP id w35mr354404weq.13.1342642226788; Wed, 18 Jul 2012 13:10:26 -0700 (PDT) Received: from localhost.localdomain (85-250-9-38.bb.netvision.net.il. [85.250.9.38]) by mx.google.com with ESMTPS id fu3sm50821127wib.10.2012.07.18.13.10.25 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jul 2012 13:10:26 -0700 (PDT) From: Arik Nemtsov To: hostap@lists.shmoo.com Subject: [PATCH] SME: correctly check mode HT caps for enabling OBSS scan Date: Wed, 18 Jul 2012 23:10:22 +0300 Message-Id: <1342642222-23791-1-git-send-email-arik@wizery.com> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQkBkFhtPyJstCj8g8n39Os3AWPgts4FcpsJK0sOVUcUzcMeEntJ/iUEqLjV2oj8qwK/+G0F Cc: Arik Nemtsov X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 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 Don't assume the 11g mode is always first in the list of mode (sometimes it isn't). Traverse the array of modes and check the HT40 capability is turned on for 11g. Signed-hostap: Arik Nemtsov --- wpa_supplicant/sme.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index c7187e4..a82cb95 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -843,6 +843,8 @@ void sme_sched_obss_scan(struct wpa_supplicant *wpa_s, int enable) const u8 *ie; struct wpa_bss *bss = wpa_s->current_bss; struct wpa_ssid *ssid = wpa_s->current_ssid; + struct hostapd_hw_modes *hw_mode = NULL; + int i; eloop_cancel_timeout(sme_obss_scan_timeout, wpa_s, NULL); wpa_s->sme.sched_obss_scan = 0; @@ -853,9 +855,20 @@ void sme_sched_obss_scan(struct wpa_supplicant *wpa_s, int enable) ssid->mode != IEEE80211_MODE_INFRA) return; /* Not using station SME in wpa_supplicant */ - if (!wpa_s->hw.modes || - !(wpa_s->hw.modes->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)) - return; /* Driver does not support HT40 */ + if (!wpa_s->hw.modes) + return; + + /* only HT caps in 11g mode are relevant */ + for (i = 0; i < wpa_s->hw.num_modes; i++) { + hw_mode = &wpa_s->hw.modes[i]; + if (hw_mode->mode == HOSTAPD_MODE_IEEE80211G) + break; + } + + /* Driver does not support HT40 for 11g or doesn't have 11g. */ + if (i == wpa_s->hw.num_modes || !hw_mode || + !(hw_mode->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)) + return; if (bss == NULL || bss->freq < 2400 || bss->freq > 2500) return; /* Not associated on 2.4 GHz band */