Skip to contentSkip to conversation

wifi: nl80211/cfg80211: Stop supporting cooked monitor

PATCH In review Alexander Wetzel 4 participants 7 messages Feb 4, 2025 – Feb 18, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 wifi: nl80211/cfg80211: Stop supporting cooked monitor

Unconditionally start to refuse creating cooked monitor interfaces to phase them out.

There is no feature flag for drivers to opt-in for cooked monitor and all known users are using/preferring the modern API since the hostapd release 1.0 in May 2012.

---
That's kind of brutal... But still seems to be the best way.

While we keep NL80211_MNTR_FLAG_COOK_FRAMES around to not break software like hostapd from compiling, nl80211 will refuse anyone from using it. Which includes drivers which still may be fine with this feature.

But adding a feature flag for that outdated feature, assign it to all drivers without knowing if they really support that any longer seems to be a no-go. And adding an opt-out feature for something we plan to remove also feels off.

That way we may be able to remove NL80211_MNTR_FLAG_COOK_FRAMES in some years...

If you think that's too hard, there is another way:
I first tried to just refuse setting the flag in mac80211, but that triggered a warning in nl80211 when rdev_add_virtual_intf() got the error after green-lightening the flags in nl80211_parse_mon_options().

So we could add some code in nl80211 suppressing the warning when MONITOR_FLAG_COOK_FRAMES is set. That would open up drivers to refuse cooperation when someone tries to use the flag.

Alexander

---
 include/net/cfg80211.h       | 2 +-
 include/uapi/linux/nl80211.h | 4 ++--
 net/wireless/nl80211.c       | 4 ++++
 3 files changed, 7 insertions(+), 3 deletions(-)
include/net/cfg80211.h +1 -1
index 363d7dd2255a..a72e7eb7027f 100644
@@ -2265,7 +2265,7 @@ static inline int cfg80211_get_station(struct net_device *dev,
  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
  * @MONITOR_FLAG_CONTROL: pass control frames
  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
- * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
+ * @MONITOR_FLAG_COOK_FRAMES: deprecated, will unconditionally be refused
  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
  * @MONITOR_FLAG_SKIP_TX: do not pass locally transmitted frames
  */
include/uapi/linux/nl80211.h +2 -2
index f6c1b181c886..9d8ecf20ef0d 100644
@@ -4727,8 +4727,8 @@ enum nl80211_survey_info {
  * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP
  * @NL80211_MNTR_FLAG_CONTROL: pass control frames
  * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering
- * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing.
- *	overrides all other flags.
+ * @NL80211_MNTR_FLAG_COOK_FRAMES: deprecated
+ *	will unconditionally be refused
  * @NL80211_MNTR_FLAG_ACTIVE: use the configured MAC address
  *	and ACK incoming unicast packets.
  * @NL80211_MNTR_FLAG_SKIP_TX: do not pass local tx packets
net/wireless/nl80211.c +4 -0
index d7d3da0f6833..8bd09110d393 100644
@@ -4245,6 +4245,10 @@ static int nl80211_parse_mon_options(struct cfg80211_registered_device *rdev,
 		change = true;
 	}
 
+	/* MONITOR_FLAG_COOK_FRAMES is deprecated, refuse cooperation */
+	if (params->flags & MONITOR_FLAG_COOK_FRAMES)
+		return -EOPNOTSUPP;
+
 	if (params->flags & MONITOR_FLAG_ACTIVE &&
 	    !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR))
 		return -EOPNOTSUPP;
Signature · 1 line
2.48.1
#1 lore raw

PATCH 2/2 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.

---
Checkpatch is kind of unhappy here:
ERROR: Macros with complex values should be enclosed in parentheses #285: FILE: net/mac80211/main.c:1747:
+#define V(x) #x,

I don't see how to get rid of that error and more or less accidentially moved the line when cleaning up.

Since the code is from commit baa951a1c177 ("mac80211: use the new drop reasons infrastructure") from 2023 I assume it's one of the rare cases where we can ignore an error?

---
 include/net/dropreason.h   |   6 --
 net/mac80211/cfg.c         |   9 +-
 net/mac80211/drop.h        |  21 ++--
 net/mac80211/ieee80211_i.h |  11 +--
 net/mac80211/iface.c       |  50 ++++------
 net/mac80211/main.c        |  16 +--
 net/mac80211/rx.c          | 194 ++++++++++---------------------------
 net/mac80211/status.c      |  34 +------
 net/mac80211/tx.c          |   2 +-
 9 files changed, 94 insertions(+), 249 deletions(-)
include/net/dropreason.h +0 -6
index 56cb7be92244..7d3b1a2a6fec 100644
@@ -17,12 +17,6 @@ enum skb_drop_reason_subsys {
 	 */
 	SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE,
 
-	/**
-	 * @SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR: mac80211 drop reasons
-	 * for frames still going to monitor, see net/mac80211/drop.h
-	 */
-	SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR,
-
 	/**
 	 * @SKB_DROP_REASON_SUBSYS_OPENVSWITCH: openvswitch drop reasons,
 	 * see net/openvswitch/drop.h
net/mac80211/cfg.c +4 -5
index 9351c64608a9..88949b90f117 100644
@@ -89,15 +89,14 @@ static int ieee80211_set_mon_options(struct ieee80211_sub_if_data *sdata,
 
 	/* check flags first */
 	if (params->flags && ieee80211_sdata_running(sdata)) {
-		u32 mask = MONITOR_FLAG_COOK_FRAMES | MONITOR_FLAG_ACTIVE;
+		u32 mask = MONITOR_FLAG_ACTIVE;
 
 		/*
-		 * Prohibit MONITOR_FLAG_COOK_FRAMES and
-		 * MONITOR_FLAG_ACTIVE to be changed while the
-		 * interface is up.
+		 * Prohibit MONITOR_FLAG_ACTIVE to be changed
+		 * while the interface is up.
 		 * Else we would need to add a lot of cruft
 		 * to update everything:
-		 *	cooked_mntrs, monitor and all fif_* counters
+		 *	monitor and all fif_* counters
 		 *	reconfigure hardware
 		 */
 		if ((params->flags & mask) != (sdata->u.mntr.flags & mask))
net/mac80211/drop.h +7 -14
index 59e3ec4dc960..eb9ab310f91c 100644
@@ -11,12 +11,6 @@
 
 typedef unsigned int __bitwise ieee80211_rx_result;
 
-#define MAC80211_DROP_REASONS_MONITOR(R)	\
-	R(RX_DROP_M_UNEXPECTED_4ADDR_FRAME)	\
-	R(RX_DROP_M_BAD_BCN_KEYIDX)		\
-	R(RX_DROP_M_BAD_MGMT_KEYIDX)		\
-/* this line for the trailing \ - add before this */
-
 #define MAC80211_DROP_REASONS_UNUSABLE(R)	\
 	/* 0x00 == ___RX_DROP_UNUSABLE */	\
 	R(RX_DROP_U_MIC_FAIL)			\
@@ -66,6 +60,10 @@ typedef unsigned int __bitwise ieee80211_rx_result;
 	R(RX_DROP_U_UNEXPECTED_STA_4ADDR)	\
 	R(RX_DROP_U_UNEXPECTED_VLAN_MCAST)	\
 	R(RX_DROP_U_NOT_PORT_CONTROL)		\
+	R(RX_DROP_U_UNEXPECTED_4ADDR_FRAME)	\
+	R(RX_DROP_U_BAD_BCN_KEYIDX)		\
+	/* 0x30 */				\
+	R(RX_DROP_U_BAD_MGMT_KEYIDX)		\
 	R(RX_DROP_U_UNKNOWN_ACTION_REJECTED)	\
 /* this line for the trailing \ - add before this */
 
@@ -78,10 +76,6 @@ enum ___mac80211_drop_reason {
 	___RX_QUEUED	= SKB_NOT_DROPPED_YET,
 
 #define ENUM(x) ___ ## x,
-	___RX_DROP_MONITOR = SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR <<
-		SKB_DROP_REASON_SUBSYS_SHIFT,
-	MAC80211_DROP_REASONS_MONITOR(ENUM)
-
 	___RX_DROP_UNUSABLE = SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE <<
 		SKB_DROP_REASON_SUBSYS_SHIFT,
 	MAC80211_DROP_REASONS_UNUSABLE(ENUM)
@@ -89,11 +83,10 @@ enum ___mac80211_drop_reason {
 };
 
 enum mac80211_drop_reason {
-	RX_CONTINUE	 = (__force ieee80211_rx_result)___RX_CONTINUE,
-	RX_QUEUED	 = (__force ieee80211_rx_result)___RX_QUEUED,
-	RX_DROP_MONITOR	 = (__force ieee80211_rx_result)___RX_DROP_MONITOR,
+	RX_CONTINUE	= (__force ieee80211_rx_result)___RX_CONTINUE,
+	RX_QUEUED	= (__force ieee80211_rx_result)___RX_QUEUED,
+	RX_DROP		= (__force ieee80211_rx_result)___RX_DROP_UNUSABLE,
 #define DEF(x) x = (__force ieee80211_rx_result)___ ## x,
-	MAC80211_DROP_REASONS_MONITOR(DEF)
 	MAC80211_DROP_REASONS_UNUSABLE(DEF)
 #undef DEF
 };
net/mac80211/ieee80211_i.h +4 -7
index e7dc3f0cfc9a..a90a44aa5758 100644
@@ -200,7 +200,6 @@ enum ieee80211_packet_rx_flags {
 /**
  * enum ieee80211_rx_flags - RX data flags
  *
- * @IEEE80211_RX_CMNTR: received on cooked monitor already
  * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported
  *	to cfg80211_report_obss_beacon().
  *
@@ -208,8 +207,7 @@ enum ieee80211_packet_rx_flags {
  * for a single frame.
  */
 enum ieee80211_rx_flags {
-	IEEE80211_RX_CMNTR		= BIT(0),
-	IEEE80211_RX_BEACON_REPORTED	= BIT(1),
+	IEEE80211_RX_BEACON_REPORTED	= BIT(0),
 };
 
 struct ieee80211_rx_data {
@@ -1380,7 +1378,7 @@ struct ieee80211_local {
 	spinlock_t queue_stop_reason_lock;
 
 	int open_count;
-	int monitors, cooked_mntrs, tx_mntrs;
+	int monitors, tx_mntrs;
 	/* number of interfaces with corresponding FIF_ flags */
 	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
 	    fif_probe_req;
@@ -1492,7 +1490,7 @@ struct ieee80211_local {
 
 	/* see iface.c */
 	struct list_head interfaces;
-	struct list_head mon_list; /* only that are IFF_UP && !cooked */
+	struct list_head mon_list; /* only that are IFF_UP */
 	struct mutex iflist_mtx;
 
 	/* Scanning and BSS list */
@@ -2090,8 +2088,7 @@ struct sk_buff *
 ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
 			      struct sk_buff *skb, u32 info_flags);
 void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
-			  int retry_count, bool send_to_cooked,
-			  struct ieee80211_tx_status *status);
+			  int retry_count, struct ieee80211_tx_status *status);
 
 void ieee80211_check_fast_xmit(struct sta_info *sta);
 void ieee80211_check_fast_xmit_all(struct ieee80211_local *local);
net/mac80211/iface.c +21 -29

82 lines not on this page · raw message

net/mac80211/main.c +1 -15
index 53e5aee46885..741e6c7edcb7 100644
@@ -1744,18 +1744,7 @@ void ieee80211_free_hw(struct ieee80211_hw *hw)
 	wiphy_free(local->hw.wiphy);
 }
 EXPORT_SYMBOL(ieee80211_free_hw);
-
-static const char * const drop_reasons_monitor[] = {
-#define V(x)	#x,
-	[0] = "RX_DROP_MONITOR",
-	MAC80211_DROP_REASONS_MONITOR(V)
-};
-
-static struct drop_reason_list drop_reason_list_monitor = {
-	.reasons = drop_reasons_monitor,
-	.n_reasons = ARRAY_SIZE(drop_reasons_monitor),
-};
-
+#define V(x)   #x,
 static const char * const drop_reasons_unusable[] = {
 	[0] = "RX_DROP_UNUSABLE",
 	MAC80211_DROP_REASONS_UNUSABLE(V)
@@ -1784,8 +1773,6 @@ static int __init ieee80211_init(void)
 	if (ret)
 		goto err_netdev;
 
-	drop_reasons_register_subsys(SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR,
-				     &drop_reason_list_monitor);
 	drop_reasons_register_subsys(SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE,
 				     &drop_reason_list_unusable);
 
@@ -1804,7 +1791,6 @@ static void __exit ieee80211_exit(void)
 
 	ieee80211_iface_exit();
 
-	drop_reasons_unregister_subsys(SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR);
 	drop_reasons_unregister_subsys(SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE);
 
 	rcu_barrier();
net/mac80211/rx.c +51 -143

450 lines not on this page · raw message

net/mac80211/status.c +5 -29
index 5f28f3633fa0..b17b3cc7fb90 100644
@@ -895,8 +895,7 @@ static int ieee80211_tx_get_rates(struct ieee80211_hw *hw,
 }
 
 void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
-			  int retry_count, bool send_to_cooked,
-			  struct ieee80211_tx_status *status)
+			  int retry_count, struct ieee80211_tx_status *status)
 {
 	struct sk_buff *skb2;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -930,10 +929,6 @@ void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
 			if (sdata->u.mntr.flags & MONITOR_FLAG_SKIP_TX)
 				continue;
 
-			if ((sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) &&
-			    !send_to_cooked)
-				continue;
-
 			if (prev_dev) {
 				skb2 = skb_clone(skb, GFP_ATOMIC);
 				if (skb2) {
@@ -964,7 +959,6 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,
 	struct ieee80211_tx_info *info = status->info;
 	struct sta_info *sta;
 	__le16 fc;
-	bool send_to_cooked;
 	bool acked;
 	bool noack_success;
 	struct ieee80211_bar *bar;
@@ -1091,28 +1085,10 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,
 
 	ieee80211_report_used_skb(local, skb, false, status->ack_hwtstamp);
 
-	/* this was a transmitted frame, but now we want to reuse it */
-	skb_orphan(skb);
-
-	/* Need to make a copy before skb->cb gets cleared */
-	send_to_cooked = !!(info->flags & IEEE80211_TX_CTL_INJECTED) ||
-			 !(ieee80211_is_data(fc));
-
-	/*
-	 * This is a bit racy but we can avoid a lot of work
-	 * with this test...
-	 */
-	if (!local->tx_mntrs && (!send_to_cooked || !local->cooked_mntrs)) {
-		if (status->free_list)
-			list_add_tail(&skb->list, status->free_list);
-		else
-			dev_kfree_skb(skb);
-		return;
-	}
-
-	/* send to monitor interfaces */
-	ieee80211_tx_monitor(local, skb, retry_count,
-			     send_to_cooked, status);
+	if (status->free_list)
+		list_add_tail(&skb->list, status->free_list);
+	else
+		dev_kfree_skb(skb);
 }
 
 void ieee80211_tx_status_skb(struct ieee80211_hw *hw, struct sk_buff *skb)
net/mac80211/tx.c +1 -1
index a24636bda679..1289df373795 100644
@@ -5617,7 +5617,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
 	if (!copy)
 		return bcn;
 
-	ieee80211_tx_monitor(hw_to_local(hw), copy, 1, false, NULL);
+	ieee80211_tx_monitor(hw_to_local(hw), copy, 1, NULL);
 
 	return bcn;
 }
Signature · 1 line
2.48.1
#2 lore raw

Re: [PATCH 2/2] wifi: mac80211: Drop cooked monitor support

Quoted 36 lines · Alexander Wetzel

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.

---
Checkpatch is kind of unhappy here:
ERROR: Macros with complex values should be enclosed in parentheses #285: FILE: net/mac80211/main.c:1747:
+#define V(x) #x,

I don't see how to get rid of that error and more or less accidentially moved the line when cleaning up.

Since the code is from commit baa951a1c177 ("mac80211: use the new drop reasons infrastructure") from 2023 I assume it's one of the rare cases where we can ignore an error?

---
  include/net/dropreason.h   |   6 --
  net/mac80211/cfg.c         |   9 +-
  net/mac80211/drop.h        |  21 ++--
  net/mac80211/ieee80211_i.h |  11 +--
  net/mac80211/iface.c       |  50 ++++------
  net/mac80211/main.c        |  16 +--
  net/mac80211/rx.c          | 194 ++++++++++---------------------------
  net/mac80211/status.c      |  34 +------
  net/mac80211/tx.c          |   2 +-
  9 files changed, 94 insertions(+), 249 deletions(-)

...

Quoted 4 lines
net/mac80211/iface.c +0 -0
index 0ea7e77860b7..7d3ebfcb8c2b 100644

...

Quoted 19 lines
net/mac80211/iface.c +0 -10
@@ -1326,27 +1323,24 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
  		}
  		break;
  	case NL80211_IFTYPE_MONITOR:
-		if (sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) {
-			local->cooked_mntrs++;
-			break;
-		}
-
  		if ((sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE) ||
  		    ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR)) {
  			res = drv_add_interface(local, sdata);
  			if (res)
  				goto err_stop;
-		} else if (local->monitors == 0 && local->open_count == 0) {
-			res = ieee80211_add_virtual_monitor(local);
-			if (res)
-				goto err_stop;
-		}

net/mac80211/iface.c int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) · line 1346

Quoted 10 lines
net/mac80211/iface.c +7 -2
+		} else {
+			if (local->monitors == 0 && local->open_count == 0) {
+				res = ieee80211_add_virtual_monitor(local);
+				if (res)
+					goto err_stop;
+			}
+			local->monitors++;
 
-		/* must be before the call to ieee80211_configure_filter */
-		local->monitors++;

Regression on NO_VIRTUAL_MONITOR support drivers.

Here local->monitors increment not done for NO_VIRTUAL_MONITOR. Which causing packet drop in Rx path (code snip below)

net/mac80211/rx.c: ieee80211_rx_monitor()

if (!local->monitors || (status->flag & RX_FLAG_SKIP_MONITOR)) {
	if (only_monitor) {
		dev_kfree_skb(origskb);
		return NULL;
	}

	return ieee80211_clean_skb(origskb, present_fcs_len,
				   rtap_space);
}
Signature · 3 lines
Karthikeyan Periyasamy
--
கார்த்திகேயன் பெரியசாமி
maintainer
#3 lore raw
In reply to Alexander Wetzel
Quoted 5 lines · Alexander Wetzel

But adding a feature flag for that outdated feature, assign it to all drivers without knowing if they really support that any longer seems to be a no-go. And adding an opt-out feature for something we plan to remove also feels off.

I don't think there's any driver that supports this in the first place. Most, if not all, non-mac80211 drivers supporting AP mode have AP SME in firmware anyway.

johannes

#4 lore raw
In reply to Alexander Wetzel
Quoted 7 lines · Alexander Wetzel

I first tried to just refuse setting the flag in mac80211, but that triggered a warning in nl80211 when rdev_add_virtual_intf() got the error after green-lightening the flags in nl80211_parse_mon_options().

So we could add some code in nl80211 suppressing the warning when MONITOR_FLAG_COOK_FRAMES is set. That would open up drivers to refuse cooperation when someone tries to use the flag.

Is that the same WARNING which is being fixed at [1] or something new?

FWIW, I think the current series would not go to the stable trees (at least there are no Fixes ot Cc: stable tags), while [1] should go there to suppress the currently observed and triggerable WARNING regarding setting the outdated cooked monitor mode mixed with some other modes.

[1]: https://lore.kernel.org/linux-wireless/[email protected]/

#5 lore raw
Quoted 11 lines · Fedor Pchelkin
Quoted 7 lines · Alexander Wetzel

I first tried to just refuse setting the flag in mac80211, but that triggered a warning in nl80211 when rdev_add_virtual_intf() got the error after green-lightening the flags in nl80211_parse_mon_options().

So we could add some code in nl80211 suppressing the warning when MONITOR_FLAG_COOK_FRAMES is set. That would open up drivers to refuse cooperation when someone tries to use the flag.

Is that the same WARNING which is being fixed at [1] or something new?

While the patch here also kind of solves the issue from [1] it's unrelated.
The warning I mentioned above was a different one. But since it was caused by experimental code never published noting I would call "new".

I tried to explain that mac80211 - or any other driver using nl80211 - can't refuse the cooked monitor flag with the current API to explain the brutal handling of that in the patch here. (The flag check should be handled within nl80211_parse_mon_options(). But since the drivers have no way to signal cooked monitor support it can't be checked there by any reasonable means.)

