From patchwork Tue Nov 29 20:51:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 27507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp568064wrr; Tue, 29 Nov 2022 13:07:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf7S4fbbjRXjR5Bace7fQYOwbJMMywd4ifb5ZW7mF4Y1i9Qi+IXNA040Ou5aY1rzww/UPEkB X-Received: by 2002:a05:6a00:440b:b0:56b:b53f:e887 with SMTP id br11-20020a056a00440b00b0056bb53fe887mr39390589pfb.3.1669756077770; Tue, 29 Nov 2022 13:07:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669756077; cv=none; d=google.com; s=arc-20160816; b=TdYFxI1uWeEi8YrlEA2pbyN4E6G6zDX3nvO8xIktKunh4FLDL6cT9q6x77oDqsxvGR aJg1fkNfPWMBVuQ8anNzhb6Zwv0ujvo50nB37D5S5oigXyWr7u6KapHauhm16GSpPztv JzfyOwpzdBC1LLkj1NqyZXI8eVjDDNH04Wrsz8GJnXDPCQMj4D4QPvdLNDuygB4C1lfJ UHxoq4IIlo6Opwa0sqwpgc+9IIifprJxj2WjS2Jfbe1fOhtKxMeQKNxcpmwcgJaVHywM X60CMPAgFDusylnpnBs0nfOWf6kagiSwQlqiEtcGse56aqrOBJ7DpRr5LQegTupfTaGP 1gJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=OtLeSre2S74mgd3s3gUT97rB1yFOLl7gQYAYwnSWSpw=; b=gz/Fh/d/WNwmucw0vspwCEzMD3H89UMigWhIYB4PVJAIhvFRlAn9hqycm4gRvQrWap FCK+usJAd+uJiMsa/zq5b0bP3qGHxGYLnWEECzoSoLKt21sY3UfQP2x04kptr1FmhGV6 RPhYPFVE305WbE8r2qpSNO8R4J3+aCeFdr/95cQ9Jwdowb3iaIm/KlNsUuCmaE+LNY3C lIbLPlBqFB9L0rXqjgEM+fwoZwFKNkS4hccD9fhhfezvG6q/F9AVSfYH3wSjBhoQzz7N 9NBpvETBRxD9kWjWP0tt0oztX6czuZ2gNITLlz7nkYOtR7T8ww3aS08QUy1YguOLWuMt Tlgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a63514a000000b00476f2b0b330si16511086pgl.700.2022.11.29.13.07.42; Tue, 29 Nov 2022 13:07:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236439AbiK2UwK (ORCPT + 99 others); Tue, 29 Nov 2022 15:52:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236315AbiK2UwH (ORCPT ); Tue, 29 Nov 2022 15:52:07 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E08565FE7 for ; Tue, 29 Nov 2022 12:52:05 -0800 (PST) Received: from dslb-188-104-061-001.188.104.pools.vodafone-ip.de ([188.104.61.1] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1p07aC-0001pO-Aq; Tue, 29 Nov 2022 21:52:00 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 1/5] staging: r8188eu: use ieee80211_mgmt to parse addresses Date: Tue, 29 Nov 2022 21:51:48 +0100 Message-Id: <20221129205152.128172-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221129205152.128172-1-martin@kaiser.cx> References: <20221129205152.128172-1-martin@kaiser.cx> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750866148979611337?= X-GMAIL-MSGID: =?utf-8?q?1750866148979611337?= Define a struct ieee80211_mgmt in the OnDisassoc function and use it to parse the addresses in the incoming disassoc message. This replaces some driver-specific functions for address parsing. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index d32b2d569e23..b2b2cb57ed04 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1427,6 +1427,7 @@ static void OnDeAuth(struct adapter *padapter, struct recv_frame *precv_frame) static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) { + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; u16 reason; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -1434,8 +1435,7 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) u8 *pframe = precv_frame->rx_data; struct wifidirect_info *pwdinfo = &padapter->wdinfo; - /* check A3 */ - if (!(!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN))) + if (memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) return; if (pwdinfo->rx_invitereq_info.scan_op_ch_only) { @@ -1449,7 +1449,7 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; - psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); + psta = rtw_get_stainfo(pstapriv, mgmt->sa); if (psta) { u8 updated = 0; @@ -1466,7 +1466,7 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) return; } else { - receive_disconnect(padapter, GetAddr3Ptr(pframe), reason); + receive_disconnect(padapter, mgmt->bssid, reason); } pmlmepriv->LinkDetectInfo.bBusyTraffic = false; }