Search Linux Wireless

Re: [PATCH RFC] mac80211: Filter scan results

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

 



On Thu, Feb 05, 2009 at 10:44:07AM +0200, Jouni Malinen wrote:
> As far as a possible workaround in kernel code is concerned,
> length=65535 could be considered a special case. Since it is clear that
> userspace cannot provide a larger buffer, there is not much point in
> returning -E2BIG. Instead, the results could be truncated after the last
> BSS that fit into the buffer and that would be returned to userspace.
> This is likely going to be much more useful than not being able to
> receive any result.

And here's an example patch on doing that for mac80211 (drivers that do
not use mac80211 would need to do something similar if they want to
support this mechanism). Would this change be acceptable for mac80211?

---
 net/mac80211/scan.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

--- wireless-testing.orig/net/mac80211/scan.c	2009-02-05 11:33:37.000000000 +0200
+++ wireless-testing/net/mac80211/scan.c	2009-02-05 13:07:41.000000000 +0200
@@ -934,6 +934,19 @@ int ieee80211_scan_results(struct ieee80
 	list_for_each_entry(bss, &local->bss_list, list) {
 		if (buf + len - current_ev <= IW_EV_ADDR_LEN) {
 			spin_unlock_bh(&local->bss_lock);
+			if (len == 65535) {
+				/*
+				 * WEXT uses 16-bit field for the length which
+				 * means that the largest buffer size that can
+				 * be used here is 65535 bytes. There is not
+				 * much help in returning -E2BIG if the user
+				 * space program cannot use a larger buffer. As
+				 * a workaround, return as many BSSes as
+				 * possible instead of making it impossible for
+				 * the application to get any results.
+				 */
+				return current_ev - buf;
+			}
 			return -E2BIG;
 		}
 		current_ev = ieee80211_scan_result(local, info, bss,
 
-- 
Jouni Malinen                                            PGP id EFC895FA
--
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 Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux