Skip to contentSkip to conversation

iwlwifi: Make injection of non-broadcast frames work again

PATCH In review Gábor Stefanik 2 participants 2 messages Aug 21, 2009 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iwlwifi: Make injection of non-broadcast frames work again

Commit 1ccb84d87d04df3c76cd4352fe69786d8c7cf016 by Wey-Yi Guy ("iwlwifi: clean up unused NL80211_IFTYPE_MONITOR for Monitor mode") broke injection of non-broadcast frames to unassociated stations (causing a SYSASSERT for all such injected frames), due to injected frames no longer automatically getting a broadcast station ID assigned. This patch restores the old behavior, fixing the aforementioned regression.

Also, consistently check for IEEE80211_TX_CTL_INJECTED instead of iwl_is_monitor_mode in the TX path, as TX_CTL_INJECTED specifically means that a given packet is coming from a monitor interface, while iwl_is_monitor_mode only shows whether a monitor interface exists on the device.

---
V2: Use a totally new approach to fixing this bug.
Also fix a few more cases where iwl_is_monitor_mode was incorrectly used to check whether a given packet comes from a monitor interface. (For that, IEEE80211_TX_CTL_INJECTED should be used.)

drivers/net/wireless/iwlwifi/iwl-tx.c | 10 ++++++----
drivers/net/wireless/iwlwifi/iwl3945-base.c | 9 ++++++---

2 files changed, 12 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlwifi/iwl-tx.c +0 -0
index 9b76bd4..8eba9e9 100644
@@ -718,10 +718,9 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
		IWL_DEBUG_TX(priv, "Sending REASSOC frame\n");

#endif

- /* drop all data frame if we are not associated */
+ /* drop all non-injected data frame if we are not associated */

	if (ieee80211_is_data(fc) &&
-	    (!iwl_is_monitor_mode(priv) ||
-	    !(info->flags & IEEE80211_TX_CTL_INJECTED)) && /* packet injection */
+	    !(info->flags & IEEE80211_TX_CTL_INJECTED) &&
	    (!iwl_is_associated(priv) ||
	     ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id) ||
	     !priv->assoc_station_added)) {
@@ -732,7 +731,10 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
	hdr_len = ieee80211_hdrlen(fc);

	/* Find (or create) index into station table for destination station */

- sta_id = iwl_get_sta_id(priv, hdr);
+ if (info->flags & IEEE80211_TX_CTL_INJECTED)
+ sta_id = priv->hw_params.bcast_sta_id;
+ else

+		sta_id = iwl_get_sta_id(priv, hdr);
	if (sta_id == IWL_INVALID_STATION) {
		IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
			       hdr->addr1);
drivers/net/wireless/iwlwifi/iwl3945-base.c +0 -0
index e617411..d0debdf 100644
@@ -518,9 +518,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
		IWL_DEBUG_TX(priv, "Sending REASSOC frame\n");

#endif

- /* drop all data frame if we are not associated */
+ /* drop all non-injected data frame if we are not associated */

	if (ieee80211_is_data(fc) &&
-	    (!iwl_is_monitor_mode(priv)) && /* packet injection */
+	    !(info->flags & IEEE80211_TX_CTL_INJECTED) &&
	    (!iwl_is_associated(priv) ||
	     ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) {
		IWL_DEBUG_DROP(priv, "Dropping - !iwl_is_associated\n");
@@ -532,7 +532,10 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
	hdr_len = ieee80211_hdrlen(fc);

	/* Find (or create) index into station table for destination station */

- sta_id = iwl_get_sta_id(priv, hdr);
+ if (info->flags & IEEE80211_TX_CTL_INJECTED)
+ sta_id = priv->hw_params.bcast_sta_id;
+ else

+		sta_id = iwl_get_sta_id(priv, hdr);
	if (sta_id == IWL_INVALID_STATION) {
		IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
			       hdr->addr1);
Signature · 1 line
1.6.2.4
Acked-by on v2 1/1
#1 lore raw
Quoted 8 lines · Gábor Stefanik

Commit 1ccb84d87d04df3c76cd4352fe69786d8c7cf016 by Wey-Yi Guy ("iwlwifi: clean up unused NL80211_IFTYPE_MONITOR for Monitor mode") broke injection of non-broadcast frames to unassociated stations (causing a SYSASSERT for all such injected frames), due to injected frames no longer automatically getting a broadcast station ID assigned. This patch restores the old behavior, fixing the aforementioned regression.

Quoted 7 lines

Also, consistently check for IEEE80211_TX_CTL_INJECTED instead of iwl_is_monitor_mode in the TX path, as TX_CTL_INJECTED specifically means that a given packet is coming from a monitor interface, while iwl_is_monitor_mode only shows whether a monitor interface exists on the device.

Thank you

Reinette