提交 55cd94aa 编写于 作者: Z Zhu Yi 提交者: John W. Linville

[PATCH] ieee80211: Fix iwlist scan can only show about 20 APs

Limit the amount of output given to iwlist scan.
Signed-off-by: NHong Liu <hong.liu@intel.com>
Signed-off-by: NZhu Yi <yi.zhu@intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 b6daa25d
...@@ -232,15 +232,18 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, ...@@ -232,15 +232,18 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee,
return start; return start;
} }
#define SCAN_ITEM_SIZE 128
int ieee80211_wx_get_scan(struct ieee80211_device *ieee, int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
struct iw_request_info *info, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct ieee80211_network *network; struct ieee80211_network *network;
unsigned long flags; unsigned long flags;
int err = 0;
char *ev = extra; char *ev = extra;
char *stop = ev + IW_SCAN_MAX_DATA; char *stop = ev + wrqu->data.length;
int i = 0; int i = 0;
IEEE80211_DEBUG_WX("Getting scan\n"); IEEE80211_DEBUG_WX("Getting scan\n");
...@@ -249,6 +252,11 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, ...@@ -249,6 +252,11 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
list_for_each_entry(network, &ieee->network_list, list) { list_for_each_entry(network, &ieee->network_list, list) {
i++; i++;
if (stop - ev < SCAN_ITEM_SIZE) {
err = -E2BIG;
break;
}
if (ieee->scan_age == 0 || if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies)) time_after(network->last_scanned + ieee->scan_age, jiffies))
ev = ipw2100_translate_scan(ieee, ev, stop, network); ev = ipw2100_translate_scan(ieee, ev, stop, network);
...@@ -270,7 +278,7 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, ...@@ -270,7 +278,7 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
IEEE80211_DEBUG_WX("exit: %d networks returned.\n", i); IEEE80211_DEBUG_WX("exit: %d networks returned.\n", i);
return 0; return err;
} }
int ieee80211_wx_set_encode(struct ieee80211_device *ieee, int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册