[patch] IWSPY support for ad-hoc mode
dannys at changind.com
dannys
Fri Sep 5 13:47:57 PDT 2003
Below is a patch (based on 0.0.4) that allows for IWSPY support in
ad-hoc mode. It may very well work for all modes or break other
modes. I've only tested it in ad-hoc. But it seems to work decently.
A slightly nicer feature in this patch is that any MAC address may be
entered, regardless of whether it's been seen before or not.
(contrary to the wlan-ng drivers, which can only add MAC's that are
currently visible). I don't know if that was a requirement of
wireless extensions or not. But I like being able to add any MAC
better.
diff -uNr hostap-0.0.4.orig/driver/modules/hostap_80211_rx.c hostap-0.0.4/driver/modules/hostap_80211_rx.c
--- hostap-0.0.4.orig/driver/modules/hostap_80211_rx.c Sun Jul 27 10:52:41 2003
+++ hostap-0.0.4/driver/modules/hostap_80211_rx.c Fri Sep 5 10:54:59 2003
@@ -584,6 +584,7 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
+ hostap_update_rx_stats(local->ap, hdr, rx_stats);
if (local->iw_mode == IW_MODE_MONITOR) {
monitor_rx(dev, skb, rx_stats);
diff -uNr hostap-0.0.4.orig/driver/modules/hostap_ioctl.c hostap-0.0.4/driver/modules/hostap_ioctl.c
--- hostap-0.0.4.orig/driver/modules/hostap_ioctl.c Sun Jul 27 20:28:32 2003
+++ hostap-0.0.4/driver/modules/hostap_ioctl.c Fri Sep 5 11:21:49 2003
@@ -286,12 +286,14 @@
struct sockaddr addr[IW_MAX_SPY];
struct iw_quality qual[IW_MAX_SPY];
+#if 0
if (local->iw_mode != IW_MODE_MASTER) {
printk("SIOCGIWSPY is currently only supported in Host AP "
"mode\n");
srq->length = 0;
return -EOPNOTSUPP;
}
+#endif
srq->length = prism2_ap_get_sta_qual(local, addr, qual, IW_MAX_SPY, 0);
@@ -301,6 +303,28 @@
return 0;
}
+
+static int prism2_ioctl_siwspy(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *srq, char *extra)
+{
+ local_info_t *local = (local_info_t *)dev->priv;
+ struct ap_data *ap = local->ap;
+ struct sockaddr *addr;
+ int i;
+
+
+ if( srq->length > IW_MAX_SPY )
+ return -E2BIG;
+
+ addr = (struct sockaddr *)(extra + sizeof(srq->length));
+
+ for(i=0; i<srq->length; i++, addr++) {
+ hostap_add_sta(ap, (uint8_t *)addr);
+ }
+
+ return 0;
+}
#endif /* WIRELESS_EXT <= 15 */
@@ -3132,7 +3156,7 @@
iw_handler_set_thrspy, /* SIOCSIWTHRSPY */
iw_handler_get_thrspy, /* SIOCGIWTHRSPY */
#else /* WIRELESS_EXT > 15 */
- (iw_handler) NULL, /* SIOCSIWSPY */
+ (iw_handler) prism2_ioctl_siwspy, /* SIOCSIWSPY */
(iw_handler) prism2_ioctl_giwspy, /* SIOCGIWSPY */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) NULL, /* -- hole -- */
More information about the Hostap
mailing list