diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-07-04 12:10:07 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-07-12 06:10:47 -0400 |
commit | 46e6de159ddebc179cbae60fd7b728f57c39964b (patch) | |
tree | dc2eacdf8e10b3d4bf38f3df44bd7d59b448a3f0 /net/mac80211 | |
parent | 8c358bcd097fa1f63e57fb82525ba52f4a537bfa (diff) |
mac80211: restructure key selection
The "no key" case in key selection that decides
whether to drop the frame or not is impossible
to understand, restructure the code.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[cavallar@lri.fr: removed blank line and restructured action frame clause]
Signed-off-by: Nicolas Cavallari <cavallar@lri.fr>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/tx.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index c9d2175d15c1..a79fd868566d 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -523,7 +523,7 @@ ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx) | |||
523 | static ieee80211_tx_result debug_noinline | 523 | static ieee80211_tx_result debug_noinline |
524 | ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | 524 | ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) |
525 | { | 525 | { |
526 | struct ieee80211_key *key = NULL; | 526 | struct ieee80211_key *key; |
527 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 527 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
528 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | 528 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; |
529 | 529 | ||
@@ -542,16 +542,20 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
542 | else if (!is_multicast_ether_addr(hdr->addr1) && | 542 | else if (!is_multicast_ether_addr(hdr->addr1) && |
543 | (key = rcu_dereference(tx->sdata->default_unicast_key))) | 543 | (key = rcu_dereference(tx->sdata->default_unicast_key))) |
544 | tx->key = key; | 544 | tx->key = key; |
545 | else if (tx->sdata->drop_unencrypted && | 545 | else if (info->flags & IEEE80211_TX_CTL_INJECTED) |
546 | (tx->skb->protocol != tx->sdata->control_port_protocol) && | 546 | tx->key = NULL; |
547 | !(info->flags & IEEE80211_TX_CTL_INJECTED) && | 547 | else if (!tx->sdata->drop_unencrypted) |
548 | (!ieee80211_is_robust_mgmt_frame(hdr) || | 548 | tx->key = NULL; |
549 | (ieee80211_is_action(hdr->frame_control) && | 549 | else if (tx->skb->protocol == tx->sdata->control_port_protocol) |
550 | tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))) { | 550 | tx->key = NULL; |
551 | else if (ieee80211_is_robust_mgmt_frame(hdr) && | ||
552 | !(ieee80211_is_action(hdr->frame_control) && | ||
553 | tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP))) | ||
554 | tx->key = NULL; | ||
555 | else { | ||
551 | I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); | 556 | I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); |
552 | return TX_DROP; | 557 | return TX_DROP; |
553 | } else | 558 | } |
554 | tx->key = NULL; | ||
555 | 559 | ||
556 | if (tx->key) { | 560 | if (tx->key) { |
557 | bool skip_hw = false; | 561 | bool skip_hw = false; |