311-mac80211-remove-drop_unencrypted-code.patch 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. From: Johannes Berg <[email protected]>
  2. Date: Fri, 20 Mar 2015 11:41:58 +0100
  3. Subject: [PATCH] mac80211: remove drop_unencrypted code
  4. This mechanism was historic, and only ever used by IBSS, which
  5. also doesn't need to have it as it properly manages station's
  6. 802.1X PAE state (or, with WEP, always has a key.)
  7. Remove the mechanism to clean up the code.
  8. Signed-off-by: Johannes Berg <[email protected]>
  9. ---
  10. --- a/net/mac80211/debugfs.c
  11. +++ b/net/mac80211/debugfs.c
  12. @@ -274,8 +274,6 @@ void debugfs_hw_add(struct ieee80211_loc
  13. #ifdef CPTCFG_MAC80211_DEBUG_COUNTERS
  14. DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
  15. DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
  16. - DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
  17. - local->tx_handlers_drop_unencrypted);
  18. DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
  19. local->tx_handlers_drop_fragment);
  20. DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
  21. --- a/net/mac80211/debugfs_netdev.c
  22. +++ b/net/mac80211/debugfs_netdev.c
  23. @@ -177,7 +177,6 @@ static ssize_t ieee80211_if_write_##name
  24. IEEE80211_IF_FILE_R(name)
  25. /* common attributes */
  26. -IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
  27. IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
  28. HEX);
  29. IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
  30. @@ -562,7 +561,6 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDu
  31. static void add_common_files(struct ieee80211_sub_if_data *sdata)
  32. {
  33. - DEBUGFS_ADD(drop_unencrypted);
  34. DEBUGFS_ADD(rc_rateidx_mask_2ghz);
  35. DEBUGFS_ADD(rc_rateidx_mask_5ghz);
  36. DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
  37. --- a/net/mac80211/ibss.c
  38. +++ b/net/mac80211/ibss.c
  39. @@ -249,8 +249,6 @@ static void __ieee80211_sta_join_ibss(st
  40. if (presp)
  41. kfree_rcu(presp, rcu_head);
  42. - sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
  43. -
  44. /* make a copy of the chandef, it could be modified below. */
  45. chandef = *req_chandef;
  46. chan = chandef.chan;
  47. @@ -1289,8 +1287,6 @@ static void ieee80211_sta_create_ibss(st
  48. if (ifibss->privacy)
  49. capability |= WLAN_CAPABILITY_PRIVACY;
  50. - else
  51. - sdata->drop_unencrypted = 0;
  52. __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
  53. &ifibss->chandef, ifibss->basic_rates,
  54. --- a/net/mac80211/ieee80211_i.h
  55. +++ b/net/mac80211/ieee80211_i.h
  56. @@ -842,8 +842,6 @@ struct ieee80211_sub_if_data {
  57. unsigned long state;
  58. - int drop_unencrypted;
  59. -
  60. char name[IFNAMSIZ];
  61. /* Fragment table for host-based reassembly */
  62. @@ -1289,7 +1287,6 @@ struct ieee80211_local {
  63. /* TX/RX handler statistics */
  64. unsigned int tx_handlers_drop;
  65. unsigned int tx_handlers_queued;
  66. - unsigned int tx_handlers_drop_unencrypted;
  67. unsigned int tx_handlers_drop_fragment;
  68. unsigned int tx_handlers_drop_wep;
  69. unsigned int tx_handlers_drop_not_assoc;
  70. --- a/net/mac80211/iface.c
  71. +++ b/net/mac80211/iface.c
  72. @@ -1535,7 +1535,6 @@ int ieee80211_if_change_type(struct ieee
  73. }
  74. /* reset some values that shouldn't be kept across type changes */
  75. - sdata->drop_unencrypted = 0;
  76. if (type == NL80211_IFTYPE_STATION)
  77. sdata->u.mgd.use_4addr = false;
  78. --- a/net/mac80211/rx.c
  79. +++ b/net/mac80211/rx.c
  80. @@ -1897,8 +1897,7 @@ static int ieee80211_drop_unencrypted(st
  81. /* Drop unencrypted frames if key is set. */
  82. if (unlikely(!ieee80211_has_protected(fc) &&
  83. !ieee80211_is_nullfunc(fc) &&
  84. - ieee80211_is_data(fc) &&
  85. - (rx->key || rx->sdata->drop_unencrypted)))
  86. + ieee80211_is_data(fc) && rx->key))
  87. return -EACCES;
  88. return 0;
  89. --- a/net/mac80211/tx.c
  90. +++ b/net/mac80211/tx.c
  91. @@ -594,23 +594,8 @@ ieee80211_tx_h_select_key(struct ieee802
  92. else if (!is_multicast_ether_addr(hdr->addr1) &&
  93. (key = rcu_dereference(tx->sdata->default_unicast_key)))
  94. tx->key = key;
  95. - else if (info->flags & IEEE80211_TX_CTL_INJECTED)
  96. + else
  97. tx->key = NULL;
  98. - else if (!tx->sdata->drop_unencrypted)
  99. - tx->key = NULL;
  100. - else if (tx->skb->protocol == tx->sdata->control_port_protocol)
  101. - tx->key = NULL;
  102. - else if (ieee80211_is_robust_mgmt_frame(tx->skb) &&
  103. - !(ieee80211_is_action(hdr->frame_control) &&
  104. - tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))
  105. - tx->key = NULL;
  106. - else if (ieee80211_is_mgmt(hdr->frame_control) &&
  107. - !ieee80211_is_robust_mgmt_frame(tx->skb))
  108. - tx->key = NULL;
  109. - else {
  110. - I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
  111. - return TX_DROP;
  112. - }
  113. if (tx->key) {
  114. bool skip_hw = false;