Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: mac80211: Drop cooked monitor support

Hostapd switched from cooked monitor interfaces to nl80211 Dec 2011.
Drop support for the outdated cooked monitor interfaces and fix
creating the virtual monitor interfaces in the following cases:

1) We have one non-monitor and one monitor interface with
%MONITOR_FLAG_ACTIVE enabled and then delete the non-monitor
interface.

2) We only have monitor interfaces enabled on resume while at least one
has %MONITOR_FLAG_ACTIVE set.

Signed-off-by: Alexander Wetzel <Alexander@wetzel-home.de>
Link: https://patch.msgid.link/20250204111352.7004-2-Alexander@wetzel-home.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Alexander Wetzel and committed by
Johannes Berg
286e6967 be22179c

+94 -249
-6
include/net/dropreason.h
··· 18 18 SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE, 19 19 20 20 /** 21 - * @SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR: mac80211 drop reasons 22 - * for frames still going to monitor, see net/mac80211/drop.h 23 - */ 24 - SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR, 25 - 26 - /** 27 21 * @SKB_DROP_REASON_SUBSYS_OPENVSWITCH: openvswitch drop reasons, 28 22 * see net/openvswitch/drop.h 29 23 */
+4 -5
net/mac80211/cfg.c
··· 89 89 90 90 /* check flags first */ 91 91 if (params->flags && ieee80211_sdata_running(sdata)) { 92 - u32 mask = MONITOR_FLAG_COOK_FRAMES | MONITOR_FLAG_ACTIVE; 92 + u32 mask = MONITOR_FLAG_ACTIVE; 93 93 94 94 /* 95 - * Prohibit MONITOR_FLAG_COOK_FRAMES and 96 - * MONITOR_FLAG_ACTIVE to be changed while the 97 - * interface is up. 95 + * Prohibit MONITOR_FLAG_ACTIVE to be changed 96 + * while the interface is up. 98 97 * Else we would need to add a lot of cruft 99 98 * to update everything: 100 - * cooked_mntrs, monitor and all fif_* counters 99 + * monitor and all fif_* counters 101 100 * reconfigure hardware 102 101 */ 103 102 if ((params->flags & mask) != (sdata->u.mntr.flags & mask))
+7 -14
net/mac80211/drop.h
··· 11 11 12 12 typedef unsigned int __bitwise ieee80211_rx_result; 13 13 14 - #define MAC80211_DROP_REASONS_MONITOR(R) \ 15 - R(RX_DROP_M_UNEXPECTED_4ADDR_FRAME) \ 16 - R(RX_DROP_M_BAD_BCN_KEYIDX) \ 17 - R(RX_DROP_M_BAD_MGMT_KEYIDX) \ 18 - /* this line for the trailing \ - add before this */ 19 - 20 14 #define MAC80211_DROP_REASONS_UNUSABLE(R) \ 21 15 /* 0x00 == ___RX_DROP_UNUSABLE */ \ 22 16 R(RX_DROP_U_MIC_FAIL) \ ··· 60 66 R(RX_DROP_U_UNEXPECTED_STA_4ADDR) \ 61 67 R(RX_DROP_U_UNEXPECTED_VLAN_MCAST) \ 62 68 R(RX_DROP_U_NOT_PORT_CONTROL) \ 69 + R(RX_DROP_U_UNEXPECTED_4ADDR_FRAME) \ 70 + R(RX_DROP_U_BAD_BCN_KEYIDX) \ 71 + /* 0x30 */ \ 72 + R(RX_DROP_U_BAD_MGMT_KEYIDX) \ 63 73 R(RX_DROP_U_UNKNOWN_ACTION_REJECTED) \ 64 74 /* this line for the trailing \ - add before this */ 65 75 ··· 76 78 ___RX_QUEUED = SKB_NOT_DROPPED_YET, 77 79 78 80 #define ENUM(x) ___ ## x, 79 - ___RX_DROP_MONITOR = SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR << 80 - SKB_DROP_REASON_SUBSYS_SHIFT, 81 - MAC80211_DROP_REASONS_MONITOR(ENUM) 82 - 83 81 ___RX_DROP_UNUSABLE = SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE << 84 82 SKB_DROP_REASON_SUBSYS_SHIFT, 85 83 MAC80211_DROP_REASONS_UNUSABLE(ENUM) ··· 83 89 }; 84 90 85 91 enum mac80211_drop_reason { 86 - RX_CONTINUE = (__force ieee80211_rx_result)___RX_CONTINUE, 87 - RX_QUEUED = (__force ieee80211_rx_result)___RX_QUEUED, 88 - RX_DROP_MONITOR = (__force ieee80211_rx_result)___RX_DROP_MONITOR, 92 + RX_CONTINUE = (__force ieee80211_rx_result)___RX_CONTINUE, 93 + RX_QUEUED = (__force ieee80211_rx_result)___RX_QUEUED, 94 + RX_DROP = (__force ieee80211_rx_result)___RX_DROP_UNUSABLE, 89 95 #define DEF(x) x = (__force ieee80211_rx_result)___ ## x, 90 - MAC80211_DROP_REASONS_MONITOR(DEF) 91 96 MAC80211_DROP_REASONS_UNUSABLE(DEF) 92 97 #undef DEF 93 98 };
+4 -7
net/mac80211/ieee80211_i.h
··· 200 200 /** 201 201 * enum ieee80211_rx_flags - RX data flags 202 202 * 203 - * @IEEE80211_RX_CMNTR: received on cooked monitor already 204 203 * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported 205 204 * to cfg80211_report_obss_beacon(). 206 205 * ··· 207 208 * for a single frame. 208 209 */ 209 210 enum ieee80211_rx_flags { 210 - IEEE80211_RX_CMNTR = BIT(0), 211 - IEEE80211_RX_BEACON_REPORTED = BIT(1), 211 + IEEE80211_RX_BEACON_REPORTED = BIT(0), 212 212 }; 213 213 214 214 struct ieee80211_rx_data { ··· 1378 1380 spinlock_t queue_stop_reason_lock; 1379 1381 1380 1382 int open_count; 1381 - int monitors, cooked_mntrs, tx_mntrs; 1383 + int monitors, tx_mntrs; 1382 1384 /* number of interfaces with corresponding FIF_ flags */ 1383 1385 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll, 1384 1386 fif_probe_req; ··· 1490 1492 1491 1493 /* see iface.c */ 1492 1494 struct list_head interfaces; 1493 - struct list_head mon_list; /* only that are IFF_UP && !cooked */ 1495 + struct list_head mon_list; /* only that are IFF_UP */ 1494 1496 struct mutex iflist_mtx; 1495 1497 1496 1498 /* Scanning and BSS list */ ··· 2088 2090 ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata, 2089 2091 struct sk_buff *skb, u32 info_flags); 2090 2092 void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb, 2091 - int retry_count, bool send_to_cooked, 2092 - struct ieee80211_tx_status *status); 2093 + int retry_count, struct ieee80211_tx_status *status); 2093 2094 2094 2095 void ieee80211_check_fast_xmit(struct sta_info *sta); 2095 2096 void ieee80211_check_fast_xmit_all(struct ieee80211_local *local);
+21 -29
net/mac80211/iface.c
··· 483 483 ieee80211_ibss_stop(sdata); 484 484 break; 485 485 case NL80211_IFTYPE_MONITOR: 486 - if (sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) 487 - break; 488 486 list_del_rcu(&sdata->u.mntr.list); 489 487 break; 490 488 default: ··· 582 584 /* no need to tell driver */ 583 585 break; 584 586 case NL80211_IFTYPE_MONITOR: 585 - if (sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) { 586 - local->cooked_mntrs--; 587 - break; 588 - } 587 + if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE) && 588 + !ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR)) { 589 589 590 - local->monitors--; 591 - if (local->monitors == 0) { 592 - local->hw.conf.flags &= ~IEEE80211_CONF_MONITOR; 593 - hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR; 594 - } 590 + local->monitors--; 591 + if (local->monitors == 0) { 592 + local->hw.conf.flags &= ~IEEE80211_CONF_MONITOR; 593 + hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR; 594 + } 595 595 596 - ieee80211_adjust_monitor_flags(sdata, -1); 596 + ieee80211_adjust_monitor_flags(sdata, -1); 597 + } 597 598 break; 598 599 case NL80211_IFTYPE_NAN: 599 600 /* clean all the functions */ ··· 1323 1326 } 1324 1327 break; 1325 1328 case NL80211_IFTYPE_MONITOR: 1326 - if (sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) { 1327 - local->cooked_mntrs++; 1328 - break; 1329 - } 1330 - 1331 1329 if ((sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE) || 1332 1330 ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR)) { 1333 1331 res = drv_add_interface(local, sdata); 1334 1332 if (res) 1335 1333 goto err_stop; 1336 - } else if (local->monitors == 0 && local->open_count == 0) { 1337 - res = ieee80211_add_virtual_monitor(local); 1338 - if (res) 1339 - goto err_stop; 1340 - } 1334 + } else { 1335 + if (local->monitors == 0 && local->open_count == 0) { 1336 + res = ieee80211_add_virtual_monitor(local); 1337 + if (res) 1338 + goto err_stop; 1339 + } 1340 + local->monitors++; 1341 1341 1342 - /* must be before the call to ieee80211_configure_filter */ 1343 - local->monitors++; 1344 - if (local->monitors == 1) { 1345 - local->hw.conf.flags |= IEEE80211_CONF_MONITOR; 1346 - hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR; 1342 + /* must be before the call to ieee80211_configure_filter */ 1343 + if (local->monitors == 1) { 1344 + local->hw.conf.flags |= IEEE80211_CONF_MONITOR; 1345 + hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR; 1346 + } 1347 1347 } 1348 1348 1349 1349 ieee80211_adjust_monitor_flags(sdata, 1); ··· 1417 1423 rcu_assign_pointer(local->p2p_sdata, sdata); 1418 1424 break; 1419 1425 case NL80211_IFTYPE_MONITOR: 1420 - if (sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) 1421 - break; 1422 1426 list_add_tail_rcu(&sdata->u.mntr.list, &local->mon_list); 1423 1427 break; 1424 1428 default:
+1 -15
net/mac80211/main.c
··· 1744 1744 wiphy_free(local->hw.wiphy); 1745 1745 } 1746 1746 EXPORT_SYMBOL(ieee80211_free_hw); 1747 - 1748 - static const char * const drop_reasons_monitor[] = { 1749 - #define V(x) #x, 1750 - [0] = "RX_DROP_MONITOR", 1751 - MAC80211_DROP_REASONS_MONITOR(V) 1752 - }; 1753 - 1754 - static struct drop_reason_list drop_reason_list_monitor = { 1755 - .reasons = drop_reasons_monitor, 1756 - .n_reasons = ARRAY_SIZE(drop_reasons_monitor), 1757 - }; 1758 - 1747 + #define V(x) #x, 1759 1748 static const char * const drop_reasons_unusable[] = { 1760 1749 [0] = "RX_DROP_UNUSABLE", 1761 1750 MAC80211_DROP_REASONS_UNUSABLE(V) ··· 1773 1784 if (ret) 1774 1785 goto err_netdev; 1775 1786 1776 - drop_reasons_register_subsys(SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR, 1777 - &drop_reason_list_monitor); 1778 1787 drop_reasons_register_subsys(SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE, 1779 1788 &drop_reason_list_unusable); 1780 1789 ··· 1791 1804 1792 1805 ieee80211_iface_exit(); 1793 1806 1794 - drop_reasons_unregister_subsys(SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR); 1795 1807 drop_reasons_unregister_subsys(SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE); 1796 1808 1797 1809 rcu_barrier();
+51 -143
net/mac80211/rx.c
··· 1045 1045 if (is_multicast_ether_addr(hdr->addr1)) { 1046 1046 if (ieee80211_has_tods(hdr->frame_control) || 1047 1047 !ieee80211_has_fromds(hdr->frame_control)) 1048 - return RX_DROP_MONITOR; 1048 + return RX_DROP; 1049 1049 if (ether_addr_equal(hdr->addr3, dev_addr)) 1050 - return RX_DROP_MONITOR; 1050 + return RX_DROP; 1051 1051 } else { 1052 1052 if (!ieee80211_has_a4(hdr->frame_control)) 1053 - return RX_DROP_MONITOR; 1053 + return RX_DROP; 1054 1054 if (ether_addr_equal(hdr->addr4, dev_addr)) 1055 - return RX_DROP_MONITOR; 1055 + return RX_DROP; 1056 1056 } 1057 1057 } 1058 1058 ··· 1064 1064 struct ieee80211_mgmt *mgmt; 1065 1065 1066 1066 if (!ieee80211_is_mgmt(hdr->frame_control)) 1067 - return RX_DROP_MONITOR; 1067 + return RX_DROP; 1068 1068 1069 1069 if (ieee80211_is_action(hdr->frame_control)) { 1070 1070 u8 category; 1071 1071 1072 1072 /* make sure category field is present */ 1073 1073 if (rx->skb->len < IEEE80211_MIN_ACTION_SIZE) 1074 - return RX_DROP_MONITOR; 1074 + return RX_DROP; 1075 1075 1076 1076 mgmt = (struct ieee80211_mgmt *)hdr; 1077 1077 category = mgmt->u.action.category; 1078 1078 if (category != WLAN_CATEGORY_MESH_ACTION && 1079 1079 category != WLAN_CATEGORY_SELF_PROTECTED) 1080 - return RX_DROP_MONITOR; 1080 + return RX_DROP; 1081 1081 return RX_CONTINUE; 1082 1082 } 1083 1083 ··· 1087 1087 ieee80211_is_auth(hdr->frame_control)) 1088 1088 return RX_CONTINUE; 1089 1089 1090 - return RX_DROP_MONITOR; 1090 + return RX_DROP; 1091 1091 } 1092 1092 1093 1093 return RX_CONTINUE; ··· 1513 1513 hdrlen = ieee80211_hdrlen(hdr->frame_control); 1514 1514 1515 1515 if (rx->skb->len < hdrlen + 8) 1516 - return RX_DROP_MONITOR; 1516 + return RX_DROP; 1517 1517 1518 1518 skb_copy_bits(rx->skb, hdrlen + 6, &ethertype, 2); 1519 1519 if (ethertype == rx->sdata->control_port_protocol) ··· 1526 1526 GFP_ATOMIC)) 1527 1527 return RX_DROP_U_SPURIOUS; 1528 1528 1529 - return RX_DROP_MONITOR; 1529 + return RX_DROP; 1530 1530 } 1531 1531 1532 1532 return RX_CONTINUE; ··· 1862 1862 cfg80211_rx_unexpected_4addr_frame( 1863 1863 rx->sdata->dev, sta->sta.addr, 1864 1864 GFP_ATOMIC); 1865 - return RX_DROP_M_UNEXPECTED_4ADDR_FRAME; 1865 + return RX_DROP_U_UNEXPECTED_4ADDR_FRAME; 1866 1866 } 1867 1867 /* 1868 1868 * Update counter and free packet here to avoid ··· 1997 1997 cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev, 1998 1998 skb->data, 1999 1999 skb->len); 2000 - return RX_DROP_M_BAD_BCN_KEYIDX; 2000 + return RX_DROP_U_BAD_BCN_KEYIDX; 2001 2001 } 2002 2002 2003 2003 rx->key = ieee80211_rx_get_bigtk(rx, mmie_keyidx); ··· 2011 2011 2012 2012 if (mmie_keyidx < NUM_DEFAULT_KEYS || 2013 2013 mmie_keyidx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) 2014 - return RX_DROP_M_BAD_MGMT_KEYIDX; /* unexpected BIP keyidx */ 2014 + return RX_DROP_U_BAD_MGMT_KEYIDX; /* unexpected BIP keyidx */ 2015 2015 if (rx->link_sta) { 2016 2016 if (ieee80211_is_group_privacy_action(skb) && 2017 2017 test_sta_flag(rx->sta, WLAN_STA_MFP)) 2018 - return RX_DROP_MONITOR; 2018 + return RX_DROP; 2019 2019 2020 2020 rx->key = rcu_dereference(rx->link_sta->gtk[mmie_keyidx]); 2021 2021 } ··· 2100 2100 2101 2101 if (rx->key) { 2102 2102 if (unlikely(rx->key->flags & KEY_FLAG_TAINTED)) 2103 - return RX_DROP_MONITOR; 2103 + return RX_DROP; 2104 2104 2105 2105 /* TODO: add threshold stuff again */ 2106 2106 } else { 2107 - return RX_DROP_MONITOR; 2107 + return RX_DROP; 2108 2108 } 2109 2109 2110 2110 switch (rx->key->conf.cipher) { ··· 2278 2278 goto out; 2279 2279 2280 2280 if (is_multicast_ether_addr(hdr->addr1)) 2281 - return RX_DROP_MONITOR; 2281 + return RX_DROP; 2282 2282 2283 2283 I802_DEBUG_INC(rx->local->rx_handlers_fragments); 2284 2284 ··· 2333 2333 rx->seqno_idx, hdr); 2334 2334 if (!entry) { 2335 2335 I802_DEBUG_INC(rx->local->rx_handlers_drop_defrag); 2336 - return RX_DROP_MONITOR; 2336 + return RX_DROP; 2337 2337 } 2338 2338 2339 2339 /* "The receiver shall discard MSDUs and MMPDUs whose constituent ··· 2855 2855 return RX_CONTINUE; 2856 2856 2857 2857 if (!pskb_may_pull(skb, sizeof(*eth) + 6)) 2858 - return RX_DROP_MONITOR; 2858 + return RX_DROP; 2859 2859 2860 2860 mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(*eth)); 2861 2861 mesh_hdrlen = ieee80211_get_mesh_hdrlen(mesh_hdr); 2862 2862 2863 2863 if (!pskb_may_pull(skb, sizeof(*eth) + mesh_hdrlen)) 2864 - return RX_DROP_MONITOR; 2864 + return RX_DROP; 2865 2865 2866 2866 eth = (struct ethhdr *)skb->data; 2867 2867 multicast = is_multicast_ether_addr(eth->h_dest); 2868 2868 2869 2869 mesh_hdr = (struct ieee80211s_hdr *)(eth + 1); 2870 2870 if (!mesh_hdr->ttl) 2871 - return RX_DROP_MONITOR; 2871 + return RX_DROP; 2872 2872 2873 2873 /* frame is in RMC, don't forward */ 2874 2874 if (is_multicast_ether_addr(eth->h_dest) && 2875 2875 mesh_rmc_check(sdata, eth->h_source, mesh_hdr)) 2876 - return RX_DROP_MONITOR; 2876 + return RX_DROP; 2877 2877 2878 2878 /* forward packet */ 2879 2879 if (sdata->crypto_tx_tailroom_needed_cnt) ··· 2890 2890 /* has_a4 already checked in ieee80211_rx_mesh_check */ 2891 2891 proxied_addr = mesh_hdr->eaddr2; 2892 2892 else 2893 - return RX_DROP_MONITOR; 2893 + return RX_DROP; 2894 2894 2895 2895 rcu_read_lock(); 2896 2896 mppath = mpp_path_lookup(sdata, proxied_addr); ··· 2922 2922 goto rx_accept; 2923 2923 2924 2924 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); 2925 - return RX_DROP_MONITOR; 2925 + return RX_DROP; 2926 2926 } 2927 2927 2928 2928 if (!ifmsh->mshcfg.dot11MeshForwarding) { 2929 2929 if (is_multicast_ether_addr(eth->h_dest)) 2930 2930 goto rx_accept; 2931 2931 2932 - return RX_DROP_MONITOR; 2932 + return RX_DROP; 2933 2933 } 2934 2934 2935 2935 skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]); ··· 3122 3122 return RX_CONTINUE; 3123 3123 3124 3124 if (unlikely(!ieee80211_is_data_present(fc))) 3125 - return RX_DROP_MONITOR; 3125 + return RX_DROP; 3126 3126 3127 3127 if (unlikely(ieee80211_has_a4(hdr->frame_control))) { 3128 3128 switch (rx->sdata->vif.type) { ··· 3179 3179 return RX_CONTINUE; 3180 3180 3181 3181 if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) 3182 - return RX_DROP_MONITOR; 3182 + return RX_DROP; 3183 3183 3184 - /* 3185 - * Send unexpected-4addr-frame event to hostapd. For older versions, 3186 - * also drop the frame to cooked monitor interfaces. 3187 - */ 3184 + /* Send unexpected-4addr-frame event to hostapd */ 3188 3185 if (ieee80211_has_a4(hdr->frame_control) && 3189 3186 sdata->vif.type == NL80211_IFTYPE_AP) { 3190 3187 if (rx->sta && 3191 3188 !test_and_set_sta_flag(rx->sta, WLAN_STA_4ADDR_EVENT)) 3192 3189 cfg80211_rx_unexpected_4addr_frame( 3193 3190 rx->sdata->dev, rx->sta->sta.addr, GFP_ATOMIC); 3194 - return RX_DROP_MONITOR; 3191 + return RX_DROP; 3195 3192 } 3196 3193 3197 3194 res = __ieee80211_data_to_8023(rx, &port_control); ··· 3200 3203 return res; 3201 3204 3202 3205 if (!ieee80211_frame_allowed(rx, fc)) 3203 - return RX_DROP_MONITOR; 3206 + return RX_DROP; 3204 3207 3205 3208 /* directly handle TDLS channel switch requests/responses */ 3206 3209 if (unlikely(((struct ethhdr *)rx->skb->data)->h_proto == ··· 3265 3268 }; 3266 3269 3267 3270 if (!rx->sta) 3268 - return RX_DROP_MONITOR; 3271 + return RX_DROP; 3269 3272 3270 3273 if (skb_copy_bits(skb, offsetof(struct ieee80211_bar, control), 3271 3274 &bar_data, sizeof(bar_data))) 3272 - return RX_DROP_MONITOR; 3275 + return RX_DROP; 3273 3276 3274 3277 tid = le16_to_cpu(bar_data.control) >> 12; 3275 3278 ··· 3281 3284 3282 3285 tid_agg_rx = rcu_dereference(rx->sta->ampdu_mlme.tid_rx[tid]); 3283 3286 if (!tid_agg_rx) 3284 - return RX_DROP_MONITOR; 3287 + return RX_DROP; 3285 3288 3286 3289 start_seq_num = le16_to_cpu(bar_data.start_seq_num) >> 4; 3287 3290 event.u.ba.tid = tid; ··· 3305 3308 return RX_QUEUED; 3306 3309 } 3307 3310 3308 - /* 3309 - * After this point, we only want management frames, 3310 - * so we can drop all remaining control frames to 3311 - * cooked monitor interfaces. 3312 - */ 3313 - return RX_DROP_MONITOR; 3311 + return RX_DROP; 3314 3312 } 3315 3313 3316 3314 static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, ··· 3414 3422 * and unknown (reserved) frames are useless. 3415 3423 */ 3416 3424 if (rx->skb->len < 24) 3417 - return RX_DROP_MONITOR; 3425 + return RX_DROP; 3418 3426 3419 3427 if (!ieee80211_is_mgmt(mgmt->frame_control)) 3420 - return RX_DROP_MONITOR; 3428 + return RX_DROP; 3421 3429 3422 3430 /* drop too small action frames */ 3423 3431 if (ieee80211_is_action(mgmt->frame_control) && ··· 3943 3951 * ones. For all other modes we will return them to the sender, 3944 3952 * setting the 0x80 bit in the action category, as required by 3945 3953 * 802.11-2012 9.24.4. 3946 - * Newer versions of hostapd shall also use the management frame 3947 - * registration mechanisms, but older ones still use cooked 3948 - * monitor interfaces so push all frames there. 3954 + * Newer versions of hostapd use the management frame registration 3955 + * mechanisms and old cooked monitor interface is no longer supported. 3949 3956 */ 3950 3957 if (!(status->rx_flags & IEEE80211_RX_MALFORMED_ACTION_FRM) && 3951 3958 (sdata->vif.type == NL80211_IFTYPE_AP || 3952 3959 sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) 3953 - return RX_DROP_MONITOR; 3960 + return RX_DROP; 3954 3961 3955 3962 if (is_multicast_ether_addr(mgmt->da)) 3956 - return RX_DROP_MONITOR; 3963 + return RX_DROP; 3957 3964 3958 3965 /* do not return rejected action frames */ 3959 3966 if (mgmt->u.action.category & 0x80) ··· 3997 4006 return RX_CONTINUE; 3998 4007 3999 4008 if (sdata->vif.type != NL80211_IFTYPE_STATION) 4000 - return RX_DROP_MONITOR; 4009 + return RX_DROP; 4001 4010 4002 4011 /* for now only beacons are ext, so queue them */ 4003 4012 ieee80211_queue_skb_to_iface(sdata, rx->link_id, rx->sta, rx->skb); ··· 4018 4027 sdata->vif.type != NL80211_IFTYPE_ADHOC && 4019 4028 sdata->vif.type != NL80211_IFTYPE_OCB && 4020 4029 sdata->vif.type != NL80211_IFTYPE_STATION) 4021 - return RX_DROP_MONITOR; 4030 + return RX_DROP; 4022 4031 4023 4032 switch (stype) { 4024 4033 case cpu_to_le16(IEEE80211_STYPE_AUTH): ··· 4029 4038 case cpu_to_le16(IEEE80211_STYPE_DEAUTH): 4030 4039 if (is_multicast_ether_addr(mgmt->da) && 4031 4040 !is_broadcast_ether_addr(mgmt->da)) 4032 - return RX_DROP_MONITOR; 4041 + return RX_DROP; 4033 4042 4034 4043 /* process only for station/IBSS */ 4035 4044 if (sdata->vif.type != NL80211_IFTYPE_STATION && 4036 4045 sdata->vif.type != NL80211_IFTYPE_ADHOC) 4037 - return RX_DROP_MONITOR; 4046 + return RX_DROP; 4038 4047 break; 4039 4048 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): 4040 4049 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): 4041 4050 case cpu_to_le16(IEEE80211_STYPE_DISASSOC): 4042 4051 if (is_multicast_ether_addr(mgmt->da) && 4043 4052 !is_broadcast_ether_addr(mgmt->da)) 4044 - return RX_DROP_MONITOR; 4053 + return RX_DROP; 4045 4054 4046 4055 /* process only for station */ 4047 4056 if (sdata->vif.type != NL80211_IFTYPE_STATION) 4048 - return RX_DROP_MONITOR; 4057 + return RX_DROP; 4049 4058 break; 4050 4059 case cpu_to_le16(IEEE80211_STYPE_PROBE_REQ): 4051 4060 /* process only for ibss and mesh */ 4052 4061 if (sdata->vif.type != NL80211_IFTYPE_ADHOC && 4053 4062 sdata->vif.type != NL80211_IFTYPE_MESH_POINT) 4054 - return RX_DROP_MONITOR; 4063 + return RX_DROP; 4055 4064 break; 4056 4065 default: 4057 - return RX_DROP_MONITOR; 4066 + return RX_DROP; 4058 4067 } 4059 4068 4060 4069 ieee80211_queue_skb_to_iface(sdata, rx->link_id, rx->sta, rx->skb); ··· 4062 4071 return RX_QUEUED; 4063 4072 } 4064 4073 4065 - static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx, 4066 - struct ieee80211_rate *rate, 4067 - ieee80211_rx_result reason) 4068 - { 4069 - struct ieee80211_sub_if_data *sdata; 4070 - struct ieee80211_local *local = rx->local; 4071 - struct sk_buff *skb = rx->skb, *skb2; 4072 - struct net_device *prev_dev = NULL; 4073 - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 4074 - int needed_headroom; 4075 - 4076 - /* 4077 - * If cooked monitor has been processed already, then 4078 - * don't do it again. If not, set the flag. 4079 - */ 4080 - if (rx->flags & IEEE80211_RX_CMNTR) 4081 - goto out_free_skb; 4082 - rx->flags |= IEEE80211_RX_CMNTR; 4083 - 4084 - /* If there are no cooked monitor interfaces, just free the SKB */ 4085 - if (!local->cooked_mntrs) 4086 - goto out_free_skb; 4087 - 4088 - /* room for the radiotap header based on driver features */ 4089 - needed_headroom = ieee80211_rx_radiotap_hdrlen(local, status, skb); 4090 - 4091 - if (skb_headroom(skb) < needed_headroom && 4092 - pskb_expand_head(skb, needed_headroom, 0, GFP_ATOMIC)) 4093 - goto out_free_skb; 4094 - 4095 - /* prepend radiotap information */ 4096 - ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom, 4097 - false); 4098 - 4099 - skb_reset_mac_header(skb); 4100 - skb->ip_summed = CHECKSUM_UNNECESSARY; 4101 - skb->pkt_type = PACKET_OTHERHOST; 4102 - skb->protocol = htons(ETH_P_802_2); 4103 - 4104 - list_for_each_entry_rcu(sdata, &local->interfaces, list) { 4105 - if (!ieee80211_sdata_running(sdata)) 4106 - continue; 4107 - 4108 - if (sdata->vif.type != NL80211_IFTYPE_MONITOR || 4109 - !(sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES)) 4110 - continue; 4111 - 4112 - if (prev_dev) { 4113 - skb2 = skb_clone(skb, GFP_ATOMIC); 4114 - if (skb2) { 4115 - skb2->dev = prev_dev; 4116 - netif_receive_skb(skb2); 4117 - } 4118 - } 4119 - 4120 - prev_dev = sdata->dev; 4121 - dev_sw_netstats_rx_add(sdata->dev, skb->len); 4122 - } 4123 - 4124 - if (prev_dev) { 4125 - skb->dev = prev_dev; 4126 - netif_receive_skb(skb); 4127 - return; 4128 - } 4129 - 4130 - out_free_skb: 4131 - kfree_skb_reason(skb, (__force u32)reason); 4132 - } 4133 - 4134 4074 static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx, 4135 4075 ieee80211_rx_result res) 4136 4076 { 4137 - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); 4138 - struct ieee80211_supported_band *sband; 4139 - struct ieee80211_rate *rate = NULL; 4140 - 4141 4077 if (res == RX_QUEUED) { 4142 4078 I802_DEBUG_INC(rx->sdata->local->rx_handlers_queued); 4143 4079 return; ··· 4076 4158 rx->link_sta->rx_stats.dropped++; 4077 4159 } 4078 4160 4079 - if (u32_get_bits((__force u32)res, SKB_DROP_REASON_SUBSYS_MASK) == 4080 - SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE) { 4081 - kfree_skb_reason(rx->skb, (__force u32)res); 4082 - return; 4083 - } 4084 - 4085 - sband = rx->local->hw.wiphy->bands[status->band]; 4086 - if (status->encoding == RX_ENC_LEGACY) 4087 - rate = &sband->bitrates[status->rate_idx]; 4088 - 4089 - ieee80211_rx_cooked_monitor(rx, rate, res); 4161 + kfree_skb_reason(rx->skb, (__force u32)res); 4090 4162 } 4091 4163 4092 4164 static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx, 4093 4165 struct sk_buff_head *frames) 4094 4166 { 4095 - ieee80211_rx_result res = RX_DROP_MONITOR; 4167 + ieee80211_rx_result res = RX_DROP; 4096 4168 struct sk_buff *skb; 4097 4169 4098 4170 #define CALL_RXH(rxh) \ ··· 4146 4238 static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx) 4147 4239 { 4148 4240 struct sk_buff_head reorder_release; 4149 - ieee80211_rx_result res = RX_DROP_MONITOR; 4241 + ieee80211_rx_result res = RX_DROP; 4150 4242 4151 4243 __skb_queue_head_init(&reorder_release); 4152 4244
+5 -29
net/mac80211/status.c
··· 895 895 } 896 896 897 897 void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb, 898 - int retry_count, bool send_to_cooked, 899 - struct ieee80211_tx_status *status) 898 + int retry_count, struct ieee80211_tx_status *status) 900 899 { 901 900 struct sk_buff *skb2; 902 901 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ··· 929 930 if (sdata->u.mntr.flags & MONITOR_FLAG_SKIP_TX) 930 931 continue; 931 932 932 - if ((sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) && 933 - !send_to_cooked) 934 - continue; 935 - 936 933 if (prev_dev) { 937 934 skb2 = skb_clone(skb, GFP_ATOMIC); 938 935 if (skb2) { ··· 959 964 struct ieee80211_tx_info *info = status->info; 960 965 struct sta_info *sta; 961 966 __le16 fc; 962 - bool send_to_cooked; 963 967 bool acked; 964 968 bool noack_success; 965 969 struct ieee80211_bar *bar; ··· 1085 1091 1086 1092 ieee80211_report_used_skb(local, skb, false, status->ack_hwtstamp); 1087 1093 1088 - /* this was a transmitted frame, but now we want to reuse it */ 1089 - skb_orphan(skb); 1090 - 1091 - /* Need to make a copy before skb->cb gets cleared */ 1092 - send_to_cooked = !!(info->flags & IEEE80211_TX_CTL_INJECTED) || 1093 - !(ieee80211_is_data(fc)); 1094 - 1095 - /* 1096 - * This is a bit racy but we can avoid a lot of work 1097 - * with this test... 1098 - */ 1099 - if (!local->tx_mntrs && (!send_to_cooked || !local->cooked_mntrs)) { 1100 - if (status->free_list) 1101 - list_add_tail(&skb->list, status->free_list); 1102 - else 1103 - dev_kfree_skb(skb); 1104 - return; 1105 - } 1106 - 1107 - /* send to monitor interfaces */ 1108 - ieee80211_tx_monitor(local, skb, retry_count, 1109 - send_to_cooked, status); 1094 + if (status->free_list) 1095 + list_add_tail(&skb->list, status->free_list); 1096 + else 1097 + dev_kfree_skb(skb); 1110 1098 } 1111 1099 1112 1100 void ieee80211_tx_status_skb(struct ieee80211_hw *hw, struct sk_buff *skb)
+1 -1
net/mac80211/tx.c
··· 5617 5617 if (!copy) 5618 5618 return bcn; 5619 5619 5620 - ieee80211_tx_monitor(hw_to_local(hw), copy, 1, false, NULL); 5620 + ieee80211_tx_monitor(hw_to_local(hw), copy, 1, NULL); 5621 5621 5622 5622 return bcn; 5623 5623 }