From patchwork Sat Oct 3 09:25:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 1376223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=x/6Eis4v; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.a=rsa-sha256 header.s=smtp header.b=YfL+p5/x; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C3M1c2YN1z9ryj for ; Sat, 3 Oct 2020 19:26:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ZCY++DkI0bkdD8LwA9F5qrIWuTPR3GZHEgzWNM0w37Q=; b=x/6Eis4vxivRoNFJLrjhrQ+CnZ AwJUN7Usyzfa/6MThbhPiySblzg17uqFqoA9+ZWdH3VSoKZoxM6AUe/uj9y6jszSYy4lDPCUWjT6u wWFSQhIIRDQDc5q/6aJFW7zeupFbZ6nuEEvmjRxD/AIiUq37PO7Ud2zMtd0u4vr5W7CTElTjPt/vJ ZHOyY/P8xK7PkOYDriEgZQZfSx3vMJQryvkdGNoJh3dd18mC92RkGHbogTNU2r7ls/8J6C/x9kcC1 DdVnqG+JeWcALLwIr7235dWchlISr7I3JJ6LNGzVYOHgpQvPxn3tMm0fQRiv4dmDsRDxZSL5Wjwx7 Lj+iKhdw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kOdnG-0007qD-QB; Sat, 03 Oct 2020 09:25:30 +0000 Received: from m42-4.mailgun.net ([69.72.42.4]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kOdnD-0007pg-11 for hostap@lists.infradead.org; Sat, 03 Oct 2020 09:25:28 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1601717126; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=JyrsrdLFyTYcznzjolsmhcQaXdB51OqN93vZ6mZ4GeI=; b=YfL+p5/xAdP8hRJYtukRHfYNemus1y7FHudbJzxahC/2f1Ns2NaLsPTtQ1EPtlbxV1v8ERcN 1tmp6ZfDmlpFKtj4UrN+g7zzUga1DDG0ZafoZQ6HTHBYyhgfdV7xMUWwfZze+iApRoPdWdGI hwVrLypo06pQnVS+OBzAIujn4G0= X-Mailgun-Sending-Ip: 69.72.42.4 X-Mailgun-Sid: WyJkMjNkOSIsICJob3N0YXBAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-east-1.postgun.com with SMTP id 5f78438552f4fccef0bd837d (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 03 Oct 2020 09:25:25 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 7EE36C433FF; Sat, 3 Oct 2020 09:25:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED, BAYES_00, SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from rmanohar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rmanohar) by smtp.codeaurora.org (Postfix) with ESMTPSA id A3EAAC433FE; Sat, 3 Oct 2020 09:25:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A3EAAC433FE Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=rmanohar@codeaurora.org From: Rajkumar Manoharan To: j@w1.fi Subject: [PATCH] nl80211: clear VHT and HE MCS rates in legacy beacon tx rate Date: Sat, 3 Oct 2020 02:25:08 -0700 Message-Id: <1601717108-1030-1-git-send-email-rmanohar@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201003_052527_142541_3E89407A X-CRM114-Status: GOOD ( 11.81 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [69.72.42.4 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hostap@lists.infradead.org, Rajkumar Manoharan MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org While configuring legacy beacon rate, VHT and HE MCS rates must be cleared. Otherwise the default MCS rates is filled by cfg80211 while validating beacon tx rate netlink attribute. This issue is exposed by ap_beacon_rate_legacy2 test case while validating HE MCS beacon tx rate support. Reported-by: Johannes Berg Signed-off-by: Rajkumar Manoharan --- src/drivers/driver_nl80211.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 2ee34d11d64e..c435d54b5168 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4165,6 +4165,7 @@ static int nl80211_put_beacon_rate(struct nl_msg *msg, const u64 flags, { struct nlattr *bands, *band; struct nl80211_txrate_vht vht_rate; + struct nl80211_txrate_he he_rate; if (!params->freq || (params->beacon_rate == 0 && @@ -4194,6 +4195,7 @@ static int nl80211_put_beacon_rate(struct nl_msg *msg, const u64 flags, return -1; os_memset(&vht_rate, 0, sizeof(vht_rate)); + os_memset(&he_rate, 0, sizeof(he_rate)); switch (params->rate_type) { case BEACON_RATE_LEGACY: @@ -4206,9 +4208,9 @@ static int nl80211_put_beacon_rate(struct nl_msg *msg, const u64 flags, if (nla_put_u8(msg, NL80211_TXRATE_LEGACY, (u8) params->beacon_rate / 5) || nla_put(msg, NL80211_TXRATE_HT, 0, NULL) || - (params->freq->vht_enabled && - nla_put(msg, NL80211_TXRATE_VHT, sizeof(vht_rate), - &vht_rate))) + nla_put(msg, NL80211_TXRATE_VHT, sizeof(vht_rate), + &vht_rate) || + nla_put(msg, NL80211_TXRATE_HE, sizeof(he_rate), &he_rate)) return -1; wpa_printf(MSG_DEBUG, " * beacon_rate = legacy:%u (* 100 kbps)", @@ -4222,9 +4224,9 @@ static int nl80211_put_beacon_rate(struct nl_msg *msg, const u64 flags, } if (nla_put(msg, NL80211_TXRATE_LEGACY, 0, NULL) || nla_put_u8(msg, NL80211_TXRATE_HT, params->beacon_rate) || - (params->freq->vht_enabled && - nla_put(msg, NL80211_TXRATE_VHT, sizeof(vht_rate), - &vht_rate))) + nla_put(msg, NL80211_TXRATE_VHT, sizeof(vht_rate), + &vht_rate) || + nla_put(msg, NL80211_TXRATE_HE, sizeof(he_rate), &he_rate)) return -1; wpa_printf(MSG_DEBUG, " * beacon_rate = HT-MCS %u", params->beacon_rate); @@ -4243,6 +4245,8 @@ static int nl80211_put_beacon_rate(struct nl_msg *msg, const u64 flags, if (nla_put(msg, NL80211_TXRATE_VHT, sizeof(vht_rate), &vht_rate)) return -1; + if (nla_put(msg, NL80211_TXRATE_HE, sizeof(he_rate), &he_rate)) + return -1; wpa_printf(MSG_DEBUG, " * beacon_rate = VHT-MCS %u", params->beacon_rate); break;