Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4ea83dd authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

mac80211: rework debug settings and make debugging safer



This patch reworks the mac80211 debug settings making them more focused
and adding help text for those that didn't have one. It also removes a
number of printks that can be triggered remotely and add no value, e.g.
"too short deauthentication frame received - ignoring".

If somebody really needs to debug that they should just add a monitor
interface and look at the frames in wireshark.

Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 49461622
Loading
Loading
Loading
Loading
+91 −39
Original line number Diff line number Diff line
@@ -88,10 +88,16 @@ config MAC80211_DEBUGFS

	  Say N unless you know you need this.

menuconfig MAC80211_DEBUG_MENU
	bool "Select mac80211 debugging features"
	depends on MAC80211
	---help---
	  This option collects various mac80211 debug settings.

config MAC80211_DEBUG_PACKET_ALIGNMENT
	bool "Enable packet alignment debugging"
	depends on MAC80211
	help
	depends on MAC80211_DEBUG_MENU
	---help---
	  This option is recommended for driver authors and strongly
	  discouraged for everybody else, it will trigger a warning
	  when a driver hands mac80211 a buffer that is aligned in
@@ -100,33 +106,95 @@ config MAC80211_DEBUG_PACKET_ALIGNMENT

	  Say N unless you're writing a mac80211 based driver.

config MAC80211_DEBUG
	bool "Enable debugging output"
	depends on MAC80211
config MAC80211_NOINLINE
	bool "Do not inline TX/RX handlers"
	depends on MAC80211_DEBUG_MENU
	---help---
	  This option will enable debug tracing output for the
	  ieee80211 network stack.
	  This option affects code generation in mac80211, when
	  selected some functions are marked "noinline" to allow
	  easier debugging of problems in the transmit and receive
	  paths.

	  This option increases code size a bit and inserts a lot
	  of function calls in the code, but is otherwise safe to
	  enable.

	  If you are not trying to debug or develop the ieee80211
	  subsystem, you most likely want to say N here.
	  If unsure, say N unless you expect to be finding problems
	  in mac80211.

config MAC80211_VERBOSE_DEBUG
	bool "Verbose debugging output"
	depends on MAC80211_DEBUG_MENU
	---help---
	  Selecting this option causes mac80211 to print out
	  many debugging messages. It should not be selected
	  on production systems as some of the messages are
	  remotely triggerable.

	  Do not select this option.

config MAC80211_HT_DEBUG
	bool "Enable HT debugging output"
	depends on MAC80211_DEBUG
	bool "Verbose HT debugging"
	depends on MAC80211_DEBUG_MENU
	---help---
	  This option enables 802.11n High Throughput features
	  debug tracing output.

	  If you are not trying to debug of develop the ieee80211
	  subsystem, you most likely want to say N here.
	  It should not be selected on production systems as some
	  of the messages are remotely triggerable.

config MAC80211_VERBOSE_DEBUG
	bool "Verbose debugging output"
	depends on MAC80211_DEBUG
	  Do not select this option.

config MAC80211_TKIP_DEBUG
	bool "Verbose TKIP debugging"
	depends on MAC80211_DEBUG_MENU
	---help---
	  Selecting this option causes mac80211 to print out
	  very verbose TKIP debugging messages. It should not
	  be selected on production systems as those messages
	  are remotely triggerable.

	  Do not select this option.

config MAC80211_IBSS_DEBUG
	bool "Verbose IBSS debugging"
	depends on MAC80211_DEBUG_MENU
	---help---
	  Selecting this option causes mac80211 to print out
	  very verbose IBSS debugging messages. It should not
	  be selected on production systems as those messages
	  are remotely triggerable.

	  Do not select this option.

config MAC80211_VERBOSE_PS_DEBUG
	bool "Verbose powersave mode debugging"
	depends on MAC80211_DEBUG_MENU
	---help---
	  Selecting this option causes mac80211 to print out very
	  verbose power save mode debugging messages (when mac80211
	  is an AP and has power saving stations.)
	  It should not be selected on production systems as those
	  messages are remotely triggerable.

	  Do not select this option.

config MAC80211_VERBOSE_MPL_DEBUG
	bool "Verbose mesh peer link debugging"
	depends on MAC80211_DEBUG_MENU
	depends on MAC80211_MESH
	---help---
	  Selecting this option causes mac80211 to print out very
	  verbose mesh peer link debugging messages (when mac80211
	  is taking part in a mesh network).
	  It should not be selected on production systems as those
	  messages are remotely triggerable.

	  Do not select this option.

