X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/f52d66ff00b24111f87c274d3d7085ef2e1d27b1..d34e35f7814a93e09db9f9bcf3595e16b22d3c27:/package/wlcompat/src/wlcompat.c diff --git a/package/wlcompat/src/wlcompat.c b/package/wlcompat/src/wlcompat.c index 23b0d50a8..625da6a3a 100644 --- a/package/wlcompat/src/wlcompat.c +++ b/package/wlcompat/src/wlcompat.c @@ -33,6 +33,7 @@ #include #include +#include static struct net_device *dev; static unsigned short bss_force; @@ -47,7 +48,7 @@ const long channel_frequency[] = { }; #define NUM_CHANNELS ( sizeof(channel_frequency) / sizeof(channel_frequency[0]) ) -#define RNG_POLL_FREQ 20 +#define RNG_POLL_FREQ 2 typedef struct internal_wsec_key { uint8 index; // 0x00 @@ -305,6 +306,16 @@ static int wlcompat_get_scan(struct net_device *dev, iwe.u.data.flags = 1; current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss_info->SSID); + /* send mode */ + if (bss_info->capability & (DOT11_CAP_ESS | DOT11_CAP_IBSS)) { + iwe.cmd = SIOCGIWMODE; + if (bss_info->capability & DOT11_CAP_ESS) + iwe.u.mode = IW_MODE_MASTER; + else if (bss_info->capability & DOT11_CAP_IBSS) + iwe.u.mode = IW_MODE_ADHOC; + current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN); + } + /* send frequency/channel info */ iwe.cmd = SIOCGIWFREQ; iwe.u.freq.e = 0; @@ -318,6 +329,16 @@ static int wlcompat_get_scan(struct net_device *dev, iwe.u.qual.noise = bss_info->phy_noise; current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); + /* send encryption capability */ + iwe.cmd = SIOCGIWENCODE; + iwe.u.data.pointer = NULL; + iwe.u.data.length = 0; + if (bss_info->capability & DOT11_CAP_PRIVACY) + iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; + else + iwe.u.data.flags = IW_ENCODE_DISABLED; + current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, NULL); + /* send rate information */ iwe.cmd = SIOCGIWRATE; current_val = current_ev + IW_EV_LCP_LEN; @@ -982,6 +1003,7 @@ static int new_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { return ret; } +#ifndef DEBUG static struct timer_list rng_timer; static void rng_timer_tick(unsigned long n) @@ -999,7 +1021,7 @@ static void rng_timer_tick(unsigned long n) mod_timer(&rng_timer, jiffies + (HZ/RNG_POLL_FREQ)); } - +#endif static int __init wlcompat_init() { @@ -1024,12 +1046,14 @@ static int __init wlcompat_init() dev->wireless_handlers = (struct iw_handler_def *)&wlcompat_handler_def; dev->get_wireless_stats = wlcompat_get_wireless_stats; +#ifndef DEBUG if (random) { init_timer(&rng_timer); rng_timer.function = rng_timer_tick; rng_timer.data = (unsigned long) dev; rng_timer_tick((unsigned long) dev); } +#endif #ifdef DEBUG printk("broadcom driver private data: 0x%08x\n", dev->priv); @@ -1039,8 +1063,10 @@ static int __init wlcompat_init() static void __exit wlcompat_exit() { +#ifndef DEBUG if (random) del_timer(&rng_timer); +#endif dev->get_wireless_stats = NULL; dev->wireless_handlers = NULL; dev->do_ioctl = old_ioctl; @@ -1051,6 +1077,8 @@ EXPORT_NO_SYMBOLS; MODULE_AUTHOR("openwrt.org"); MODULE_LICENSE("GPL"); +#ifndef DEBUG module_param(random, int, 0); +#endif module_init(wlcompat_init); module_exit(wlcompat_exit);