dect
/
linux-2.6
Archived
13
0
Fork 0

[PATCH] ieee80211 Added wireless spy support

Added wireless spy support to Rx code path.

Signed-off-by: James Ketrenos <jketreno@linux.intel.com>

NOTE:  Looks like scripts/Lindent generated output different
than the Lindented version already in-kernel, hence all the
whitespace deltas...  *sigh*
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
This commit is contained in:
James Ketrenos 2005-09-13 17:35:21 -05:00 committed by Jeff Garzik
parent b1b508e1b1
commit 74079fdce4
7 changed files with 134 additions and 144 deletions

View File

@ -33,7 +33,6 @@
represents the 2304 bytes of real data, plus a possible 8 bytes of represents the 2304 bytes of real data, plus a possible 8 bytes of
WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
#define IEEE80211_HLEN 30 #define IEEE80211_HLEN 30
#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
@ -117,7 +116,6 @@ struct ieee80211_hdr_3addr {
#define IEEE80211_SCTL_FRAG 0x000F #define IEEE80211_SCTL_FRAG 0x000F
#define IEEE80211_SCTL_SEQ 0xFFF0 #define IEEE80211_SCTL_SEQ 0xFFF0
/* debug macros */ /* debug macros */
#ifdef CONFIG_IEEE80211_DEBUG #ifdef CONFIG_IEEE80211_DEBUG
@ -130,7 +128,6 @@ do { if (ieee80211_debug_level & (level)) \
#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
#endif /* CONFIG_IEEE80211_DEBUG */ #endif /* CONFIG_IEEE80211_DEBUG */
/* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
@ -140,7 +137,6 @@ do { if (ieee80211_debug_level & (level)) \
* messages. It should never be used for passing essid to user space. */ * messages. It should never be used for passing essid to user space. */
const char *escape_essid(const char *essid, u8 essid_len); const char *escape_essid(const char *essid, u8 essid_len);
/* /*
* To use the debug system: * To use the debug system:
* *
@ -312,14 +308,12 @@ enum ieee80211_reasoncode {
WLAN_REASON_CIPHER_SUITE_REJECTED = 24, WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
}; };
#define IEEE80211_STATMASK_SIGNAL (1<<0) #define IEEE80211_STATMASK_SIGNAL (1<<0)
#define IEEE80211_STATMASK_RSSI (1<<1) #define IEEE80211_STATMASK_RSSI (1<<1)
#define IEEE80211_STATMASK_NOISE (1<<2) #define IEEE80211_STATMASK_NOISE (1<<2)
#define IEEE80211_STATMASK_RATE (1<<3) #define IEEE80211_STATMASK_RATE (1<<3)
#define IEEE80211_STATMASK_WEMASK 0x7 #define IEEE80211_STATMASK_WEMASK 0x7
#define IEEE80211_CCK_MODULATION (1<<0) #define IEEE80211_CCK_MODULATION (1<<0)
#define IEEE80211_OFDM_MODULATION (1<<1) #define IEEE80211_OFDM_MODULATION (1<<1)
@ -377,9 +371,6 @@ enum ieee80211_reasoncode {
#define IEEE80211_NUM_CCK_RATES 4 #define IEEE80211_NUM_CCK_RATES 4
#define IEEE80211_OFDM_SHIFT_MASK_A 4 #define IEEE80211_OFDM_SHIFT_MASK_A 4
/* NOTE: This data is for statistical purposes; not all hardware provides this /* NOTE: This data is for statistical purposes; not all hardware provides this
* information for frames received. Not setting these will not cause * information for frames received. Not setting these will not cause
* any adverse affects. */ * any adverse affects. */
@ -460,17 +451,13 @@ struct ieee80211_device;
struct ieee80211_security { struct ieee80211_security {
u16 active_key:2, u16 active_key:2,
enabled:1, enabled:1, auth_mode:2, auth_algo:4, unicast_uses_group:1;
auth_mode:2,
auth_algo:4,
unicast_uses_group:1;
u8 key_sizes[WEP_KEYS]; u8 key_sizes[WEP_KEYS];
u8 keys[WEP_KEYS][WEP_KEY_LEN]; u8 keys[WEP_KEYS][WEP_KEY_LEN];
u8 level; u8 level;
u16 flags; u16 flags;
} __attribute__ ((packed)); } __attribute__ ((packed));
/* /*
802.11 data frame from AP 802.11 data frame from AP
@ -554,7 +541,6 @@ struct ieee80211_authentication {
struct ieee80211_info_element info_element; struct ieee80211_info_element info_element;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ieee80211_probe_response { struct ieee80211_probe_response {
struct ieee80211_hdr_3addr header; struct ieee80211_hdr_3addr header;
u32 time_stamp[2]; u32 time_stamp[2];
@ -578,7 +564,6 @@ struct ieee80211_assoc_response_frame {
struct ieee80211_info_element info_element; /* supported rates */ struct ieee80211_info_element info_element; /* supported rates */
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ieee80211_txb { struct ieee80211_txb {
u8 nr_frags; u8 nr_frags;
u8 encrypted; u8 encrypted;
@ -588,7 +573,6 @@ struct ieee80211_txb {
struct sk_buff *fragments[0]; struct sk_buff *fragments[0];
}; };
/* SWEEP TABLE ENTRIES NUMBER */ /* SWEEP TABLE ENTRIES NUMBER */
#define MAX_SWEEP_TAB_ENTRIES 42 #define MAX_SWEEP_TAB_ENTRIES 42
#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
@ -651,7 +635,6 @@ enum ieee80211_state {
#define DEFAULT_MAX_SCAN_AGE (15 * HZ) #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
#define DEFAULT_FTS 2346 #define DEFAULT_FTS 2346
#define CFG_IEEE80211_RESERVE_FCS (1<<0) #define CFG_IEEE80211_RESERVE_FCS (1<<0)
#define CFG_IEEE80211_COMPUTE_FCS (1<<1) #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
@ -670,6 +653,7 @@ struct ieee80211_device {
int scan_age; int scan_age;
int iw_mode; /* operating mode (IW_MODE_*) */ int iw_mode; /* operating mode (IW_MODE_*) */
struct iw_spy_data spy_data; /* iwspy support */
spinlock_t lock; spinlock_t lock;
@ -760,7 +744,8 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
return 1; return 1;
} }
extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
int mode)
{ {
/* /*
* It is possible for both access points and our device to support * It is possible for both access points and our device to support
@ -811,8 +796,6 @@ extern inline int ieee80211_get_hdrlen(u16 fc)
return hdrlen; return hdrlen;
} }
/* ieee80211.c */ /* ieee80211.c */
extern void free_ieee80211(struct net_device *dev); extern void free_ieee80211(struct net_device *dev);
extern struct net_device *alloc_ieee80211(int sizeof_priv); extern struct net_device *alloc_ieee80211(int sizeof_priv);
@ -820,11 +803,9 @@ extern struct net_device *alloc_ieee80211(int sizeof_priv);
extern int ieee80211_set_encryption(struct ieee80211_device *ieee); extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
/* ieee80211_tx.c */ /* ieee80211_tx.c */
extern int ieee80211_xmit(struct sk_buff *skb, extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev);
struct net_device *dev);
extern void ieee80211_txb_free(struct ieee80211_txb *); extern void ieee80211_txb_free(struct ieee80211_txb *);
/* ieee80211_rx.c */ /* ieee80211_rx.c */
extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats); struct ieee80211_rx_stats *rx_stats);
@ -843,7 +824,6 @@ extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
struct iw_request_info *info, struct iw_request_info *info,
union iwreq_data *wrqu, char *key); union iwreq_data *wrqu, char *key);
extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
{ {
ieee->scans++; ieee->scans++;
@ -854,5 +834,4 @@ extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
return ieee->scans; return ieee->scans;
} }
#endif /* IEEE80211_H */ #endif /* IEEE80211_H */

