Commit 74079fdc authored by James Ketrenos's avatar James Ketrenos Committed by Jeff Garzik

[PATCH] ieee80211 Added wireless spy support

Added wireless spy support to Rx code path.
Signed-off-by: default avatarJames 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: default avatarJeff Garzik <jgarzik@pobox.com>
parent b1b508e1
This diff is collapsed.
...@@ -31,10 +31,10 @@ struct ieee80211_crypto_ops { ...@@ -31,10 +31,10 @@ struct ieee80211_crypto_ops {
/* init new crypto context (e.g., allocate private data space, /* init new crypto context (e.g., allocate private data space,
* select IV, etc.); returns NULL on failure or pointer to allocated * select IV, etc.); returns NULL on failure or pointer to allocated
* private data on success */ * private data on success */
void * (*init)(int keyidx); void *(*init) (int keyidx);
/* deinitialize crypto context and free allocated private data */ /* deinitialize crypto context and free allocated private data */
void (*deinit)(void *priv); void (*deinit) (void *priv);
/* encrypt/decrypt return < 0 on error or >= 0 on success. The return /* encrypt/decrypt return < 0 on error or >= 0 on success. The return
* value from decrypt_mpdu is passed as the keyidx value for * value from decrypt_mpdu is passed as the keyidx value for
...@@ -42,21 +42,21 @@ struct ieee80211_crypto_ops { ...@@ -42,21 +42,21 @@ struct ieee80211_crypto_ops {
* encryption; if not, error will be returned; these functions are * encryption; if not, error will be returned; these functions are
* called for all MPDUs (i.e., fragments). * called for all MPDUs (i.e., fragments).
*/ */
int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
/* These functions are called for full MSDUs, i.e. full frames. /* These functions are called for full MSDUs, i.e. full frames.
* These can be NULL if full MSDU operations are not needed. */ * These can be NULL if full MSDU operations are not needed. */
int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv); int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv);
int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len,
void *priv); void *priv);
int (*set_key)(void *key, int len, u8 *seq, void *priv); int (*set_key) (void *key, int len, u8 * seq, void *priv);
int (*get_key)(void *key, int len, u8 *seq, void *priv); int (*get_key) (void *key, int len, u8 * seq, void *priv);
/* procfs handler for printing out key information and possible /* procfs handler for printing out key information and possible
* statistics */ * statistics */
char * (*print_stats)(char *p, void *priv); char *(*print_stats) (char *p, void *priv);
/* maximum number of bytes added by encryption; encrypt buf is /* maximum number of bytes added by encryption; encrypt buf is
* allocated with extra_prefix_len bytes, copy of in_buf, and * allocated with extra_prefix_len bytes, copy of in_buf, and
...@@ -69,7 +69,7 @@ struct ieee80211_crypto_ops { ...@@ -69,7 +69,7 @@ struct ieee80211_crypto_ops {
}; };
struct ieee80211_crypt_data { struct ieee80211_crypt_data {
struct list_head list; /* delayed deletion list */ struct list_head list; /* delayed deletion list */
struct ieee80211_crypto_ops *ops; struct ieee80211_crypto_ops *ops;
void *priv; void *priv;
atomic_t refcnt; atomic_t refcnt;
...@@ -77,7 +77,7 @@ struct ieee80211_crypt_data { ...@@ -77,7 +77,7 @@ struct ieee80211_crypt_data {
int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name);
void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
void ieee80211_crypt_deinit_handler(unsigned long); void ieee80211_crypt_deinit_handler(unsigned long);
void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
......
...@@ -191,18 +191,18 @@ static void ieee80211_crypt_null_deinit(void *priv) ...@@ -191,18 +191,18 @@ static void ieee80211_crypt_null_deinit(void *priv)
} }
static struct ieee80211_crypto_ops ieee80211_crypt_null = { static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL", .name = "NULL",
.init = ieee80211_crypt_null_init, .init = ieee80211_crypt_null_init,
.deinit = ieee80211_crypt_null_deinit, .deinit = ieee80211_crypt_null_deinit,
.encrypt_mpdu = NULL, .encrypt_mpdu = NULL,
.decrypt_mpdu = NULL, .decrypt_mpdu = NULL,
.encrypt_msdu = NULL, .encrypt_msdu = NULL,
.decrypt_msdu = NULL, .decrypt_msdu = NULL,
.set_key = NULL, .set_key = NULL,
.get_key = NULL, .get_key = NULL,
.extra_prefix_len = 0, .extra_prefix_len = 0,
.extra_postfix_len = 0, .extra_postfix_len = 0,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_init(void) static int __init ieee80211_crypto_init(void)
......
...@@ -426,19 +426,19 @@ static char *ieee80211_ccmp_print_stats(char *p, void *priv) ...@@ -426,19 +426,19 @@ static char *ieee80211_ccmp_print_stats(char *p, void *priv)
} }
static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
.name = "CCMP", .name = "CCMP",
.init = ieee80211_ccmp_init, .init = ieee80211_ccmp_init,
.deinit = ieee80211_ccmp_deinit, .deinit = ieee80211_ccmp_deinit,
.encrypt_mpdu = ieee80211_ccmp_encrypt, .encrypt_mpdu = ieee80211_ccmp_encrypt,
.decrypt_mpdu = ieee80211_ccmp_decrypt, .decrypt_mpdu = ieee80211_ccmp_decrypt,
.encrypt_msdu = NULL, .encrypt_msdu = NULL,
.decrypt_msdu = NULL, .decrypt_msdu = NULL,
.set_key = ieee80211_ccmp_set_key, .set_key = ieee80211_ccmp_set_key,
.get_key = ieee80211_ccmp_get_key, .get_key = ieee80211_ccmp_get_key,
.print_stats = ieee80211_ccmp_print_stats, .print_stats = ieee80211_ccmp_print_stats,
.extra_prefix_len = CCMP_HDR_LEN, .extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN, .extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_ccmp_init(void) static int __init ieee80211_crypto_ccmp_init(void)
......
...@@ -654,19 +654,19 @@ static char *ieee80211_tkip_print_stats(char *p, void *priv) ...@@ -654,19 +654,19 @@ static char *ieee80211_tkip_print_stats(char *p, void *priv)
} }
static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
.name = "TKIP", .name = "TKIP",
.init = ieee80211_tkip_init, .init = ieee80211_tkip_init,
.deinit = ieee80211_tkip_deinit, .deinit = ieee80211_tkip_deinit,
.encrypt_mpdu = ieee80211_tkip_encrypt, .encrypt_mpdu = ieee80211_tkip_encrypt,
.decrypt_mpdu = ieee80211_tkip_decrypt, .decrypt_mpdu = ieee80211_tkip_decrypt,
.encrypt_msdu = ieee80211_michael_mic_add, .encrypt_msdu = ieee80211_michael_mic_add,
.decrypt_msdu = ieee80211_michael_mic_verify, .decrypt_msdu = ieee80211_michael_mic_verify,
.set_key = ieee80211_tkip_set_key, .set_key = ieee80211_tkip_set_key,
.get_key = ieee80211_tkip_get_key, .get_key = ieee80211_tkip_get_key,
.print_stats = ieee80211_tkip_print_stats, .print_stats = ieee80211_tkip_print_stats,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */ .extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */ .extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_tkip_init(void) static int __init ieee80211_crypto_tkip_init(void)
......
...@@ -229,19 +229,19 @@ static char *prism2_wep_print_stats(char *p, void *priv) ...@@ -229,19 +229,19 @@ static char *prism2_wep_print_stats(char *p, void *priv)
} }
static struct ieee80211_crypto_ops ieee80211_crypt_wep = { static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
.name = "WEP", .name = "WEP",
.init = prism2_wep_init, .init = prism2_wep_init,
.deinit = prism2_wep_deinit, .deinit = prism2_wep_deinit,
.encrypt_mpdu = prism2_wep_encrypt, .encrypt_mpdu = prism2_wep_encrypt,
.decrypt_mpdu = prism2_wep_decrypt, .decrypt_mpdu = prism2_wep_decrypt,
.encrypt_msdu = NULL, .encrypt_msdu = NULL,
.decrypt_msdu = NULL, .decrypt_msdu = NULL,
.set_key = prism2_wep_set_key, .set_key = prism2_wep_set_key,
.get_key = prism2_wep_get_key, .get_key = prism2_wep_get_key,
.print_stats = prism2_wep_print_stats, .print_stats = prism2_wep_print_stats,
.extra_prefix_len = 4, /* IV */ .extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */ .extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_wep_init(void) static int __init ieee80211_crypto_wep_init(void)
......
...@@ -378,33 +378,47 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, ...@@ -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.noise = rx_stats->noise; wstats.updated = 0;
wstats.updated = 6; /* No qual value */ 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.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) ...@@ -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, ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment