All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cfg80211: skip disabled channels on channel survey
@ 2011-05-27 14:24 Luis R. Rodriguez
  2011-05-27 19:28 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Luis R. Rodriguez @ 2011-05-27 14:24 UTC (permalink / raw)
  To: johannes, linville; +Cc: linux-wireless, Luis R. Rodriguez

The channel survey information will be empy for
disabled channels so simply discard those entries.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 net/wireless/nl80211.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ec83f41..e283816 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3754,10 +3754,6 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 pid, u32 seq,
 	void *hdr;
 	struct nlattr *infoattr;
 
-	/* Survey without a channel doesn't make sense */
-	if (!survey->channel)
-		return -EINVAL;
-
 	hdr = nl80211hdr_put(msg, pid, seq, flags,
 			     NL80211_CMD_NEW_SURVEY_RESULTS);
 	if (!hdr)
@@ -3820,6 +3816,8 @@ static int nl80211_dump_survey(struct sk_buff *skb,
 	}
 
 	while (1) {
+		struct ieee80211_channel *chan;
+
 		res = dev->ops->dump_survey(&dev->wiphy, netdev, survey_idx,
 					    &survey);
 		if (res == -ENOENT)
@@ -3827,6 +3825,19 @@ static int nl80211_dump_survey(struct sk_buff *skb,
 		if (res)
 			goto out_err;
 
+		/* Survey without a channel doesn't make sense */
+		if (!survey.channel) {
+			res = -EINVAL;
+			goto out;
+		}
+
+		chan = ieee80211_get_channel(&dev->wiphy,
+					     survey.channel->center_freq);
+		if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) {
+			survey_idx++;
+			continue;
+		}
+
 		if (nl80211_send_survey(skb,
 				NETLINK_CB(cb->skb).pid,
 				cb->nlh->nlmsg_seq, NLM_F_MULTI,
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cfg80211: skip disabled channels on channel survey
  2011-05-27 14:24 [PATCH] cfg80211: skip disabled channels on channel survey Luis R. Rodriguez
@ 2011-05-27 19:28 ` Johannes Berg
  2011-05-29 15:37   ` Luis R. Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2011-05-27 19:28 UTC (permalink / raw)
  To: Luis R. Rodriguez, linville; +Cc: linux-wireless

> The channel survey information will be empy for
> disabled channels so simply discard those entries.

What if the channel was recently disabled?

Johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cfg80211: skip disabled channels on channel survey
  2011-05-27 19:28 ` Johannes Berg
@ 2011-05-29 15:37   ` Luis R. Rodriguez
  0 siblings, 0 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2011-05-29 15:37 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless

On Fri, May 27, 2011 at 12:28 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
>> The channel survey information will be empy for
>> disabled channels so simply discard those entries.
>
> What if the channel was recently disabled?

Then we'd stop sending survey data for it.

  Luis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-29 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27 14:24 [PATCH] cfg80211: skip disabled channels on channel survey Luis R. Rodriguez
2011-05-27 19:28 ` Johannes Berg
2011-05-29 15:37   ` Luis R. Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.