iwlwifi: enable packet injection for iwlagn
authorStefanik Gábor <netrolller.3d@gmail.com>
Wed, 3 Sep 2008 03:26:59 +0000 (11:26 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 8 Sep 2008 18:23:22 +0000 (14:23 -0400)
Handle station IDs of transmitted packets when in monitor mode, and
remove the various anti-injection checks from the iwl4965 driver.
This makes injection work on iwl4965 and iwl5000. Tested on both cards.

Note: To inject management frames with encryption, HW crypto support
must be disabled using the "swcrypto=1" modparam (or "swcrypto50=1"
for iwl5000). Otherwise most management frames won't be transmitted.

Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-sta.c
drivers/net/wireless/iwlwifi/iwl-tx.c

index ab92e19f0b6cb9e2e3706abf9a677df288b45e98..5cce894dc1f91b58835b85a9d5e48afa99600744 100644 (file)
@@ -2722,12 +2722,6 @@ static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 
        IWL_DEBUG_MACDUMP("enter\n");
 
-       if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
-               IWL_DEBUG_MAC80211("leave - monitor\n");
-               dev_kfree_skb_any(skb);
-               return 0;
-       }
-
        IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
                     ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
 
index 6283a3a707f58dad2f5cb17bfcb82ed05a57a148..5b7b05c8773f02be6dc6b37c741e03fd022e01fd 100644 (file)
@@ -968,6 +968,11 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
                iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
                return priv->hw_params.bcast_sta_id;
 
+       /* If we are in monitor mode, use BCAST. This is required for
+        * packet injection. */
+       case IEEE80211_IF_TYPE_MNTR:
+               return priv->hw_params.bcast_sta_id;
+
        default:
                IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode);
                return priv->hw_params.bcast_sta_id;
index a004cc8ab8f572d75f718029fed8c095c1a03aa7..452938c299afbe9e4c31cad4f56fb445d95db802 100644 (file)
@@ -789,11 +789,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
                goto drop_unlock;
        }
 
-       if (!priv->vif) {
-               IWL_DEBUG_DROP("Dropping - !priv->vif\n");
-               goto drop_unlock;
-       }
-
        if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) ==
             IWL_INVALID_RATE) {
                IWL_ERROR("ERROR: No TX rate available.\n");
@@ -815,9 +810,11 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 
        /* drop all data frame if we are not associated */
        if (ieee80211_is_data(fc) &&
-          (!iwl_is_associated(priv) ||
-           ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id) ||
-           !priv->assoc_station_added)) {
+           (priv->iw_mode != IEEE80211_IF_TYPE_MNTR ||
+           !(info->flags & IEEE80211_TX_CTL_INJECTED)) && /* packet injection */
+           (!iwl_is_associated(priv) ||
+            ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id) ||
+            !priv->assoc_station_added)) {
                IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n");
                goto drop_unlock;
        }