Search Linux Wireless

[PATCH] nl80211: Don't add empty bands or disabled channels in NL80211_CMD_GET_WIPHY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch resolves issues where the driver reports too many channels
for them all to fit in one netlink message, as long as some are
disabled, and makes it possible to use non-standard channels and
customized regulatory databases.

Signed-off-by: Dennis H Jensen <dennis.h.jensen@xxxxxxxxxxx>

---
 net/wireless/nl80211.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 807d448..8cd274d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -986,6 +986,15 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flag
 		if (!dev->wiphy.bands[band])
 			continue;
 
+		/* don't add band info if all channels are disabled */
+		for (i = 0; i < dev->wiphy.bands[band]->n_channels; i++) {
+			chan = &dev->wiphy.bands[band]->channels[i];
+			if (!(chan->flags & IEEE80211_CHAN_DISABLED))
+				break;
+		}
+		if (i == dev->wiphy.bands[band]->n_channels)
+			continue;
+
 		nl_band = nla_nest_start(msg, band);
 		if (!nl_band)
 			goto nla_put_failure;
@@ -1018,12 +1027,15 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flag
 			goto nla_put_failure;
 
 		for (i = 0; i < dev->wiphy.bands[band]->n_channels; i++) {
+			/* don't add disabled frequencies */
+			chan = &dev->wiphy.bands[band]->channels[i];
+			if (chan->flags & IEEE80211_CHAN_DISABLED)
+				continue;
+
 			nl_freq = nla_nest_start(msg, i);
 			if (!nl_freq)
 				goto nla_put_failure;
 
-			chan = &dev->wiphy.bands[band]->channels[i];
-
 			if (nl80211_msg_put_channel(msg, chan))
 				goto nla_put_failure;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux