Rewrite AID calculation in handle_pspoll() to avoid truncating bits.
Make hostap_80211_header_parse() static, don't export it. Avoid
shadowing variables.
Signed-off-by: Pavel Roskin <[email protected]>
---
drivers/net/wireless/hostap/hostap_ap.c | 2 +-
drivers/net/wireless/hostap/hostap_cs.c | 8 ++++----
drivers/net/wireless/hostap/hostap_hw.c | 10 +++++-----
drivers/net/wireless/hostap/hostap_main.c | 5 ++---
4 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 0acd958..ab981af 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -1930,7 +1930,7 @@ static void handle_pspoll(local_info_t *local,
PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n");
return;
}
- aid &= ~BIT(15) & ~BIT(14);
+ aid &= ~(BIT(15) | BIT(14));
if (aid == 0 || aid > MAX_AID_TABLE_SIZE) {
PDEBUG(DEBUG_PS, " invalid aid=%d\n", aid);
return;
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index ed4317a..80039a0 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -533,10 +533,10 @@ static void prism2_detach(struct pcmcia_device *link)
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
#define CFG_CHECK2(fn, retf) \
-do { int ret = (retf); \
-if (ret != 0) { \
- PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \
- cs_error(link, fn, ret); \
+do { int _ret = (retf); \
+if (_ret != 0) { \
+ PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", _ret); \
+ cs_error(link, fn, _ret); \
goto next_entry; \
} \
} while (0)
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index cdf90c4..936f52e 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -2835,7 +2835,7 @@ static void hostap_passive_scan(unsigned long data)
{
local_info_t *local = (local_info_t *) data;
struct net_device *dev = local->dev;
- u16 channel;
+ u16 chan;
if (local->passive_scan_interval <= 0)
return;
@@ -2872,11 +2872,11 @@ static void hostap_passive_scan(unsigned long data)
printk(KERN_DEBUG "%s: passive scan channel %d\n",
dev->name, local->passive_scan_channel);
- channel = local->passive_scan_channel;
+ chan = local->passive_scan_channel;
local->passive_scan_state = PASSIVE_SCAN_WAIT;
local->passive_scan_timer.expires = jiffies + HZ / 10;
} else {
- channel = local->channel;
+ chan = local->channel;
local->passive_scan_state = PASSIVE_SCAN_LISTEN;
local->passive_scan_timer.expires = jiffies +
local->passive_scan_interval * HZ;
@@ -2884,9 +2884,9 @@ static void hostap_passive_scan(unsigned long data)
if (hfa384x_cmd_callback(dev, HFA384X_CMDCODE_TEST |
(HFA384X_TEST_CHANGE_CHANNEL << 8),
- channel, NULL, 0))
+ chan, NULL, 0))
printk(KERN_ERR "%s: passive scan channel set %d "
- "failed\n", dev->name, channel);
+ "failed\n", dev->name, chan);
add_timer(&local->passive_scan_timer);
}
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 20d387f..c8f41da 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -594,7 +594,8 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
}
-int hostap_80211_header_parse(const struct sk_buff *skb, unsigned char *haddr)
+static int hostap_80211_header_parse(const struct sk_buff *skb,
+ unsigned char *haddr)
{
struct hostap_interface *iface = netdev_priv(skb->dev);
local_info_t *local = iface->local;
@@ -851,7 +852,6 @@ const struct header_ops hostap_80211_ops = {
.rebuild = eth_rebuild_header,
.cache = eth_header_cache,
.cache_update = eth_header_cache_update,
-
.parse = hostap_80211_header_parse,
};
EXPORT_SYMBOL(hostap_80211_ops);
@@ -1144,7 +1144,6 @@ EXPORT_SYMBOL(hostap_set_roaming);
EXPORT_SYMBOL(hostap_set_auth_algs);
EXPORT_SYMBOL(hostap_dump_rx_header);
EXPORT_SYMBOL(hostap_dump_tx_header);
-EXPORT_SYMBOL(hostap_80211_header_parse);
EXPORT_SYMBOL(hostap_80211_get_hdrlen);
EXPORT_SYMBOL(hostap_get_stats);
EXPORT_SYMBOL(hostap_setup_dev);
This is an ioctl obsoleted by the monitor mode years ago. Using it
would trigger a deprecation warning. As the wireless drivers
standardize on the radiotap standard, the "monitor" ioctl cannot be
preserved to work as obsolete software expects.
Signed-off-by: Pavel Roskin <[email protected]>
---
drivers/net/wireless/hostap/hostap_common.h | 2 +
drivers/net/wireless/hostap/hostap_ioctl.c | 53 ---------------------------
2 files changed, 1 insertions(+), 54 deletions(-)
diff --git a/drivers/net/wireless/hostap/hostap_common.h b/drivers/net/wireless/hostap/hostap_common.h
index b470c74..2f92ecd 100644
--- a/drivers/net/wireless/hostap/hostap_common.h
+++ b/drivers/net/wireless/hostap/hostap_common.h
@@ -239,7 +239,7 @@ struct hfa384x_comms_quality {
#define PRISM2_IOCTL_GET_PRISM2_PARAM (SIOCIWFIRSTPRIV + 1)
#define PRISM2_IOCTL_WRITEMIF (SIOCIWFIRSTPRIV + 2)
#define PRISM2_IOCTL_READMIF (SIOCIWFIRSTPRIV + 3)
-#define PRISM2_IOCTL_MONITOR (SIOCIWFIRSTPRIV + 4)
+/* #define PRISM2_IOCTL_MONITOR (SIOCIWFIRSTPRIV + 4) */
#define PRISM2_IOCTL_RESET (SIOCIWFIRSTPRIV + 6)
#define PRISM2_IOCTL_INQUIRE (SIOCIWFIRSTPRIV + 8)
#define PRISM2_IOCTL_WDS_ADD (SIOCIWFIRSTPRIV + 10)
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 0ca0bfe..7dc8392 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -2124,8 +2124,6 @@ static int prism2_ioctl_giwscan(struct net_device *dev,
static const struct iw_priv_args prism2_priv[] = {
- { PRISM2_IOCTL_MONITOR,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "monitor" },
{ PRISM2_IOCTL_READMIF,
IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1,
IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "readmif" },
@@ -2907,52 +2905,6 @@ static int prism2_ioctl_priv_writemif(struct net_device *dev,
}
-static int prism2_ioctl_priv_monitor(struct net_device *dev, int *i)
-{
- struct hostap_interface *iface;
- local_info_t *local;
- int ret = 0;
- u32 mode;
-
- iface = netdev_priv(dev);
- local = iface->local;
-
- printk(KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor "
- "- update software to use iwconfig mode monitor\n",
- dev->name, task_pid_nr(current), current->comm);
-
- /* Backward compatibility code - this can be removed at some point */
-
- if (*i == 0) {
- /* Disable monitor mode - old mode was not saved, so go to
- * Master mode */
- mode = IW_MODE_MASTER;
- ret = prism2_ioctl_siwmode(dev, NULL, &mode, NULL);
- } else if (*i == 1) {
- /* netlink socket mode is not supported anymore since it did
- * not separate different devices from each other and was not
- * best method for delivering large amount of packets to
- * user space */
- ret = -EOPNOTSUPP;
- } else if (*i == 2 || *i == 3) {
- switch (*i) {
- case 2:
- local->monitor_type = PRISM2_MONITOR_80211;
- break;
- case 3:
- local->monitor_type = PRISM2_MONITOR_PRISM;
- break;
- }
- mode = IW_MODE_MONITOR;
- ret = prism2_ioctl_siwmode(dev, NULL, &mode, NULL);
- hostap_monitor_mode_enable(local);
- } else
- ret = -EINVAL;
-
- return ret;
-}
-
-
static int prism2_ioctl_priv_reset(struct net_device *dev, int *i)
{
struct hostap_interface *iface;
@@ -4004,11 +3956,6 @@ int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
else ret = prism2_ioctl_priv_inquire(dev, (int *) wrq->u.name);
break;
- case PRISM2_IOCTL_MONITOR:
- if (!capable(CAP_NET_ADMIN)) ret = -EPERM;
- else ret = prism2_ioctl_priv_monitor(dev, (int *) wrq->u.name);
- break;
-
case PRISM2_IOCTL_RESET:
if (!capable(CAP_NET_ADMIN)) ret = -EPERM;
else ret = prism2_ioctl_priv_reset(dev, (int *) wrq->u.name);
DEBUG_EXTRA is reported to the kernel log by default, but DEBUG_EXTRA2
is not. Unrelated WDS frames pollute the log unnecessarily.
Signed-off-by: Pavel Roskin <[email protected]>
---
drivers/net/wireless/hostap/hostap_80211_rx.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 4fd7380..47884c3 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -551,7 +551,7 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr,
hdr->addr1[2] != 0xff || hdr->addr1[3] != 0xff ||
hdr->addr1[4] != 0xff || hdr->addr1[5] != 0xff)) {
/* RA (or BSSID) is not ours - drop */
- PDEBUG(DEBUG_EXTRA, "%s: received WDS frame with "
+ PDEBUG(DEBUG_EXTRA2, "%s: received WDS frame with "
"not own or broadcast %s=%s\n",
local->dev->name,
fc & IEEE80211_FCTL_FROMDS ? "RA" : "BSSID",
On Thu, May 22, 2008 at 09:54:48PM -0400, Pavel Roskin wrote:
> 802.11 is meant in all cases. The section numbers match the actual
> 802.11 standard.
Actually, 8802.11 was referring to ISO/IEC 8802-11, not IEEE 802.11..
Anyway, I do not have anything against changing this to refer to the
IEEE standard instead of ISO version of it.
--
Jouni Malinen PGP id EFC895FA
On Thu, May 22, 2008 at 09:54:54PM -0400, Pavel Roskin wrote:
> This is an ioctl obsoleted by the monitor mode years ago. Using it
> would trigger a deprecation warning. As the wireless drivers
> standardize on the radiotap standard, the "monitor" ioctl cannot be
> preserved to work as obsolete software expects.
I don't follow the login here... Why "cannot be preserved"? I might go
with "we do not want to preserve this", but I do not see any technical
reason that would prevent us from supporting existing user space
interface that has been used in the past and may still be in use. Since
this may break existing user space programs, I do not think this should
go in. Obviously, same goes for removal of the actual use of this
parameter and support for different header formats in patch 5/5. Adding
support for radiotap format is of course reasonable, but I would be more
careful with removing existing functionality which may still be in use.
--
Jouni Malinen PGP id EFC895FA
802.11 is meant in all cases. The section numbers match the actual
802.11 standard.
Signed-off-by: Pavel Roskin <[email protected]>
---
drivers/net/wireless/hostap/hostap_ap.c | 8 ++++----
drivers/net/wireless/hostap/hostap_ap.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index ab981af..19ed075 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -9,11 +9,11 @@
*
* AP: FIX:
* - if unicast Class 2 (assoc,reassoc,disassoc) frame received from
- * unauthenticated STA, send deauth. frame (8802.11: 5.5)
+ * unauthenticated STA, send deauth. frame (802.11: 5.5)
* - if unicast Class 3 (data with to/from DS,deauth,pspoll) frame received
- * from authenticated, but unassoc STA, send disassoc frame (8802.11: 5.5)
+ * from authenticated, but unassoc STA, send disassoc frame (802.11: 5.5)
* - if unicast Class 3 received from unauthenticated STA, send deauth. frame
- * (8802.11: 5.5)
+ * (802.11: 5.5)
*/
#include <linux/proc_fs.h>
@@ -1956,7 +1956,7 @@ static void handle_pspoll(local_info_t *local,
/* FIX: todo:
* - add timeout for buffering (clear aid in TIM vector if buffer timed
* out (expiry time must be longer than ListenInterval for
- * the corresponding STA; "8802-11: 11.2.1.9 AP aging function"
+ * the corresponding STA; "802.11: 11.2.1.9 AP aging function"
* - what to do, if buffered, pspolled, and sent frame is not ACKed by
* sta; store buffer for later use and leave TIM aid bit set? use
* TX event to check whether frame was ACKed?
diff --git a/drivers/net/wireless/hostap/hostap_ap.h b/drivers/net/wireless/hostap/hostap_ap.h
index 2fa2452..0d2cbf4 100644
--- a/drivers/net/wireless/hostap/hostap_ap.h
+++ b/drivers/net/wireless/hostap/hostap_ap.h
@@ -103,7 +103,7 @@ struct sta_info {
#define MAX_STA_COUNT 1024
/* Maximum number of AIDs to use for STAs; must be 2007 or lower
- * (8802.11 limitation) */
+ * (802.11 limitation) */
#define MAX_AID_TABLE_SIZE 128
#define STA_HASH_SIZE 256
On Wed, May 28, 2008 at 09:30:29AM -0400, Pavel Roskin wrote:
> The old ioctl was supporting bare 802.11, prism and AVS headers. I want
> to replace all three of them with radiotap. I had to leave bare 802.11
> support for the AP interface (wlan0ap) for hostapd compatibility, but
> the main interface should only support radiotap.
>
> Suppose we want to support the old ioctl. All three types of headers
> that could be requested are going away now. Can we expect the software
> that doesn't know of "iwconfig mode monitor" to know radiotap headers?
> I don't think so.
Where is this "are going away now" statement coming from? I see no
technical reason for this apart from simplifying the implementation.
> > this may break existing user space programs, I do not think this should
> > go in. Obviously, same goes for removal of the actual use of this
> > parameter and support for different header formats in patch 5/5. Adding
> > support for radiotap format is of course reasonable, but I would be more
> > careful with removing existing functionality which may still be in use.
>
> OK, if that's what you prefer, I can do it.
I'm not strongly against replacing the old formats with radiotap, but I
just do not follow the logic given as reasons for doing this as a simple
replacement instead of doing it in steps (add radiotap now; remove
deprecated formats later).
I do not know how common user space programs that do not support
radiotap, but would support one (or more) of the old formats (and
similarly for the private ioctl vs. generic mode ioctl). If these kinds
of cases are very rare, I could see better justification for simple
replacement. If such programs are still in active use in systems that
could be expected to upgrade to the new kernel version, there is much
more justification to keep the old formats available and just make it
clearer that they are deprecated and will be removed at a certain point
in the future.
--
Jouni Malinen PGP id EFC895FA
On Mon, 2008-05-26 at 12:44 +0300, Jouni Malinen wrote:
> On Thu, May 22, 2008 at 09:54:54PM -0400, Pavel Roskin wrote:
> > This is an ioctl obsoleted by the monitor mode years ago. Using it
> > would trigger a deprecation warning. As the wireless drivers
> > standardize on the radiotap standard, the "monitor" ioctl cannot be
> > preserved to work as obsolete software expects.
>
> I don't follow the login here... Why "cannot be preserved"? I might go
> with "we do not want to preserve this", but I do not see any technical
> reason that would prevent us from supporting existing user space
> interface that has been used in the past and may still be in use.
The old ioctl was supporting bare 802.11, prism and AVS headers. I want
to replace all three of them with radiotap. I had to leave bare 802.11
support for the AP interface (wlan0ap) for hostapd compatibility, but
the main interface should only support radiotap.
Suppose we want to support the old ioctl. All three types of headers
that could be requested are going away now. Can we expect the software
that doesn't know of "iwconfig mode monitor" to know radiotap headers?
I don't think so.
> Since
> this may break existing user space programs, I do not think this should
> go in. Obviously, same goes for removal of the actual use of this
> parameter and support for different header formats in patch 5/5. Adding
> support for radiotap format is of course reasonable, but I would be more
> careful with removing existing functionality which may still be in use.
OK, if that's what you prefer, I can do it.
--
Regards,
Pavel Roskin
Provide MAC time, rate, channel, signal and noise. Remove
"monitor_type" and "getmonitor_type" ioctl. Never add bogus CRC at the
end, as radiotap aware software would never need it.
Keep support for "no header" for the master and AP devices. Simplify
hostap_80211_header_parse(), as it's never used on interfaces in monitor
mode.
Signed-off-by: Pavel Roskin <[email protected]>
---
drivers/net/wireless/hostap/hostap_80211_rx.c | 126 ++++++++-----------------
drivers/net/wireless/hostap/hostap_common.h | 2
drivers/net/wireless/hostap/hostap_ioctl.c | 27 -----
drivers/net/wireless/hostap/hostap_main.c | 21 +---
drivers/net/wireless/hostap/hostap_wlan.h | 44 ++-------
5 files changed, 53 insertions(+), 167 deletions(-)
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 47884c3..832579f 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -54,35 +54,22 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
}
-/* Send RX frame to netif with 802.11 (and possible prism) header.
+/* Send RX frame to netif with 802.11 and possibly radiotap header.
* Called from hardware or software IRQ context. */
int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
struct hostap_80211_rx_status *rx_stats, int type)
{
struct hostap_interface *iface;
local_info_t *local;
- int hdrlen, phdrlen, head_need, tail_need;
+ int hdrlen, rt_hdrlen;
u16 fc;
- int prism_header, ret;
+ int ret;
struct ieee80211_hdr_4addr *hdr;
iface = netdev_priv(dev);
local = iface->local;
dev->last_rx = jiffies;
- if (dev->type == ARPHRD_IEEE80211_PRISM) {
- if (local->monitor_type == PRISM2_MONITOR_PRISM) {
- prism_header = 1;
- phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
- } else { /* local->monitor_type == PRISM2_MONITOR_CAPHDR */
- prism_header = 2;
- phdrlen = sizeof(struct linux_wlan_ng_cap_hdr);
- }
- } else {
- prism_header = 0;
- phdrlen = 0;
- }
-
hdr = (struct ieee80211_hdr_4addr *) skb->data;
fc = le16_to_cpu(hdr->frame_ctl);
@@ -95,84 +82,47 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
hdrlen = hostap_80211_get_hdrlen(fc);
- /* check if there is enough room for extra data; if not, expand skb
- * buffer to be large enough for the changes */
- head_need = phdrlen;
- tail_need = 0;
-#ifdef PRISM2_ADD_BOGUS_CRC
- tail_need += 4;
-#endif /* PRISM2_ADD_BOGUS_CRC */
-
- head_need -= skb_headroom(skb);
- tail_need -= skb_tailroom(skb);
-
- if (head_need > 0 || tail_need > 0) {
- if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
- tail_need > 0 ? tail_need : 0,
- GFP_ATOMIC)) {
- printk(KERN_DEBUG "%s: prism2_rx_80211 failed to "
- "reallocate skb buffer\n", dev->name);
- dev_kfree_skb_any(skb);
- return 0;
+ if (dev->type == ARPHRD_IEEE80211_RADIOTAP) {
+ int head_need;
+ struct hostap_radiotap_rx *rt_hdr;
+
+ /* if needed, expand skb buffer to accomodate radiotap header */
+ rt_hdrlen = sizeof(struct hostap_radiotap_rx);
+ head_need = rt_hdrlen - skb_headroom(skb);
+
+ if (head_need > 0) {
+ if (pskb_expand_head(skb, head_need, 0, GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: prism2_rx_80211 failed "
+ "to reallocate skb buffer\n", dev->name);
+ dev_kfree_skb_any(skb);
+ return 0;
+ }
}
- }
- /* We now have an skb with enough head and tail room, so just insert
- * the extra data */
-
-#ifdef PRISM2_ADD_BOGUS_CRC
- memset(skb_put(skb, 4), 0xff, 4); /* Prism2 strips CRC */
-#endif /* PRISM2_ADD_BOGUS_CRC */
-
- if (prism_header == 1) {
- struct linux_wlan_ng_prism_hdr *hdr;
- hdr = (struct linux_wlan_ng_prism_hdr *)
- skb_push(skb, phdrlen);
- memset(hdr, 0, phdrlen);
- hdr->msgcode = LWNG_CAP_DID_BASE;
- hdr->msglen = sizeof(*hdr);
- memcpy(hdr->devname, dev->name, sizeof(hdr->devname));
-#define LWNG_SETVAL(f,i,s,l,d) \
-hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
-hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
- LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
- LWNG_SETVAL(mactime, 2, 0, 4, rx_stats->mac_time);
- LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
- LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
- LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
- LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
- LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
- LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
- LWNG_SETVAL(istx, 9, 0, 4, 0);
- LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
-#undef LWNG_SETVAL
- } else if (prism_header == 2) {
- struct linux_wlan_ng_cap_hdr *hdr;
- hdr = (struct linux_wlan_ng_cap_hdr *)
- skb_push(skb, phdrlen);
- memset(hdr, 0, phdrlen);
- hdr->version = htonl(LWNG_CAPHDR_VERSION);
- hdr->length = htonl(phdrlen);
- hdr->mactime = __cpu_to_be64(rx_stats->mac_time);
- hdr->hosttime = __cpu_to_be64(jiffies);
- hdr->phytype = htonl(4); /* dss_dot11_b */
- hdr->channel = htonl(local->channel);
- hdr->datarate = htonl(rx_stats->rate);
- hdr->antenna = htonl(0); /* unknown */
- hdr->priority = htonl(0); /* unknown */
- hdr->ssi_type = htonl(3); /* raw */
- hdr->ssi_signal = htonl(rx_stats->signal);
- hdr->ssi_noise = htonl(rx_stats->noise);
- hdr->preamble = htonl(0); /* unknown */
- hdr->encoding = htonl(1); /* cck */
+ rt_hdr = (struct hostap_radiotap_rx *)skb_push(skb, rt_hdrlen);
+ memset(rt_hdr, 0, rt_hdrlen);
+ rt_hdr->hdr.it_len = cpu_to_le16(rt_hdrlen);
+ rt_hdr->hdr.it_present =
+ cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) |
+ (1 << IEEE80211_RADIOTAP_CHANNEL) |
+ (1 << IEEE80211_RADIOTAP_RATE) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE));
+ rt_hdr->tsft = cpu_to_le64(rx_stats->mac_time);
+ rt_hdr->chan_freq = cpu_to_le16(freq_list[local->channel - 1]);
+ rt_hdr->chan_flags = cpu_to_le16(IEEE80211_CHAN_CCK |
+ IEEE80211_CHAN_2GHZ);
+ rt_hdr->rate = rx_stats->rate / 5;
+ rt_hdr->dbm_antsignal = rx_stats->signal;
+ rt_hdr->dbm_antnoise = rx_stats->noise;
+ } else {
+ rt_hdrlen = 0;
}
- ret = skb->len - phdrlen;
+ ret = skb->len - rt_hdrlen;
skb->dev = dev;
skb_reset_mac_header(skb);
- skb_pull(skb, hdrlen);
- if (prism_header)
- skb_pull(skb, phdrlen);
+ skb_pull(skb, rt_hdrlen + hdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_802_2);
memset(skb->cb, 0, sizeof(skb->cb));
diff --git a/drivers/net/wireless/hostap/hostap_common.h b/drivers/net/wireless/hostap/hostap_common.h
index 2f92ecd..ba6725f 100644
--- a/drivers/net/wireless/hostap/hostap_common.h
+++ b/drivers/net/wireless/hostap/hostap_common.h
@@ -283,7 +283,7 @@ enum {
PRISM2_PARAM_IEEE_802_1X = 23,
PRISM2_PARAM_ANTSEL_TX = 24,
PRISM2_PARAM_ANTSEL_RX = 25,
- PRISM2_PARAM_MONITOR_TYPE = 26,
+ /* PRISM2_PARAM_MONITOR_TYPE = 26, */
PRISM2_PARAM_WDS_TYPE = 27,
PRISM2_PARAM_HOSTSCAN = 28,
PRISM2_PARAM_AP_SCAN = 29,
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 7dc8392..5386831 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -894,12 +894,7 @@ static void hostap_monitor_set_type(local_info_t *local)
if (dev == NULL)
return;
- if (local->monitor_type == PRISM2_MONITOR_PRISM ||
- local->monitor_type == PRISM2_MONITOR_CAPHDR) {
- dev->type = ARPHRD_IEEE80211_PRISM;
- } else {
- dev->type = ARPHRD_IEEE80211;
- }
+ dev->type = ARPHRD_IEEE80211_RADIOTAP;
}
@@ -2247,10 +2242,6 @@ static const struct iw_priv_args prism2_priv[] = {
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "antsel_rx" },
{ PRISM2_PARAM_ANTSEL_RX,
0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getantsel_rx" },
- { PRISM2_PARAM_MONITOR_TYPE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "monitor_type" },
- { PRISM2_PARAM_MONITOR_TYPE,
- 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getmonitor_type" },
{ PRISM2_PARAM_WDS_TYPE,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wds_type" },
{ PRISM2_PARAM_WDS_TYPE,
@@ -2511,18 +2502,6 @@ static int prism2_ioctl_priv_prism2_param(struct net_device *dev,
hostap_set_antsel(local);
break;
- case PRISM2_PARAM_MONITOR_TYPE:
- if (value != PRISM2_MONITOR_80211 &&
- value != PRISM2_MONITOR_CAPHDR &&
- value != PRISM2_MONITOR_PRISM) {
- ret = -EINVAL;
- break;
- }
- local->monitor_type = value;
- if (local->iw_mode == IW_MODE_MONITOR)
- hostap_monitor_set_type(local);
- break;
-
case PRISM2_PARAM_WDS_TYPE:
local->wds_type = value;
break;
@@ -2789,10 +2768,6 @@ static int prism2_ioctl_priv_get_prism2_param(struct net_device *dev,
*param = local->antsel_rx;
break;
- case PRISM2_PARAM_MONITOR_TYPE:
- *param = local->monitor_type;
- break;
-
case PRISM2_PARAM_WDS_TYPE:
*param = local->wds_type;
break;
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index c8f41da..5de6123 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -597,25 +597,10 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
static int hostap_80211_header_parse(const struct sk_buff *skb,
unsigned char *haddr)
{
- struct hostap_interface *iface = netdev_priv(skb->dev);
- local_info_t *local = iface->local;
-
- if (local->monitor_type == PRISM2_MONITOR_PRISM ||
- local->monitor_type == PRISM2_MONITOR_CAPHDR) {
- const unsigned char *mac = skb_mac_header(skb);
-
- if (*(u32 *)mac == LWNG_CAP_DID_BASE) {
- memcpy(haddr,
- mac + sizeof(struct linux_wlan_ng_prism_hdr) + 10,
- ETH_ALEN); /* addr2 */
- } else { /* (*(u32 *)mac == htonl(LWNG_CAPHDR_VERSION)) */
- memcpy(haddr,
- mac + sizeof(struct linux_wlan_ng_cap_hdr) + 10,
- ETH_ALEN); /* addr2 */
- }
- } else
- memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */
+ struct ieee80211_hdr_4addr *hdr =
+ (struct ieee80211_hdr_4addr *)skb_mac_header(skb);
+ memcpy(haddr, hdr->addr2, ETH_ALEN);
return ETH_ALEN;
}
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
index 15445bc..6e047cf 100644
--- a/drivers/net/wireless/hostap/hostap_wlan.h
+++ b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -5,6 +5,7 @@
#include <linux/netdevice.h>
#include <linux/mutex.h>
#include <net/iw_handler.h>
+#include <net/ieee80211_radiotap.h>
#include "hostap_config.h"
#include "hostap_common.h"
@@ -23,36 +24,15 @@
* prism2_send_mgmt() sends these with dev_queue_xmit() to prism2_tx(). */
#define ETH_P_HOSTAP ETH_P_CONTROL
-/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
- * (from linux-wlan-ng) */
-struct linux_wlan_ng_val {
- u32 did;
- u16 status, len;
- u32 data;
-} __attribute__ ((packed));
-
-struct linux_wlan_ng_prism_hdr {
- u32 msgcode, msglen;
- char devname[16];
- struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
- noise, rate, istx, frmlen;
-} __attribute__ ((packed));
-
-struct linux_wlan_ng_cap_hdr {
- __be32 version;
- __be32 length;
- __be64 mactime;
- __be64 hosttime;
- __be32 phytype;
- __be32 channel;
- __be32 datarate;
- __be32 antenna;
- __be32 priority;
- __be32 ssi_type;
- __be32 ssi_signal;
- __be32 ssi_noise;
- __be32 preamble;
- __be32 encoding;
+struct hostap_radiotap_rx {
+ struct ieee80211_radiotap_header hdr;
+ __le64 tsft;
+ u8 rate;
+ u8 padding;
+ __le16 chan_freq;
+ __le16 chan_flags;
+ s8 dbm_antsignal;
+ s8 dbm_antnoise;
} __attribute__ ((packed));
#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
@@ -732,10 +712,6 @@ struct local_info {
struct iw_statistics wstats;
unsigned long scan_timestamp; /* Time started to scan */
- enum {
- PRISM2_MONITOR_80211 = 0, PRISM2_MONITOR_PRISM = 1,
- PRISM2_MONITOR_CAPHDR = 2
- } monitor_type;
int monitor_allow_fcserr;
int hostapd; /* whether user space daemon, hostapd, is used for AP