From patchwork Tue Jan 19 19:07:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 1428813 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; 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=jqNjNRLB; 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 4DKyqd1ppNz9s24 for ; Wed, 20 Jan 2021 06:08:45 +1100 (AEDT) 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=k9U4v1E+kVVg+awQpiV2ZE9QTPa99SJS6ygTcaNMN9w=; b=jqNjNRLBM4UwqqRWHe9MLRIZTY ltO3NNHDFaMuntbk/WF0onPf23tZhowtk0BGWt6RBzAx9kbpCxg8qK4RwOXvr+nfkFSxIWYLm9Zvp 7pT9ptIPyNDcWYYX8A2dodez3EsqCjWFWtpo75pWhUO2b8sHiOmrFXylkZWibnl3F6CvVWzKZiiLw UMDSmYX4BO4tHsxivIPkW22j8rtn9Ba1PZsljgVQ4/fWYrJ1kCIqxweHQeC4P4ztXwTtRtPrvPTXi ZnxJfPOG9syPCK1eM4/biA7CEcjA6YIpY57IejhWM9EmHyNmAAHD9XeXQuACPOt9Ar4aTW66J7wLK REHxJHtw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1wLv-0001xw-Lp; Tue, 19 Jan 2021 19:07:43 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2] helo=sipsolutions.net) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1wLt-0001xH-BM for hostap@lists.infradead.org; Tue, 19 Jan 2021 19:07:42 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1l1wLr-008pTz-NF; Tue, 19 Jan 2021 20:07:39 +0100 From: Johannes Berg To: hostap@lists.infradead.org Subject: [PATCH v2] robust_av: use wpa_bss_ext_capab() helper Date: Tue, 19 Jan 2021 20:07:36 +0100 Message-Id: <1611083256-I3a247a9b30b9de89e994dadf9c1d76c524830df5@changeid> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210119_140741_478554_3606A031 X-CRM114-Status: GOOD ( 12.01 ) X-Spam-Score: 0.4 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS 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: Johannes Berg Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Johannes Berg Use the helper instead of open-coding the check. Since the helper doesn't handle a NULL BSS, keep that extra check. Signed-off-by: Johannes Berg --- wpa_supplicant/robust_av.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/wpa_supplicant/robust_av.c b/wpa_supplicant/robust_av.c index 1280f5d96e7e..7ecd35769cc5 100644 --- a/wpa_supplicant/robust_av.c +++ b/wpa_supplicant/robust_av.c @@ -48,18 +48,14 @@ void wpas_populate_mscs_descriptor_ie(struct robust_av_data *robust_av, int wpas_send_mscs_req(struct wpa_supplicant *wpa_s) { struct wpabuf *buf; - const u8 *ext_capab = NULL; size_t buf_len; int ret; if (wpa_s->wpa_state != WPA_COMPLETED || !wpa_s->current_ssid) return 0; - if (wpa_s->current_bss) - ext_capab = wpa_bss_get_ie(wpa_s->current_bss, - WLAN_EID_EXT_CAPAB); - - if (!ext_capab || ext_capab[1] < 11 || !(ext_capab[12] & 0x20)) { + if (!wpa_s->current_bss || + !wpa_bss_ext_capab(wpa_s->current_bss, WLAN_EXT_CAPAB_MSCS)) { wpa_dbg(wpa_s, MSG_INFO, "AP does not support MSCS - could not send MSCS Req"); return -1;