config MAC80211_LOWTX_FRAME_DUMP
	bool "Debug frame dumping"
	depends on MAC80211_DEBUG
	depends on MAC80211_DEBUG_MENU
	---help---
	  Selecting this option will cause the stack to
	  print a message for each frame that is handed
@@ -137,33 +205,17 @@ config MAC80211_LOWTX_FRAME_DUMP
	  If unsure, say N and insert the debugging code
	  you require into the driver you are debugging.

config MAC80211_TKIP_DEBUG
	bool "TKIP debugging"
	depends on MAC80211_DEBUG

config MAC80211_DEBUG_COUNTERS
	bool "Extra statistics for TX/RX debugging"
	depends on MAC80211_DEBUG

config MAC80211_IBSS_DEBUG
	bool "Support for IBSS testing"
	depends on MAC80211_DEBUG
	---help---
	  Say Y here if you intend to debug the IBSS code.

config MAC80211_VERBOSE_PS_DEBUG
	bool "Verbose powersave mode debugging"
	depends on MAC80211_DEBUG
	depends on MAC80211_DEBUG_MENU
	depends on MAC80211_DEBUGFS
	---help---
	  Say Y here to print out verbose powersave
	  mode debug messages.
	  Selecting this option causes mac80211 to keep additional
	  and very verbose statistics about TX and RX handler use
	  and show them in debugfs.

config MAC80211_VERBOSE_MPL_DEBUG
	bool "Verbose mesh peer link debugging"
	depends on MAC80211_DEBUG && MAC80211_MESH
	---help---
	  Say Y here to print out verbose mesh peer link
	  debug messages.
	  If unsure, say N.

config MAC80211_VERBOSE_SPECT_MGMT_DEBUG
	bool "Verbose Spectrum Management (IEEE 802.11h)debugging"
+1 −1
Original line number Diff line number Diff line
@@ -954,7 +954,7 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx,
				     struct ieee80211_hdr *hdr);

#ifdef CONFIG_MAC80211_DEBUG
#ifdef CONFIG_MAC80211_NOINLINE
#define debug_noinline noinline
#else
#define debug_noinline
+3 −3
Original line number Diff line number Diff line
@@ -184,9 +184,9 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
		sdata->u.mntr_flags = MONITOR_FLAG_CONTROL |
				      MONITOR_FLAG_OTHER_BSS;
		break;
	default:
		printk(KERN_WARNING "%s: %s: Unknown interface type 0x%x",
		       dev->name, __func__, type);
	case IEEE80211_IF_TYPE_INVALID:
		BUG();
		break;
	}
	ieee80211_debugfs_change_if_type(sdata, oldtype);
}
+29 −6
Original line number Diff line number Diff line
@@ -152,8 +152,6 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
	 * This interface uses 802.3 frames. */
	if (new_mtu < 256 ||
	    new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) {
		printk(KERN_WARNING "%s: invalid MTU %d\n",
		       dev->name, new_mtu);
		return -EINVAL;
	}

@@ -589,7 +587,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)

	sta = sta_info_get(local, ra);
	if (!sta) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG "Could not find the station\n");
#endif
		ret = -ENOENT;
		goto exit;
	}
@@ -617,9 +617,11 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
	sta->ampdu_mlme.tid_tx[tid] =
			kmalloc(sizeof(struct tid_ampdu_tx), GFP_ATOMIC);
	if (!sta->ampdu_mlme.tid_tx[tid]) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		if (net_ratelimit())
			printk(KERN_ERR "allocate tx mlme to tid %d failed\n",
					tid);
#endif
		ret = -ENOMEM;
		goto err_unlock_sta;
	}
@@ -689,7 +691,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
	sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.expires =
				jiffies + ADDBA_RESP_INTERVAL;
	add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
#ifdef CONFIG_MAC80211_HT_DEBUG
	printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid);
#endif
	goto exit;

err_unlock_queue:
@@ -771,8 +775,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
	DECLARE_MAC_BUF(mac);

	if (tid >= STA_TID_NUM) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
				tid, STA_TID_NUM);
#endif
		return;
	}

