Skip to content

Commit 6c02fab

Browse files
committed
wifi: mac80211: split ieee80211_drop_unencrypted_mgmt() return value
This has many different reasons, split the return value into the individual reasons for better traceability. Also, since symbolic tracing doesn't work for these, add a few comments for the numbering. Signed-off-by: Johannes Berg <[email protected]>
1 parent dccc9aa commit 6c02fab

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

net/mac80211/drop.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ typedef unsigned int __bitwise ieee80211_rx_result;
1818
/* this line for the trailing \ - add before this */
1919

2020
#define MAC80211_DROP_REASONS_UNUSABLE(R) \
21+
/* 0x00 == ___RX_DROP_UNUSABLE */ \
2122
R(RX_DROP_U_MIC_FAIL) \
2223
R(RX_DROP_U_REPLAY) \
2324
R(RX_DROP_U_BAD_MMIE) \
@@ -33,8 +34,15 @@ typedef unsigned int __bitwise ieee80211_rx_result;
3334
R(RX_DROP_U_BAD_AMSDU) \
3435
R(RX_DROP_U_BAD_AMSDU_CIPHER) \
3536
R(RX_DROP_U_INVALID_8023) \
37+
/* 0x10 */ \
3638
R(RX_DROP_U_RUNT_ACTION) \
3739
R(RX_DROP_U_UNPROT_ACTION) \
40+
R(RX_DROP_U_UNPROT_DUAL) \
41+
R(RX_DROP_U_UNPROT_UCAST_MGMT) \
42+
R(RX_DROP_U_UNPROT_MCAST_MGMT) \
43+
R(RX_DROP_U_UNPROT_BEACON) \
44+
R(RX_DROP_U_UNPROT_UNICAST_PUB_ACTION) \
45+
R(RX_DROP_U_UNPROT_ROBUST_ACTION) \
3846
R(RX_DROP_U_ACTION_UNKNOWN_SRC) \
3947
R(RX_DROP_U_REJECTED_ACTION_RESPONSE) \
4048
R(RX_DROP_U_EXPECT_DEFRAG_PROT) \
@@ -43,6 +51,7 @@ typedef unsigned int __bitwise ieee80211_rx_result;
4351
R(RX_DROP_U_NO_ICV) \
4452
R(RX_DROP_U_AP_RX_GROUPCAST) \
4553
R(RX_DROP_U_SHORT_MMIC) \
54+
/* 0x20 */ \
4655
R(RX_DROP_U_MMIC_FAIL) \
4756
R(RX_DROP_U_SHORT_TKIP) \
4857
R(RX_DROP_U_TKIP_FAIL) \

net/mac80211/rx.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,12 +2416,12 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
24162416
* decrypted them already.
24172417
*/
24182418
if (status->flag & RX_FLAG_DECRYPTED)
2419-
return 0;
2419+
return RX_CONTINUE;
24202420

24212421
/* drop unicast protected dual (that wasn't protected) */
24222422
if (ieee80211_is_action(fc) &&
24232423
mgmt->u.action.category == WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION)
2424-
return -EACCES;
2424+
return RX_DROP_U_UNPROT_DUAL;
24252425

24262426
if (rx->sta && test_sta_flag(rx->sta, WLAN_STA_MFP)) {
24272427
if (unlikely(!ieee80211_has_protected(fc) &&
@@ -2433,13 +2433,13 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
24332433
* during 4-way-HS (key is installed after HS).
24342434
*/
24352435
if (!rx->key)
2436-
return 0;
2436+
return RX_CONTINUE;
24372437

24382438
cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
24392439
rx->skb->data,
24402440
rx->skb->len);
24412441
}
2442-
return -EACCES;
2442+
return RX_DROP_U_UNPROT_UCAST_MGMT;
24432443
}
24442444
/* BIP does not use Protected field, so need to check MMIE */
24452445
if (unlikely(ieee80211_is_multicast_robust_mgmt_frame(rx->skb) &&
@@ -2449,28 +2449,28 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
24492449
cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
24502450
rx->skb->data,
24512451
rx->skb->len);
2452-
return -EACCES;
2452+
return RX_DROP_U_UNPROT_MCAST_MGMT;
24532453
}
24542454
if (unlikely(ieee80211_is_beacon(fc) && rx->key &&
24552455
ieee80211_get_mmie_keyidx(rx->skb) < 0)) {
24562456
cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
24572457
rx->skb->data,
24582458
rx->skb->len);
2459-
return -EACCES;
2459+
return RX_DROP_U_UNPROT_BEACON;
24602460
}
24612461
/*
24622462
* When using MFP, Action frames are not allowed prior to
24632463
* having configured keys.
24642464
*/
24652465
if (unlikely(ieee80211_is_action(fc) && !rx->key &&
24662466
ieee80211_is_robust_mgmt_frame(rx->skb)))
2467-
return -EACCES;
2467+
return RX_DROP_U_UNPROT_ACTION;
24682468

24692469
/* drop unicast public action frames when using MPF */
24702470
if (is_unicast_ether_addr(mgmt->da) &&
24712471
ieee80211_is_public_action((void *)rx->skb->data,
24722472
rx->skb->len))
2473-
return -EACCES;
2473+
return RX_DROP_U_UNPROT_UNICAST_PUB_ACTION;
24742474
}
24752475

24762476
return 0;
@@ -3400,10 +3400,7 @@ ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx)
34003400
rx->flags |= IEEE80211_RX_BEACON_REPORTED;
34013401
}
34023402

3403-
if (ieee80211_drop_unencrypted_mgmt(rx))
3404-
return RX_DROP_U_UNPROT_ACTION;
3405-
3406-
return RX_CONTINUE;
3403+
return ieee80211_drop_unencrypted_mgmt(rx);
34073404
}
34083405

34093406
static bool

0 commit comments

Comments
 (0)