From patchwork Wed Feb 18 13:02:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5843971 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 26214BF440 for ; Wed, 18 Feb 2015 13:14:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50DB52025A for ; Wed, 18 Feb 2015 13:14:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 495AD2021F for ; Wed, 18 Feb 2015 13:14:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YO4Sl-0006lJ-T2; Wed, 18 Feb 2015 13:14:47 +0000 Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YO4Sj-0006gM-2z for ath10k@lists.infradead.org; Wed, 18 Feb 2015 13:14:46 +0000 Received: by mail-wg0-f54.google.com with SMTP id y19so993892wgg.13 for ; Wed, 18 Feb 2015 05:14:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L6mCLcCQfjc3BQNqGNO+5PFJ+ngnWyD/kNd/zMuS66g=; b=O0zJ/XYJYSD39tn+6hn4F54o19Eeuva8P6XhPmSy8sKUqrf7nwCE8wkCPl23RHM6EZ XImc2RuV8mEWkXURZVU1JfZKHHtPwyc9oF/VrIbpIwlEN2TzwojHvHNgCLDTEZwcxilt ZJkq0oz20TSxN9zdSR5/j2kcKyxaH5y2fcRP0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L6mCLcCQfjc3BQNqGNO+5PFJ+ngnWyD/kNd/zMuS66g=; b=YmZzJeK6utyKcfXS9jPJQIXXM6r33QgYtwnTargOuskWV7kgITr+qZoHgC/2bqFUXs bU/aSy2R54aCpg8RRC6q92/+gQ3bXcvSleabXzEDohcWs5zNb8uDrzQMXvZdktsVyair Bv0hg1WYbTG5gUQc8IvuDYLMtXyjhck0xgFZwfpMNsZiEpsTSHUJTakURGKjfb9FTxBm XTfEfR5UCqfGHdch4q+7nSozafvOVJsvD8a4mpquHdxcmQcFjU4MGICW3mMoaXtQeVxB jx8mczKlMTFW7lwJQlr+gHJiIlThMPL/HGy78SWxz1gAxlaiEdoKuMCiQ2l8Zgh4+3Xl ky7A== X-Gm-Message-State: ALoCoQmVxt3o+brtFmDoIEBvDnLJx5hQq4do4js76yD0Bww3HrlZaHYY/x81KxxQU2aijNO6QEatc647Fc+cDgXyxLi271KEvVyi2cogmtQaZAyBTPfHlzDvsfnmWLYax/6UmUyFJ6d4Q4qn6S/QL/JB1ka/f+Bk5YgA9xPTiKxDO/qvIQNfhaQ= X-Received: by 10.180.98.5 with SMTP id ee5mr4912993wib.11.1424265262436; Wed, 18 Feb 2015 05:14:22 -0800 (PST) Received: from bob.homerouter.cpe (apn-31-1-134-151.dynamic.gprs.plus.pl. [31.1.134.151]) by mx.google.com with ESMTPSA id qb8sm26519494wjc.4.2015.02.18.05.14.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Feb 2015 05:14:21 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH 2/2] ath10k: fix broken traffic for static WEP in IBSS Date: Wed, 18 Feb 2015 14:02:27 +0100 Message-Id: <1424264547-2932-2-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1424264547-2932-1-git-send-email-michal.kazior@tieto.com> References: <1424264547-2932-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150218_051445_292088_A0AD3F0B X-CRM114-Status: UNSURE ( 9.96 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) Cc: linux-wireless@vger.kernel.org, Michal Kazior X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When WEP keys are uploaded it's possible that there are stations associated already (e.g. when merging) without any keys. Static WEP needs an explicit per-peer key upload. Make sure to re-upload wep keys if necessary. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 733c79d..e7e7d92 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -297,6 +297,39 @@ static int ath10k_mac_vif_sta_fix_wep_key(struct ath10k_vif *arvif) return 0; } +static int ath10k_mac_vif_update_wep_key(struct ath10k_vif *arvif, + struct ieee80211_key_conf *key) +{ + struct ath10k *ar = arvif->ar; + struct ath10k_peer *peer; + int ret; + + lockdep_assert_held(&ar->conf_mutex); + + list_for_each_entry(peer, &ar->peers, list) { + if (!memcmp(peer->addr, arvif->vif->addr, ETH_ALEN)) + continue; + + if (!memcmp(peer->addr, arvif->bssid, ETH_ALEN)) + continue; + + if (peer->keys[key->keyidx] == key) + continue; + + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vif vdev %i update key %i needs update\n", + arvif->vdev_id, key->keyidx); + + ret = ath10k_install_peer_wep_keys(arvif, peer->addr); + if (ret) { + ath10k_warn(ar, "failed to update wep keys on vdev %i for peer %pM: %d\n", + arvif->vdev_id, peer->addr, ret); + return ret; + } + } + + return 0; +} + /*********************/ /* General utilities */ /*********************/ @@ -3862,6 +3895,14 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, if (cmd == DISABLE_KEY) ath10k_clear_vdev_key(arvif, key); + /* When WEP keys are uploaded it's possible that there are + * stations associated already (e.g. when merging) without any + * keys. Static WEP needs an explicit per-peer key upload. + */ + if (vif->type == NL80211_IFTYPE_ADHOC && + cmd == SET_KEY) + ath10k_mac_vif_update_wep_key(arvif, key); + /* 802.1x never sets the def_wep_key_idx so each set_key() * call changes default tx key. *