@@ -780,8 +786,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
	sta = sta_info_get(local, ra);
	if (!sta) {
		rcu_read_unlock();
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG "Could not find station: %s\n",
				print_mac(mac, ra));
#endif
		return;
	}

@@ -789,8 +797,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
	spin_lock_bh(&sta->lock);

	if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG "addBA was not requested yet, state is %d\n",
				*state);
#endif
		spin_unlock_bh(&sta->lock);
		rcu_read_unlock();
		return;
@@ -801,7 +811,9 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
	*state |= HT_ADDBA_DRV_READY_MSK;

	if (*state == HT_AGG_STATE_OPERATIONAL) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid);
#endif
		ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
	}
	spin_unlock_bh(&sta->lock);
@@ -818,8 +830,10 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
	DECLARE_MAC_BUF(mac);

	if (tid >= STA_TID_NUM) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
				tid, STA_TID_NUM);
#endif
		return;
	}

@@ -831,8 +845,10 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
	rcu_read_lock();
	sta = sta_info_get(local, ra);
	if (!sta) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG "Could not find station: %s\n",
				print_mac(mac, ra));
#endif
		rcu_read_unlock();
		return;
	}
@@ -842,7 +858,9 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
	 * ieee80211_stop_tx_ba_session will let only
	 * one stop call to pass through per sta/tid */
	if ((*state & HT_AGG_STATE_REQ_STOP_BA_MSK) == 0) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n");
#endif
		rcu_read_unlock();
		return;
	}
@@ -884,9 +902,11 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
	struct sk_buff *skb = dev_alloc_skb(0);

	if (unlikely(!skb)) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		if (net_ratelimit())
			printk(KERN_WARNING "%s: Not enough memory, "
			       "dropping start BA session", skb->dev->name);
#endif
		return;
	}
	ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
@@ -907,9 +927,11 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
	struct sk_buff *skb = dev_alloc_skb(0);

	if (unlikely(!skb)) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		if (net_ratelimit())
			printk(KERN_WARNING "%s: Not enough memory, "
			       "dropping stop BA session", skb->dev->name);
#endif
		return;
	}
	ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
@@ -1236,9 +1258,8 @@ static void ieee80211_tasklet_handler(unsigned long data)
						 ra_tid->ra, ra_tid->tid);
			dev_kfree_skb(skb);
			break ;
		default: /* should never get here! */
			printk(KERN_ERR "%s: Unknown message type (%d)\n",
			       wiphy_name(local->hw.wiphy), skb->pkt_type);
		default:
			WARN_ON(1);
			dev_kfree_skb(skb);
			break;
		}
@@ -1365,12 +1386,14 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
		return;
	}

#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
	if (net_ratelimit())
		printk(KERN_DEBUG "%s: dropped TX filtered frame, "
		       "queue_len=%d PS=%d @%lu\n",
		       wiphy_name(local->hw.wiphy),
		       skb_queue_len(&sta->tx_filtered),
		       !!test_sta_flags(sta, WLAN_STA_PS), jiffies);
#endif
	dev_kfree_skb(skb);
}

+49 −157
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ static void ieee80211_sta_wmm_params(struct net_device *dev,
		params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4);
		params.cw_min = ecw2cw(pos[1] & 0x0f);
		params.txop = pos[2] | (pos[3] << 8);
#ifdef CONFIG_MAC80211_DEBUG
#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
		printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d "
		       "cWmin=%d cWmax=%d txop=%d\n",
		       dev->name, queue, aci, acm, params.aifs, params.cw_min,
@@ -371,6 +371,7 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
	u32 changed = 0;

	if (use_protection != bss_conf->use_cts_prot) {
#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
		if (net_ratelimit()) {
			printk(KERN_DEBUG "%s: CTS protection %s (BSSID="
			       "%s)\n",
@@ -378,11 +379,13 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
			       use_protection ? "enabled" : "disabled",
			       print_mac(mac, ifsta->bssid));
		}
#endif
		bss_conf->use_cts_prot = use_protection;
		changed |= BSS_CHANGED_ERP_CTS_PROT;
	}

	if (use_short_preamble != bss_conf->use_short_preamble) {
#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
		if (net_ratelimit()) {
			printk(KERN_DEBUG "%s: switched to %s barker preamble"
			       " (BSSID=%s)\n",
@@ -390,6 +393,7 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
			       use_short_preamble ? "short" : "long",
			       print_mac(mac, ifsta->bssid));
		}
#endif
		bss_conf->use_short_preamble = use_short_preamble;
		changed |= BSS_CHANGED_ERP_PREAMBLE;
	}
