From patchwork Fri Aug 21 18:44:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?G=C3=A1bor_Stefanik?= X-Patchwork-Id: 43183 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7LIiHaH019032 for ; Fri, 21 Aug 2009 18:44:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755652AbZHUSoM (ORCPT ); Fri, 21 Aug 2009 14:44:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755644AbZHUSoM (ORCPT ); Fri, 21 Aug 2009 14:44:12 -0400 Received: from mail-bw0-f219.google.com ([209.85.218.219]:49134 "EHLO mail-bw0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755589AbZHUSoM (ORCPT ); Fri, 21 Aug 2009 14:44:12 -0400 Received: by bwz19 with SMTP id 19so600699bwz.37 for ; Fri, 21 Aug 2009 11:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=RSwoD7vHGn2iqNfNT4myTvfaZnr/5v7uqW03KSulcHQ=; b=mOADR66z4y3WXzJSGo+o12aCWmQNXpSPqFBI3Yn/jMiqnLr7M08MJJpXR7Ockod/Qe 2bjOSAwodbOHkh/CBSzQDEkTIc5285r4DbapOU9XcSov92RObs7lyg6NBS3qhruS+2C9 YDyBkuRqivl7s0fAATRBV8Ae13yVdqKhJqpiQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=S9SXUjROPHOQ+2nlnG9KCqV1zVTkRxWeYSdwgdwAiM6iWBn7ff9jiVdcNm/RpIorXo Tv8ZpPFmetMtm9XplfvUugNoIN2PxQCrOHX9KDHJHa7MzbHLOXHAFiD/TgaqsG3nwP/0 f9AERYiMm4kmx5OYbxSzpIa+4qBuTr5jvqVFI= Received: by 10.103.81.21 with SMTP id i21mr623909mul.57.1250880251910; Fri, 21 Aug 2009 11:44:11 -0700 (PDT) Received: from ?192.168.1.3? (pool-04072.externet.hu [88.209.236.113]) by mx.google.com with ESMTPS id i7sm11357736mue.18.2009.08.21.11.44.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 21 Aug 2009 11:44:11 -0700 (PDT) Message-ID: <4A8EEAF9.6020308@gmail.com> Date: Fri, 21 Aug 2009 20:44:09 +0200 From: =?UTF-8?B?R8OhYm9yIFN0ZWZhbmlr?= User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: John Linville , Reinette Chatre , Zhu Yi CC: Wey-Yi Guy , Rafael Laufer , ipw3945-devel , linux-wireless Subject: [PATCH v2] iwlwifi: Make injection of non-broadcast frames work again Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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. Signed-off-by: Gábor Stefanik Acked-by: Reinette Chatre --- 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(-) diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 9b76bd4..8eba9e9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c @@ -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); diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index e617411..d0debdf 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -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);