diff options
author | Pavel Roskin <proski@gnu.org> | 2008-06-27 16:20:10 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-30 17:37:36 -0400 |
commit | 573b933f8f20ce298f6ff83d5ecc7b99ff3abb12 (patch) | |
tree | 92ae63925f73ca981f2fec9c511f2a3de2c99ccd /drivers/net/wireless | |
parent | b53a5dabc5e0a0a1882a16446fb3d22d6a16114d (diff) |
hostap: add radiotap support in monitor mode
Provide MAC time, rate, channel, signal and noise.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_80211_rx.c | 21 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ioctl.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_wlan.h | 14 |
3 files changed, 38 insertions, 2 deletions
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index 4fd73809602e..d669e5956ce7 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c | |||
@@ -78,6 +78,9 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, | |||
78 | prism_header = 2; | 78 | prism_header = 2; |
79 | phdrlen = sizeof(struct linux_wlan_ng_cap_hdr); | 79 | phdrlen = sizeof(struct linux_wlan_ng_cap_hdr); |
80 | } | 80 | } |
81 | } else if (dev->type == ARPHRD_IEEE80211_RADIOTAP) { | ||
82 | prism_header = 3; | ||
83 | phdrlen = sizeof(struct hostap_radiotap_rx); | ||
81 | } else { | 84 | } else { |
82 | prism_header = 0; | 85 | prism_header = 0; |
83 | phdrlen = 0; | 86 | phdrlen = 0; |
@@ -165,6 +168,24 @@ hdr->f.status = s; hdr->f.len = l; hdr->f.data = d | |||
165 | hdr->ssi_noise = htonl(rx_stats->noise); | 168 | hdr->ssi_noise = htonl(rx_stats->noise); |
166 | hdr->preamble = htonl(0); /* unknown */ | 169 | hdr->preamble = htonl(0); /* unknown */ |
167 | hdr->encoding = htonl(1); /* cck */ | 170 | hdr->encoding = htonl(1); /* cck */ |
171 | } else if (prism_header == 3) { | ||
172 | struct hostap_radiotap_rx *hdr; | ||
173 | hdr = (struct hostap_radiotap_rx *)skb_push(skb, phdrlen); | ||
174 | memset(hdr, 0, phdrlen); | ||
175 | hdr->hdr.it_len = cpu_to_le16(phdrlen); | ||
176 | hdr->hdr.it_present = | ||
177 | cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | | ||
178 | (1 << IEEE80211_RADIOTAP_CHANNEL) | | ||
179 | (1 << IEEE80211_RADIOTAP_RATE) | | ||
180 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | | ||
181 | (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)); | ||
182 | hdr->tsft = cpu_to_le64(rx_stats->mac_time); | ||
183 | hdr->chan_freq = cpu_to_le16(freq_list[local->channel - 1]); | ||
184 | hdr->chan_flags = cpu_to_le16(IEEE80211_CHAN_CCK | | ||
185 | IEEE80211_CHAN_2GHZ); | ||
186 | hdr->rate = rx_stats->rate / 5; | ||
187 | hdr->dbm_antsignal = rx_stats->signal; | ||
188 | hdr->dbm_antnoise = rx_stats->noise; | ||
168 | } | 189 | } |
169 | 190 | ||
170 | ret = skb->len - phdrlen; | 191 | ret = skb->len - phdrlen; |
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index ed52d98317cd..3f8b1d7036e5 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
@@ -897,6 +897,8 @@ static void hostap_monitor_set_type(local_info_t *local) | |||
897 | if (local->monitor_type == PRISM2_MONITOR_PRISM || | 897 | if (local->monitor_type == PRISM2_MONITOR_PRISM || |
898 | local->monitor_type == PRISM2_MONITOR_CAPHDR) { | 898 | local->monitor_type == PRISM2_MONITOR_CAPHDR) { |
899 | dev->type = ARPHRD_IEEE80211_PRISM; | 899 | dev->type = ARPHRD_IEEE80211_PRISM; |
900 | } else if (local->monitor_type == PRISM2_MONITOR_RADIOTAP) { | ||
901 | dev->type = ARPHRD_IEEE80211_RADIOTAP; | ||
900 | } else { | 902 | } else { |
901 | dev->type = ARPHRD_IEEE80211; | 903 | dev->type = ARPHRD_IEEE80211; |
902 | } | 904 | } |
@@ -2520,7 +2522,8 @@ static int prism2_ioctl_priv_prism2_param(struct net_device *dev, | |||
2520 | case PRISM2_PARAM_MONITOR_TYPE: | 2522 | case PRISM2_PARAM_MONITOR_TYPE: |
2521 | if (value != PRISM2_MONITOR_80211 && | 2523 | if (value != PRISM2_MONITOR_80211 && |
2522 | value != PRISM2_MONITOR_CAPHDR && | 2524 | value != PRISM2_MONITOR_CAPHDR && |
2523 | value != PRISM2_MONITOR_PRISM) { | 2525 | value != PRISM2_MONITOR_PRISM && |
2526 | value != PRISM2_MONITOR_RADIOTAP) { | ||
2524 | ret = -EINVAL; | 2527 | ret = -EINVAL; |
2525 | break; | 2528 | break; |
2526 | } | 2529 | } |
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h index 15445bce2ac7..ffdf4876121b 100644 --- a/drivers/net/wireless/hostap/hostap_wlan.h +++ b/drivers/net/wireless/hostap/hostap_wlan.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/netdevice.h> | 5 | #include <linux/netdevice.h> |
6 | #include <linux/mutex.h> | 6 | #include <linux/mutex.h> |
7 | #include <net/iw_handler.h> | 7 | #include <net/iw_handler.h> |
8 | #include <net/ieee80211_radiotap.h> | ||
8 | 9 | ||
9 | #include "hostap_config.h" | 10 | #include "hostap_config.h" |
10 | #include "hostap_common.h" | 11 | #include "hostap_common.h" |
@@ -55,6 +56,17 @@ struct linux_wlan_ng_cap_hdr { | |||
55 | __be32 encoding; | 56 | __be32 encoding; |
56 | } __attribute__ ((packed)); | 57 | } __attribute__ ((packed)); |
57 | 58 | ||
59 | struct hostap_radiotap_rx { | ||
60 | struct ieee80211_radiotap_header hdr; | ||
61 | __le64 tsft; | ||
62 | u8 rate; | ||
63 | u8 padding; | ||
64 | __le16 chan_freq; | ||
65 | __le16 chan_flags; | ||
66 | s8 dbm_antsignal; | ||
67 | s8 dbm_antnoise; | ||
68 | } __attribute__ ((packed)); | ||
69 | |||
58 | #define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */ | 70 | #define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */ |
59 | #define LWNG_CAPHDR_VERSION 0x80211001 | 71 | #define LWNG_CAPHDR_VERSION 0x80211001 |
60 | 72 | ||
@@ -734,7 +746,7 @@ struct local_info { | |||
734 | unsigned long scan_timestamp; /* Time started to scan */ | 746 | unsigned long scan_timestamp; /* Time started to scan */ |
735 | enum { | 747 | enum { |
736 | PRISM2_MONITOR_80211 = 0, PRISM2_MONITOR_PRISM = 1, | 748 | PRISM2_MONITOR_80211 = 0, PRISM2_MONITOR_PRISM = 1, |
737 | PRISM2_MONITOR_CAPHDR = 2 | 749 | PRISM2_MONITOR_CAPHDR = 2, PRISM2_MONITOR_RADIOTAP = 3 |
738 | } monitor_type; | 750 | } monitor_type; |
739 | int monitor_allow_fcserr; | 751 | int monitor_allow_fcserr; |
740 | 752 | ||