@@ -1175,14 +1179,10 @@ static void ieee80211_auth_challenge(struct net_device *dev,
	u8 *pos;
	struct ieee802_11_elems elems;

	printk(KERN_DEBUG "%s: replying to auth challenge\n", dev->name);
	pos = mgmt->u.auth.variable;
	ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
	if (!elems.challenge) {
		printk(KERN_DEBUG "%s: no challenge IE in shared key auth "
		       "frame\n", dev->name);
	if (!elems.challenge)
		return;
	}
	ieee80211_send_auth(dev, ifsta, 3, elems.challenge - 2,
			    elems.challenge_len + 2, 1);
}
@@ -1364,9 +1364,11 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
	sta->ampdu_mlme.tid_rx[tid] =
			kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC);
	if (!sta->ampdu_mlme.tid_rx[tid]) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		if (net_ratelimit())
			printk(KERN_ERR "allocate rx mlme to tid %d failed\n",
					tid);
#endif
		goto end;
	}
	/* rx timer */
@@ -1382,9 +1384,11 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
	tid_agg_rx->reorder_buf =
		kmalloc(buf_size * sizeof(struct sk_buff *), GFP_ATOMIC);
	if (!tid_agg_rx->reorder_buf) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		if (net_ratelimit())
			printk(KERN_ERR "can not allocate reordering buffer "
			       "to tid %d\n", tid);
#endif
		kfree(sta->ampdu_mlme.tid_rx[tid]);
		goto end;
	}
@@ -1451,8 +1455,6 @@ static void ieee80211_sta_process_addba_resp(struct net_device *dev,

	if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
		spin_unlock_bh(&sta->lock);
		printk(KERN_DEBUG "state not HT_ADDBA_REQUESTED_MSK:"
			"%d\n", *state);
		goto addba_resp_exit;
	}

@@ -1471,22 +1473,14 @@ static void ieee80211_sta_process_addba_resp(struct net_device *dev,
#endif /* CONFIG_MAC80211_HT_DEBUG */
	if (le16_to_cpu(mgmt->u.action.u.addba_resp.status)
			== WLAN_STATUS_SUCCESS) {
		if (*state & HT_ADDBA_RECEIVED_MSK)
			printk(KERN_DEBUG "double addBA response\n");

		*state |= HT_ADDBA_RECEIVED_MSK;
		sta->ampdu_mlme.addba_req_num[tid] = 0;

		if (*state == HT_AGG_STATE_OPERATIONAL) {
			printk(KERN_DEBUG "Aggregation on for tid %d \n", tid);
		if (*state == HT_AGG_STATE_OPERATIONAL)
			ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
		}

		spin_unlock_bh(&sta->lock);
		printk(KERN_DEBUG "recipient accepted agg: tid %d \n", tid);
	} else {
		printk(KERN_DEBUG "recipient rejected agg: tid %d \n", tid);

		sta->ampdu_mlme.addba_req_num[tid]++;
		/* this will allow the state check in stop_BA_session */
		*state = HT_AGG_STATE_OPERATIONAL;
@@ -1585,7 +1579,7 @@ void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *ra, u16 tid,
					ra, tid, NULL);
	if (ret)
		printk(KERN_DEBUG "HW problem - can not stop rx "
				"aggergation for tid %d\n", tid);
				"aggregation for tid %d\n", tid);

	/* shutdown timer has not expired */
	if (initiator != WLAN_BACK_TIMER)
@@ -1691,12 +1685,16 @@ void sta_addba_resp_timer_expired(unsigned long data)
	if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
		spin_unlock_bh(&sta->lock);
		*state = HT_AGG_STATE_IDLE;
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG "timer expired on tid %d but we are not "
				"expecting addBA response there", tid);
#endif
		goto timer_expired_exit;
	}

#ifdef CONFIG_MAC80211_HT_DEBUG
	printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid);
#endif

	/* go through the state check in stop_BA_session */
	*state = HT_AGG_STATE_OPERATIONAL;