Here the WARN() my patch triggered:

        wdev = rdev_add_virtual_intf(rdev,
                             nla_data(info->attrs[NL80211_ATTR_IFNAME]),
                                NET_NAME_USER, type, &params);
        if (WARN_ON(!wdev)) {
                nlmsg_free(msg);
                return -EPROTO;

My not published patch refused the flag when rdev_add_virtual_intf() was creating the interface with the flag.

With the feedback from Johannes - that only mac80211 ever used cooked monitor mode - the current patch seems to be the preferred way and we don't have to find a better - and for sure ugly - way to handle that.

Quoted 5 lines

FWIW, I think the current series would not go to the stable trees (at least there are no Fixes ot Cc: stable tags), while [1] should go there to suppress the currently observed and triggerable WARNING regarding setting the outdated cooked monitor mode mixed with some other modes.

I also would not like to drop cooked monitor support for any stable kernel. While that would fix some monitor handling issues I see no real need to even fix these in the stable series. Messung up virtual monitor interfaces by a special order creating them or using suspend/resume is hardly something the users of them will care about. Or they would have told us that long ago:-)

Quoted 1 line

[1]: https://lore.kernel.org/linux-wireless/[email protected]/

Alexander

#6 lore raw
Quoted 47 lines · Alexander Wetzel
Quoted 11 lines · Fedor Pchelkin
Quoted 7 lines · Alexander Wetzel

