netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jouni Malinen <jkmaline@cc.hut.fi>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@oss.sgi.com
Subject: [PATCH wireless-2.6 14/16] Host AP: Updated to use Linux wireless extensions v17
Date: Sat, 13 Nov 2004 21:23:55 -0800	[thread overview]
Message-ID: <20041114052355.GF14810@jm.kir.nu> (raw)
In-Reply-To: <20041108070156.GA1076@jm.kir.nu>

Patch from Jean Tourrilhes <jt@hpl.hp.com>:

HostAP WE-17 support:
- allow large scan requests
- export event capability
- new spy data handling

jkm: removed support for old WE versions (ifdefs)

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>


diff -Nru a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c
--- a/drivers/net/wireless/hostap/hostap.c	2004-11-13 20:56:35 -08:00
+++ b/drivers/net/wireless/hostap/hostap.c	2004-11-13 20:56:35 -08:00
@@ -890,8 +890,12 @@
 
 	/* kernel callbacks */
 	dev->get_stats = hostap_get_stats;
-	if (main_dev || (iface && iface->type == HOSTAP_INTERFACE_MAIN))
-		dev->get_wireless_stats =  hostap_get_wireless_stats;
+	if (iface) {
+		/* Currently, we point to the proper spy_data only on
+		 * the main_dev. This could be fixed. Jean II */
+		iface->wireless_data.spy_data = &iface->spy_data;
+		dev->wireless_data = &iface->wireless_data;
+	}
 	dev->wireless_handlers =
 		(struct iw_handler_def *) &hostap_iw_handler_def;
 	dev->do_ioctl = hostap_ioctl;
diff -Nru a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
--- a/drivers/net/wireless/hostap/hostap_ioctl.c	2004-11-13 20:56:35 -08:00
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c	2004-11-13 20:56:35 -08:00
@@ -13,6 +13,10 @@
 	local_info_t *local = iface->local;
 	struct iw_statistics *wstats;
 
+	/* Why are we doing that ? Jean II */
+	if (iface->type != HOSTAP_INTERFACE_MAIN)
+		return NULL;
+
 	wstats = &local->wstats;
 
 	wstats->status = 0;
@@ -989,6 +993,17 @@
 	range->min_frag = 256;
 	range->max_frag = 2346;
 
+	/* Event capability (kernel + driver) */
+	range->event_capa[0] = (IW_EVENT_CAPA_K_0 |
+				IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) |
+				IW_EVENT_CAPA_MASK(SIOCGIWAP) |
+				IW_EVENT_CAPA_MASK(SIOCGIWSCAN));
+	range->event_capa[1] = IW_EVENT_CAPA_K_1;
+	range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVTXDROP) |
+				IW_EVENT_CAPA_MASK(IWEVCUSTOM) |
+				IW_EVENT_CAPA_MASK(IWEVREGISTERED) |
+				IW_EVENT_CAPA_MASK(IWEVEXPIRED));
+
 	return 0;
 }
 
@@ -1818,13 +1833,14 @@
 
 /* Translate scan data returned from the card to a card independant
  * format that the Wireless Tools will understand - Jean II */
-static inline int prism2_translate_scan(local_info_t *local, char *buffer)
+static inline int prism2_translate_scan(local_info_t *local,
+					char *buffer, int buflen)
 {
 	struct hfa384x_scan_result *scan;
 	struct hfa384x_hostscan_result *hscan;
 	int entries, entry, hostscan;
 	char *current_ev = buffer;
-	char *end_buf = buffer + IW_SCAN_MAX_DATA;
+	char *end_buf = buffer + buflen;
 	u8 *bssid;
 	struct list_head *ptr;
 
@@ -1858,6 +1874,12 @@
 				local, scan, hscan, hostscan, NULL, bssid,
 				current_ev, end_buf);
 		}
+		/* Check if there is space for one more entry */
+		if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) {
+			/* Ask user space to try again with a bigger buffer */
+			spin_unlock_bh(&local->lock);
+			return -E2BIG;
+		}
 	}
 
 	spin_unlock_bh(&local->lock);
@@ -1894,7 +1916,7 @@
 	}
 	local->scan_timestamp = 0;
 
-	res = prism2_translate_scan(local, extra);
+	res = prism2_translate_scan(local, extra, data->length);
 
 	if (res >= 0) {
 		data->length = res;
@@ -3372,7 +3394,7 @@
 	.standard	= (iw_handler *) prism2_handler,
 	.private	= (iw_handler *) prism2_private_handler,
 	.private_args	= (struct iw_priv_args *) prism2_priv,
-	.spy_offset	= offsetof(struct hostap_interface, spy_data),
+	.get_wireless_stats = hostap_get_wireless_stats,
 };
 
 