@@ -1724,7 +1722,9 @@ static void sta_rx_agg_session_timer_expired(unsigned long data)
	struct sta_info *sta = container_of(timer_to_id, struct sta_info,
					 timer_to_tid[0]);

#ifdef CONFIG_MAC80211_HT_DEBUG
	printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid);
#endif
	ieee80211_sta_stop_rx_ba_session(sta->sdata->dev, sta->addr,
					 (u16)*ptid, WLAN_BACK_TIMER,
					 WLAN_REASON_QSTA_TIMEOUT);
@@ -1819,47 +1819,24 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev,
	DECLARE_MAC_BUF(mac);

	if (ifsta->state != IEEE80211_AUTHENTICATE &&
	    sdata->vif.type != IEEE80211_IF_TYPE_IBSS) {
		printk(KERN_DEBUG "%s: authentication frame received from "
		       "%s, but not in authenticate state - ignored\n",
		       dev->name, print_mac(mac, mgmt->sa));
	    sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
		return;
	}

	if (len < 24 + 6) {
		printk(KERN_DEBUG "%s: too short (%zd) authentication frame "
		       "received from %s - ignored\n",
		       dev->name, len, print_mac(mac, mgmt->sa));
	if (len < 24 + 6)
		return;
	}

	if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
	    memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) {
		printk(KERN_DEBUG "%s: authentication frame received from "
		       "unknown AP (SA=%s BSSID=%s) - "
		       "ignored\n", dev->name, print_mac(mac, mgmt->sa),
		       print_mac(mac, mgmt->bssid));
	    memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0)
		return;
	}

	if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
	    memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) {
		printk(KERN_DEBUG "%s: authentication frame received from "
		       "unknown BSSID (SA=%s BSSID=%s) - "
		       "ignored\n", dev->name, print_mac(mac, mgmt->sa),
		       print_mac(mac, mgmt->bssid));
	    memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)
		return;
	}

	auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
	auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
	status_code = le16_to_cpu(mgmt->u.auth.status_code);

	printk(KERN_DEBUG "%s: RX authentication from %s (alg=%d "
	       "transaction=%d status=%d)\n",
	       dev->name, print_mac(mac, mgmt->sa), auth_alg,
	       auth_transaction, status_code);

	if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
		/*
		 * IEEE 802.11 standard does not require authentication in IBSS
@@ -1867,26 +1844,16 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev,
		 * However, try to reply to authentication attempts if someone
		 * has actually implemented this.
		 */
		if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) {
			printk(KERN_DEBUG "%s: unexpected IBSS authentication "
			       "frame (alg=%d transaction=%d)\n",
			       dev->name, auth_alg, auth_transaction);
		if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
			return;
		}
		ieee80211_send_auth(dev, ifsta, 2, NULL, 0, 0);
	}

	if (auth_alg != ifsta->auth_alg ||
	    auth_transaction != ifsta->auth_transaction) {
		printk(KERN_DEBUG "%s: unexpected authentication frame "
		       "(alg=%d transaction=%d)\n",
		       dev->name, auth_alg, auth_transaction);
	    auth_transaction != ifsta->auth_transaction)
		return;
	}

	if (status_code != WLAN_STATUS_SUCCESS) {
		printk(KERN_DEBUG "%s: AP denied authentication (auth_alg=%d "
		       "code=%d)\n", dev->name, ifsta->auth_alg, status_code);
		if (status_code == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) {
			u8 algs[3];
			const int num_algs = ARRAY_SIZE(algs);
@@ -1915,9 +1882,6 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev,
				    !ieee80211_sta_wep_configured(dev))
					continue;
				ifsta->auth_alg = algs[pos];
				printk(KERN_DEBUG "%s: set auth_alg=%d for "
				       "next try\n",
				       dev->name, ifsta->auth_alg);
				break;
			}
		}