I first tried to just refuse setting the flag in mac80211, but that triggered a warning in nl80211 when rdev_add_virtual_intf() got the error after green-lightening the flags in nl80211_parse_mon_options().

So we could add some code in nl80211 suppressing the warning when MONITOR_FLAG_COOK_FRAMES is set. That would open up drivers to refuse cooperation when someone tries to use the flag.

Is that the same WARNING which is being fixed at [1] or something new?

While the patch here also kind of solves the issue from [1] it's unrelated. The warning I mentioned above was a different one. But since it was caused by experimental code never published noting I would call "new".

I tried to explain that mac80211 - or any other driver using nl80211 - can't refuse the cooked monitor flag with the current API to explain the brutal handling of that in the patch here.
(The flag check should be handled within nl80211_parse_mon_options(). But since the drivers have no way to signal cooked monitor support it can't be checked there by any reasonable means.)

Here the WARN() my patch triggered:

        wdev = rdev_add_virtual_intf(rdev,
                             nla_data(info->attrs[NL80211_ATTR_IFNAME]),
                                NET_NAME_USER, type, &params);
        if (WARN_ON(!wdev)) {
                nlmsg_free(msg);
                return -EPROTO;

My not published patch refused the flag when rdev_add_virtual_intf() was creating the interface with the flag.

With the feedback from Johannes - that only mac80211 ever used cooked monitor mode - the current patch seems to be the preferred way and we don't have to find a better - and for sure ugly - way to handle that.

Quoted 5 lines

FWIW, I think the current series would not go to the stable trees (at least there are no Fixes ot Cc: stable tags), while [1] should go there to suppress the currently observed and triggerable WARNING regarding setting the outdated cooked monitor mode mixed with some other modes.

Quoted 6 lines

I also would not like to drop cooked monitor support for any stable kernel. While that would fix some monitor handling issues I see no real need to even fix these in the stable series.
Messung up virtual monitor interfaces by a special order creating them or using suspend/resume is hardly something the users of them will care about. Or they would have told us that long ago:-)

Okay, thanks for clarifying!