Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2417825pxu; Fri, 18 Dec 2020 12:46:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJeCPeEmvuvl3UZd5O5ZQNNVcCHJJifktqAvj8DkYn9IGgJ2y2OThoRrNOGppmpprDxu7u X-Received: by 2002:a17:906:cd06:: with SMTP id oz6mr5816270ejb.25.1608324392912; Fri, 18 Dec 2020 12:46:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608324392; cv=none; d=google.com; s=arc-20160816; b=TyzI/H4W15qMBv80bKATiQrfgyTNvRkoPGaHVZaqW5JS6UuX+vR/WAE4E46y6spJ0H 946hsqeZN6WLrx8PE599YnfHnMF1/CJcJxdZvedl2LY3Ybnys1Px1IVfAq0TU653ab7J SAC5/dCE+CNJZwZNwqOphjQ6mS07ZlOwGf7Nc1Zj8Z/Akod018VSH4MgcHkZEMRRJ1Zn gAZ3GibaxSuLeCAvrta+esgcKo1F3kBpqNuc4R/QIJ/3FubIjEGWItgTuwGNz9yJpfpQ CBrVTg6lD0GUU8f7eXxAefjZMCrvU1xKkCyC8JLmvu9WeZM+CVCUetfmgy5liTcmitHX 9/Bg== 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 :dkim-signature; bh=HbF0Y5fBQuQXRcCZJm9UpSMrQs/l1tNb13+JDexzE9o=; b=obq2q01a5QqtuHu4xLLHBjIHgRPNx+XlAe13wMnHQtzbZi1K9uKc+BEpfjC22/E3hI xT6mLI2Z9nL6PUvOxMTloDaPTKA/R4FT12cDIukjfl+R1G9fWLbQl5PSShBWwVo6elyI HZxec1cfVciFCDLAo5udc02wfxnngRIsDXDCZlpPv3nv3lQA8gxMRh2Loyst6foGWb5Z faTjZ7ltBHUN88ENOxk5C9SNTCDZccTySLP2qRWW+B16Q5n6k05vbh3vdqazocVcT8cw GSy6bJwt2nqyXqR0feUl68X+skHJwYmzv5VR3FuQNT3XiaBsYu4cbiT/6/d52LsyHm+1 J1oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=AY8hM4Ln; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si7254277edp.294.2020.12.18.12.46.10; Fri, 18 Dec 2020 12:46:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=AY8hM4Ln; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725953AbgLRSsd (ORCPT + 99 others); Fri, 18 Dec 2020 13:48:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbgLRSsc (ORCPT ); Fri, 18 Dec 2020 13:48:32 -0500 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B288CC0611C5 for ; Fri, 18 Dec 2020 10:47:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=HbF0Y5fBQuQXRcCZJm9UpSMrQs/l1tNb13+JDexzE9o=; b=AY8hM4LnxJ3C62coiNJheG0fYG J2pWWrKo9stx+NA5+S5szoYMHxsG3pj8nB2Iw59ua5fyBIwn6UlQH7WpZIs2uzQGqH1/W4nSSw/Ci vIpESe6jV8cw8N8UvKDSgKvPSo+7ppRbMB/2sMqtS3zqfEJYX4u9CmhPYNudUlkXXAqw=; Received: from p4ff13815.dip0.t-ipconnect.de ([79.241.56.21] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.89) (envelope-from ) id 1kqKmf-0000Fr-1b; Fri, 18 Dec 2020 19:47:21 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: toke@redhat.com Subject: [PATCH v2 4/6] mac80211: fix encryption key selection for 802.3 xmit Date: Fri, 18 Dec 2020 19:47:16 +0100 Message-Id: <20201218184718.93650-4-nbd@nbd.name> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201218184718.93650-1-nbd@nbd.name> References: <20201218184718.93650-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org When using WEP, the default unicast key needs to be selected, instead of the STA PTK. Signed-off-by: Felix Fietkau --- net/mac80211/tx.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 022b9b432c00..39c7059c644f 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -4235,7 +4235,6 @@ netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb, struct ethhdr *ehdr = (struct ethhdr *)skb->data; struct ieee80211_key *key; struct sta_info *sta; - bool offload = true; if (unlikely(skb->len < ETH_HLEN)) { kfree_skb(skb); @@ -4251,18 +4250,22 @@ netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb, if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded || !test_sta_flag(sta, WLAN_STA_AUTHORIZED) || - sdata->control_port_protocol == ehdr->h_proto)) - offload = false; - else if ((key = rcu_dereference(sta->ptk[sta->ptk_idx])) && - (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || - key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)) - offload = false; - - if (offload) - ieee80211_8023_xmit(sdata, dev, sta, key, skb); - else - ieee80211_subif_start_xmit(skb, dev); + sdata->control_port_protocol == ehdr->h_proto)) + goto skip_offload; + + key = rcu_dereference(sta->ptk[sta->ptk_idx]); + if (!key) + key = rcu_dereference(sdata->default_unicast_key); + + if (key && (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || + key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)) + goto skip_offload; + + ieee80211_8023_xmit(sdata, dev, sta, key, skb); + goto out; +skip_offload: + ieee80211_subif_start_xmit(skb, dev); out: rcu_read_unlock(); -- 2.28.0