* [PATCH 1/2] mac80211: set IEEE80211_TX_CTRL_PORT_CTRL_PROTO for nl80211 TX
@ 2020-03-26 14:53 Johannes Berg
2020-03-26 14:53 ` [PATCH 2/2] mac80211: remove ieee80211_tx_h_check_control_port_protocol() Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2020-03-26 14:53 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
When a frame is transmitted via the nl80211 TX rather than as a
normal frame, IEEE80211_TX_CTRL_PORT_CTRL_PROTO wasn't set and
this will lead to wrong decisions (rate control etc.) being made
about the frame; fix this.
Fixes: 911806491425 ("mac80211: Add support for tx_control_port")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/tx.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 7dbfb9e3cd84..bc1c27dc8dd5 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -5,7 +5,7 @@
* Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
* Copyright 2013-2014 Intel Mobile Communications GmbH
- * Copyright (C) 2018 Intel Corporation
+ * Copyright (C) 2018, 2020 Intel Corporation
*
* Transmit and frame generation functions.
*/
@@ -5132,6 +5132,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_local *local = sdata->local;
struct sk_buff *skb;
struct ethhdr *ehdr;
+ u32 ctrl_flags = 0;
u32 flags;
/* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE
@@ -5141,6 +5142,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
proto != cpu_to_be16(ETH_P_PREAUTH))
return -EINVAL;
+ if (proto == sdata->control_port_protocol)
+ ctrl_flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
+
if (unencrypted)
flags = IEEE80211_TX_INTFL_DONT_ENCRYPT;
else
@@ -5166,7 +5170,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
skb_reset_mac_header(skb);
local_bh_disable();
- __ieee80211_subif_start_xmit(skb, skb->dev, flags, 0);
+ __ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags);
local_bh_enable();
return 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] mac80211: remove ieee80211_tx_h_check_control_port_protocol()
2020-03-26 14:53 [PATCH 1/2] mac80211: set IEEE80211_TX_CTRL_PORT_CTRL_PROTO for nl80211 TX Johannes Berg
@ 2020-03-26 14:53 ` Johannes Berg
2023-01-18 10:53 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2020-03-26 14:53 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
This code is actually not ever effective, since the skb->protocol
isn't set up correctly (or at all) on outgoing frames. Also, we
already set the flags (except for IEEE80211_TX_CTL_USE_MINRATE)
in other code paths, and rate control already handles the frames
specially. Just remove it entirely.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/tx.c | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index bc1c27dc8dd5..5a37f7924af4 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -568,21 +568,6 @@ ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx)
return ieee80211_tx_h_multicast_ps_buf(tx);
}
-static ieee80211_tx_result debug_noinline
-ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx)
-{
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
-
- if (unlikely(tx->sdata->control_port_protocol == tx->skb->protocol)) {
- if (tx->sdata->control_port_no_encrypt)
- info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
- info->control.flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
- info->flags |= IEEE80211_TX_CTL_USE_MINRATE;
- }
-
- return TX_CONTINUE;
-}
-
static ieee80211_tx_result debug_noinline
ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
{
@@ -1775,7 +1760,6 @@ static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx)
CALL_TXH(ieee80211_tx_h_dynamic_ps);
CALL_TXH(ieee80211_tx_h_check_assoc);
CALL_TXH(ieee80211_tx_h_ps_buf);
- CALL_TXH(ieee80211_tx_h_check_control_port_protocol);
CALL_TXH(ieee80211_tx_h_select_key);
if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
CALL_TXH(ieee80211_tx_h_rate_ctrl);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] mac80211: remove ieee80211_tx_h_check_control_port_protocol()
2020-03-26 14:53 ` [PATCH 2/2] mac80211: remove ieee80211_tx_h_check_control_port_protocol() Johannes Berg
@ 2023-01-18 10:53 ` Johannes Berg
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2023-01-18 10:53 UTC (permalink / raw)
To: linux-wireless
On Thu, 2020-03-26 at 15:53 +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> This code is actually not ever effective, since the skb->protocol
> isn't set up correctly (or at all) on outgoing frames. Also, we
> already set the flags (except for IEEE80211_TX_CTL_USE_MINRATE)
> in other code paths, and rate control already handles the frames
> specially. Just remove it entirely.
>
Thread necromancy alert ...
But for my own information (and everyone else who cares):
This breaks a couple of hwsim test cases, for example
ap_wpa2_psk_no_control_port.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-18 11:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 14:53 [PATCH 1/2] mac80211: set IEEE80211_TX_CTRL_PORT_CTRL_PROTO for nl80211 TX Johannes Berg
2020-03-26 14:53 ` [PATCH 2/2] mac80211: remove ieee80211_tx_h_check_control_port_protocol() Johannes Berg
2023-01-18 10:53 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).