From: "John W. Linville" <linville@tuxdriver.com>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, flamingice@sourmilk.net,
"John W. Linville" <linville@tuxdriver.com>
Subject: [RFC] mac80211: no decrypt failed complaint if frame may not be for us
Date: Tue, 23 Oct 2007 17:46:21 -0400 [thread overview]
Message-ID: <11931759811502-git-send-email-linville@tuxdriver.com> (raw)
In-Reply-To: <1193175981828-git-send-email-linville@tuxdriver.com>
From: John W. Linville <linville@tuxdriver.com>
Please see changelog entry for "mac80211: no missing key complaint if
frame may not be for us" for background information.
If multiple protected SSIDs share a BSSID, then each will see the
other's encrypted multicast traffic. Rather than complain about being
unable to decrypt multicast traffic which may not be for us, just keep
quiet.
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
net/mac80211/wep.c | 11 ++++++++++-
net/mac80211/wpa.c | 27 +++++++++++++++++++++------
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 6675261..4b75ccb 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -311,6 +311,8 @@ u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key)
ieee80211_txrx_result
ieee80211_crypto_wep_decrypt(struct ieee80211_txrx_data *rx)
{
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
+
if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA &&
((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT ||
(rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH))
@@ -318,7 +320,14 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_txrx_data *rx)
if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) {
if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) {
- if (net_ratelimit())
+ /* if there are multiple SSIDs on this BSSID,
+ the frame may not be for us anyway; so, check
+ that either the frame is unicast or that we
+ are not in managed mode before complaining
+ about a missing key */
+ if ((!is_multicast_ether_addr(hdr->addr1) ||
+ rx->sdata->type != IEEE80211_IF_TYPE_STA) &&
+ net_ratelimit())
printk(KERN_DEBUG "%s: RX WEP frame, decrypt "
"failed\n", rx->dev->name);
return TXRX_DROP;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 0b32ab6..2d5bf83 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -321,9 +321,16 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_txrx_data *rx)
&rx->u.rx.tkip_iv32,
&rx->u.rx.tkip_iv16);
if (res != TKIP_DECRYPT_OK || wpa_test) {
- printk(KERN_DEBUG "%s: TKIP decrypt failed for RX frame from "
- MAC_FMT " (res=%d)\n",
- rx->dev->name, MAC_ARG(rx->sta->addr), res);
+ /* if there are multiple SSIDs on this BSSID, the
+ frame may not be for us anyway; so, check that either
+ the frame is unicast or that we are not in managed
+ mode before complaining about a missing key */
+ if ((!is_multicast_ether_addr(hdr->addr1) ||
+ rx->sdata->type != IEEE80211_IF_TYPE_STA) &&
+ net_ratelimit())
+ printk(KERN_DEBUG "%s: TKIP decrypt failed for RX "
+ "frame from " MAC_FMT " (res=%d)\n",
+ rx->dev->name, MAC_ARG(rx->sta->addr), res);
return TXRX_DROP;
}
@@ -590,9 +597,17 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_txrx_data *rx)
skb->data + hdrlen + CCMP_HDR_LEN, data_len,
skb->data + skb->len - CCMP_MIC_LEN,
skb->data + hdrlen + CCMP_HDR_LEN)) {
- printk(KERN_DEBUG "%s: CCMP decrypt failed for RX "
- "frame from " MAC_FMT "\n", rx->dev->name,
- MAC_ARG(rx->sta->addr));
+ /* if there are multiple SSIDs on this BSSID,
+ the frame may not be for us anyway; so, check
+ that either the frame is unicast or that we
+ are not in managed mode before complaining
+ about a missing key */
+ if ((!is_multicast_ether_addr(hdr->addr1) ||
+ rx->sdata->type != IEEE80211_IF_TYPE_STA) &&
+ net_ratelimit())
+ printk(KERN_DEBUG "%s: CCMP decrypt failed "
+ "for RX frame from " MAC_FMT "\n",
+ rx->dev->name, MAC_ARG(rx->sta->addr));
return TXRX_DROP;
}
}
--
1.5.2.4
next prev parent reply other threads:[~2007-10-23 22:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-23 21:46 [RFC] mac80211: no missing key complaint if frame may not be for us John W. Linville
2007-10-23 21:46 ` John W. Linville [this message]
2007-10-24 9:00 ` Johannes Berg
2007-10-24 13:48 ` John W. Linville
2007-10-25 13:25 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11931759811502-git-send-email-linville@tuxdriver.com \
--to=linville@tuxdriver.com \
--cc=flamingice@sourmilk.net \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).