@@ -1947,27 +1911,14 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev,
	u16 reason_code;
	DECLARE_MAC_BUF(mac);

	if (len < 24 + 2) {
		printk(KERN_DEBUG "%s: too short (%zd) deauthentication frame "
		       "received from %s - ignored\n",
		       dev->name, len, print_mac(mac, mgmt->sa));
	if (len < 24 + 2)
		return;
	}

	if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) {
		printk(KERN_DEBUG "%s: deauthentication frame received from "
		       "unknown AP (SA=%s BSSID=%s) - "
		       "ignored\n", dev->name, print_mac(mac, mgmt->sa),
		       print_mac(mac, mgmt->bssid));
	if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN))
		return;
	}

	reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);

	printk(KERN_DEBUG "%s: RX deauthentication from %s"
	       " (reason=%d)\n",
	       dev->name, print_mac(mac, mgmt->sa), reason_code);

	if (ifsta->flags & IEEE80211_STA_AUTHENTICATED)
		printk(KERN_DEBUG "%s: deauthenticated\n", dev->name);

@@ -1992,27 +1943,14 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev,
	u16 reason_code;
	DECLARE_MAC_BUF(mac);

	if (len < 24 + 2) {
		printk(KERN_DEBUG "%s: too short (%zd) disassociation frame "
		       "received from %s - ignored\n",
		       dev->name, len, print_mac(mac, mgmt->sa));
	if (len < 24 + 2)
		return;
	}

	if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) {
		printk(KERN_DEBUG "%s: disassociation frame received from "
		       "unknown AP (SA=%s BSSID=%s) - "
		       "ignored\n", dev->name, print_mac(mac, mgmt->sa),
		       print_mac(mac, mgmt->bssid));
	if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN))
		return;
	}

	reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);

	printk(KERN_DEBUG "%s: RX disassociation from %s"
	       " (reason=%d)\n",
	       dev->name, print_mac(mac, mgmt->sa), reason_code);

	if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
		printk(KERN_DEBUG "%s: disassociated\n", dev->name);

@@ -2048,27 +1986,14 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
	/* AssocResp and ReassocResp have identical structure, so process both
	 * of them in this function. */

	if (ifsta->state != IEEE80211_ASSOCIATE) {
		printk(KERN_DEBUG "%s: association frame received from "
		       "%s, but not in associate state - ignored\n",
		       dev->name, print_mac(mac, mgmt->sa));
	if (ifsta->state != IEEE80211_ASSOCIATE)
		return;
	}

	if (len < 24 + 6) {
		printk(KERN_DEBUG "%s: too short (%zd) association frame "
		       "received from %s - ignored\n",
		       dev->name, len, print_mac(mac, mgmt->sa));
	if (len < 24 + 6)
		return;
	}

	if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) {
		printk(KERN_DEBUG "%s: association frame received from "
		       "unknown AP (SA=%s BSSID=%s) - "
		       "ignored\n", dev->name, print_mac(mac, mgmt->sa),
		       print_mac(mac, mgmt->bssid));
	if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0)
		return;
	}

	capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info);
	status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
@@ -2663,12 +2588,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
	if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
		return; /* ignore ProbeResp to foreign address */

#if 0
	printk(KERN_DEBUG "%s: RX %s from %s to %s\n",
	       dev->name, beacon ? "Beacon" : "Probe Response",
	       print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da));
#endif

	beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp);

	if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id &&
@@ -2698,15 +2617,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
			sta->supp_rates[rx_status->band] =
				sdata->u.sta.supp_rates_bits[rx_status->band];
		}
		if (sta->supp_rates[rx_status->band] != prev_rates) {
			printk(KERN_DEBUG "%s: updated supp_rates set for "
			       "%s based on beacon info (0x%llx & 0x%llx -> "
			       "0x%llx)\n",
			       dev->name, print_mac(mac, sta->addr),
			       (unsigned long long) prev_rates,
			       (unsigned long long) supp_rates,
			       (unsigned long long) sta->supp_rates[rx_status->band]);
		}
	}

	rcu_read_unlock();
@@ -2962,11 +2872,10 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
#endif /* CONFIG_MAC80211_IBSS_DEBUG */
		if (beacon_timestamp > rx_timestamp) {
#ifndef CONFIG_MAC80211_IBSS_DEBUG
			if (net_ratelimit())
#endif
			printk(KERN_DEBUG "%s: beacon TSF higher than "
			       "local TSF - IBSS merge with BSSID %s\n",
			       dev->name, print_mac(mac, mgmt->bssid));
#endif
			ieee80211_sta_join_ibss(dev, &sdata->u.sta, bss);
			ieee80211_ibss_add_sta(dev, NULL,
					       mgmt->bssid, mgmt->sa,
@@ -3106,11 +3015,11 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev,
	pos = mgmt->u.probe_req.variable;
	if (pos[0] != WLAN_EID_SSID ||
	    pos + 2 + pos[1] > end) {
		if (net_ratelimit()) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG
		printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq "
		       "from %s\n",
		       dev->name, print_mac(mac, mgmt->sa));
		}
#endif
		return;
	}
	if (pos[1] != 0 &&
@@ -3179,11 +3088,6 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev,
				break;
			ieee80211_sta_process_delba(dev, mgmt, len);
			break;
		default:
			if (net_ratelimit())
			   printk(KERN_DEBUG "%s: Rx unknown A-MPDU action\n",
					dev->name);
			break;
		}
		break;
	case PLINK_CATEGORY:
@@ -3194,11 +3098,6 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev,
		if (ieee80211_vif_is_mesh(&sdata->vif))
			mesh_rx_path_sel_frame(dev, mgmt, len);
		break;
	default:
		if (net_ratelimit())
			printk(KERN_DEBUG "%s: Rx unknown action frame - "
			"category=%d\n", dev->name, mgmt->u.action.category);
		break;
	}
}

@@ -3234,11 +3133,6 @@ void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
		skb_queue_tail(&ifsta->skb_queue, skb);
		queue_work(local->hw.workqueue, &ifsta->work);
		return;
	default:
		printk(KERN_DEBUG "%s: received unknown management frame - "
		       "stype=%d\n", dev->name,
		       (fc & IEEE80211_FCTL_STYPE) >> 4);
		break;
	}

 fail:
@@ -3367,8 +3261,10 @@ static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time)
	spin_lock_irqsave(&local->sta_lock, flags);
	list_for_each_entry_safe(sta, tmp, &local->sta_list, list)
		if (time_after(jiffies, sta->last_rx + exp_time)) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG
			printk(KERN_DEBUG "%s: expiring inactive STA %s\n",
			       dev->name, print_mac(mac, sta->addr));
#endif
			__sta_info_unlink(&sta);
			if (sta)
				list_add(&sta->list, &tmp_list);
@@ -3451,13 +3347,10 @@ void ieee80211_sta_work(struct work_struct *work)
	if (local->sta_sw_scanning || local->sta_hw_scanning)
		return;

	if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
	if (WARN_ON(sdata->vif.type != IEEE80211_IF_TYPE_STA &&
		    sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
	    sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) {
		printk(KERN_DEBUG "%s: ieee80211_sta_work: non-STA interface "
		       "(type=%d)\n", dev->name, sdata->vif.type);
		    sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT))
		return;
	}
	ifsta = &sdata->u.sta;

	while ((skb = skb_dequeue(&ifsta->skb_queue)))
@@ -3511,8 +3404,7 @@ void ieee80211_sta_work(struct work_struct *work)
		break;
#endif
	default:
		printk(KERN_DEBUG "ieee80211_sta_work: Unknown state %d\n",
		       ifsta->state);
		WARN_ON(1);
		break;
	}

@@ -3547,8 +3439,6 @@ static void ieee80211_sta_reset_auth(struct net_device *dev,
		ifsta->auth_alg = WLAN_AUTH_LEAP;
	else
		ifsta->auth_alg = WLAN_AUTH_OPEN;
	printk(KERN_DEBUG "%s: Initial auth_alg=%d\n", dev->name,
	       ifsta->auth_alg);
	ifsta->auth_transaction = -1;
	ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
	ifsta->auth_tries = ifsta->assoc_tries = 0;
@@ -4474,8 +4364,10 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
	if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid))
		return NULL;

#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
	printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n",
	       wiphy_name(local->hw.wiphy), print_mac(mac, addr), dev->name);
#endif

	sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
	if (!sta)
@@ -4502,7 +4394,7 @@ int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason)
	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
	struct ieee80211_if_sta *ifsta = &sdata->u.sta;

	printk(KERN_DEBUG "%s: deauthenticate(reason=%d)\n",
	printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n",
	       dev->name, reason);

	if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
@@ -4520,7 +4412,7 @@ int ieee80211_sta_disassociate(struct net_device *dev, u16 reason)
	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
	struct ieee80211_if_sta *ifsta = &sdata->u.sta;

	printk(KERN_DEBUG "%s: disassociate(reason=%d)\n",
	printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n",
	       dev->name, reason);

	if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
Loading