diff -Nru a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
--- a/drivers/net/wireless/hostap/hostap_wlan.h	2004-11-13 20:56:35 -08:00
+++ b/drivers/net/wireless/hostap/hostap_wlan.h	2004-11-13 20:56:35 -08:00
@@ -924,12 +924,8 @@
 	struct net_device *dev; /* pointer to this device */
 	struct local_info *local; /* pointer to shared private data */
 	struct net_device_stats stats;
-	/* Note: this data area must be at a fixed offset from dev->priv.
-	 * Unfortunately, this model does not fit the current Host AP netdev
-	 * data structure because this should really be in local_into_t that is
-	 * shared by all virtual interfaces. Currently, only the main data
-	 * device (wlan#) is used for iwspy entries. */
 	struct iw_spy_data spy_data; /* iwspy support */
+	struct iw_public_data wireless_data;
 
 	enum {
 		HOSTAP_INTERFACE_MASTER,


-- 
Jouni Malinen                                            PGP id EFC895FA

  parent reply	other threads:[~2004-11-14  5:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-08  7:01 [PATCH wireless-2.6 0/12] Host AP update Jouni Malinen
2004-11-08  7:10 ` [PATCH wireless-2.6 1/12] Host AP: Disable EAPOL TX/RX debug messages Jouni Malinen
2004-11-09  7:40   ` Jeff Garzik
2004-11-08  7:11 ` [PATCH wireless-2.6 2/12] Host AP: Fix interface packet counters Jouni Malinen
2004-11-08  7:12 ` [PATCH wireless-2.6 3/12] Host AP: Ignore (Re)AssocResp messages silently Jouni Malinen
2004-11-08  7:12 ` [PATCH wireless-2.6 4/12] Host AP: Remove ioctl debug messages Jouni Malinen
2004-11-08  7:13 ` [PATCH wireless-2.6 5/12] Host AP: Fix hw address changing for wifi# interface Jouni Malinen
2004-11-08  7:13 ` [PATCH wireless-2.6 6/12] Host AP: Prevent STAs from associating using AP address Jouni Malinen
2004-11-08  7:14 ` [PATCH wireless-2.6 7/12] Host AP: Fix compilation with PRISM2_NO_STATION_MODES defined Jouni Malinen
2004-11-08  7:14 ` [PATCH wireless-2.6 8/12] Host AP: Do not bridge packets to unauthorized ports Jouni Malinen
2004-11-08  7:15 ` [PATCH wireless-2.6 9/12] Host AP: Fix card enabling after firmware download Jouni Malinen
2004-11-08  7:16 ` [PATCH wireless-2.6 10/12] Host AP: Use void * instead of unsigned long with {read,write}{b,w} Jouni Malinen
2004-11-09  7:29   ` Jeff Garzik
2004-11-14  5:18     ` [PATCH wireless-2.6 10/16] Host AP: Use void __iomem * " Jouni Malinen
2004-11-14 23:49       ` Jeff Garzik
2004-11-08  7:17 ` [PATCH wireless-2.6 11/12] Host AP: Fix PRISM2_IO_DEBUG Jouni Malinen
2004-11-09  7:29   ` Jeff Garzik
2004-11-14  5:20     ` [PATCH wireless-2.6 11/16] " Jouni Malinen
2004-11-08  7:17 ` [PATCH wireless-2.6 12/12] Host AP: Fix netif_carrier_off() in non-client modes Jouni Malinen
2004-11-09  8:04 ` [PATCH wireless-2.6 0/12] Host AP update Jeff Garzik
2004-11-09  9:09   ` Michael Renzmann
2004-11-09 15:26     ` Jeff Garzik
2004-11-09 21:32       ` Vladimir Kondratiev
2004-11-14  5:15   ` Jouni Malinen
2004-11-14  5:21 ` [PATCH wireless-2.6 12/16] Host AP: Fix netif_carrier_off() in non-client modes Jouni Malinen
2004-11-14  5:22 ` [PATCH wireless-2.6 13/16] Host AP: pci_register_driver() return value changes Jouni Malinen
2004-11-14  5:23 ` Jouni Malinen [this message]
2004-11-14  5:24 ` [PATCH wireless-2.6 15/16] Host AP: Replaced direct dev->priv references with netdev_priv(dev) Jouni Malinen
2004-11-14  5:25 ` [PATCH wireless-2.6 16/16] Host AP: Replaced MODULE_PARM with module_param* Jouni Malinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041114052355.GF14810@jm.kir.nu \
    --to=jkmaline@cc.hut.fi \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).