View File

@ -378,33 +378,47 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
frag = WLAN_GET_SEQ_FRAG(sc); frag = WLAN_GET_SEQ_FRAG(sc);
hdrlen = ieee80211_get_hdrlen(fc); hdrlen = ieee80211_get_hdrlen(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
/* Put this code here so that we avoid duplicating it in all /* Put this code here so that we avoid duplicating it in all
* Rx paths. - Jean II */ * Rx paths. - Jean II */
#ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */
/* If spy monitoring on */ /* If spy monitoring on */
if (iface->spy_data.spy_number > 0) { if (ieee->spy_data.spy_number > 0) {
struct iw_quality wstats; struct iw_quality wstats;
wstats.level = rx_stats->signal;
wstats.updated = 0;
if (rx_stats->mask & IEEE80211_STATMASK_RSSI) {
wstats.level = rx_stats->rssi;
wstats.updated |= IW_QUAL_LEVEL_UPDATED;
} else
wstats.updated |= IW_QUAL_LEVEL_INVALID;
if (rx_stats->mask & IEEE80211_STATMASK_NOISE) {
wstats.noise = rx_stats->noise; wstats.noise = rx_stats->noise;
wstats.updated = 6; /* No qual value */ wstats.updated |= IW_QUAL_NOISE_UPDATED;
} else
wstats.updated |= IW_QUAL_NOISE_INVALID;
if (rx_stats->mask & IEEE80211_STATMASK_SIGNAL) {
wstats.qual = rx_stats->signal;
wstats.updated |= IW_QUAL_QUAL_UPDATED;
} else
wstats.updated |= IW_QUAL_QUAL_INVALID;
/* Update spy records */ /* Update spy records */
wireless_spy_update(dev, hdr->addr2, &wstats); wireless_spy_update(ieee->dev, hdr->addr2, &wstats);
} }
#endif /* IW_WIRELESS_SPY */ #endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
#ifdef NOT_YET
hostap_update_rx_stats(local->ap, hdr, rx_stats); hostap_update_rx_stats(local->ap, hdr, rx_stats);
#endif #endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) { if (ieee->iw_mode == IW_MODE_MONITOR) {
ieee80211_monitor_rx(ieee, skb, rx_stats); ieee80211_monitor_rx(ieee, skb, rx_stats);
stats->rx_packets++; stats->rx_packets++;
stats->rx_bytes += skb->len; stats->rx_bytes += skb->len;
return 1; return 1;
} }
#endif
if (ieee->host_decrypt) { if (ieee->host_decrypt) {
int idx = 0; int idx = 0;
@ -771,8 +785,7 @@ static inline int ieee80211_is_ofdm_rate(u8 rate)
return 0; return 0;
} }
static inline int ieee80211_network_init(struct ieee80211_device *ieee, static inline int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee80211_probe_response
struct ieee80211_probe_response
*beacon, *beacon,
struct ieee80211_network *network, struct ieee80211_network *network,
struct ieee80211_rx_stats *stats) struct ieee80211_rx_stats *stats)
@ -1028,11 +1041,9 @@ static inline void update_network(struct ieee80211_network *dst,
} }
static inline void ieee80211_process_probe_response(struct ieee80211_device static inline void ieee80211_process_probe_response(struct ieee80211_device
*ieee, *ieee, struct
struct
ieee80211_probe_response ieee80211_probe_response
*beacon, *beacon, struct ieee80211_rx_stats
struct ieee80211_rx_stats
*stats) *stats)
{ {
struct ieee80211_network network; struct ieee80211_network network;