[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>
Этот коммит содержится в:

коммит произвёл
Jeff Garzik

родитель
b1b508e1b1
Коммит
74079fdce4
@@ -191,18 +191,18 @@ static void ieee80211_crypt_null_deinit(void *priv)
|
||||
}
|
||||
|
||||
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
|
||||
.name = "NULL",
|
||||
.init = ieee80211_crypt_null_init,
|
||||
.deinit = ieee80211_crypt_null_deinit,
|
||||
.encrypt_mpdu = NULL,
|
||||
.decrypt_mpdu = NULL,
|
||||
.encrypt_msdu = NULL,
|
||||
.decrypt_msdu = NULL,
|
||||
.set_key = NULL,
|
||||
.get_key = NULL,
|
||||
.extra_prefix_len = 0,
|
||||
.extra_postfix_len = 0,
|
||||
.owner = THIS_MODULE,
|
||||
.name = "NULL",
|
||||
.init = ieee80211_crypt_null_init,
|
||||
.deinit = ieee80211_crypt_null_deinit,
|
||||
.encrypt_mpdu = NULL,
|
||||
.decrypt_mpdu = NULL,
|
||||
.encrypt_msdu = NULL,
|
||||
.decrypt_msdu = NULL,
|
||||
.set_key = NULL,
|
||||
.get_key = NULL,
|
||||
.extra_prefix_len = 0,
|
||||
.extra_postfix_len = 0,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __init ieee80211_crypto_init(void)
|
||||
|
@@ -426,19 +426,19 @@ static char *ieee80211_ccmp_print_stats(char *p, void *priv)
|
||||
}
|
||||
|
||||
static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
|
||||
.name = "CCMP",
|
||||
.init = ieee80211_ccmp_init,
|
||||
.deinit = ieee80211_ccmp_deinit,
|
||||
.encrypt_mpdu = ieee80211_ccmp_encrypt,
|
||||
.decrypt_mpdu = ieee80211_ccmp_decrypt,
|
||||
.encrypt_msdu = NULL,
|
||||
.decrypt_msdu = NULL,
|
||||
.set_key = ieee80211_ccmp_set_key,
|
||||
.get_key = ieee80211_ccmp_get_key,
|
||||
.print_stats = ieee80211_ccmp_print_stats,
|
||||
.extra_prefix_len = CCMP_HDR_LEN,
|
||||
.extra_postfix_len = CCMP_MIC_LEN,
|
||||
.owner = THIS_MODULE,
|
||||
.name = "CCMP",
|
||||
.init = ieee80211_ccmp_init,
|
||||
.deinit = ieee80211_ccmp_deinit,
|
||||
.encrypt_mpdu = ieee80211_ccmp_encrypt,
|
||||
.decrypt_mpdu = ieee80211_ccmp_decrypt,
|
||||
.encrypt_msdu = NULL,
|
||||
.decrypt_msdu = NULL,
|
||||
.set_key = ieee80211_ccmp_set_key,
|
||||
.get_key = ieee80211_ccmp_get_key,
|
||||
.print_stats = ieee80211_ccmp_print_stats,
|
||||
.extra_prefix_len = CCMP_HDR_LEN,
|
||||
.extra_postfix_len = CCMP_MIC_LEN,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __init ieee80211_crypto_ccmp_init(void)
|
||||
|
@@ -654,19 +654,19 @@ static char *ieee80211_tkip_print_stats(char *p, void *priv)
|
||||
}
|
||||
|
||||
static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
|
||||
.name = "TKIP",
|
||||
.init = ieee80211_tkip_init,
|
||||
.deinit = ieee80211_tkip_deinit,
|
||||
.encrypt_mpdu = ieee80211_tkip_encrypt,
|
||||
.decrypt_mpdu = ieee80211_tkip_decrypt,
|
||||
.encrypt_msdu = ieee80211_michael_mic_add,
|
||||
.decrypt_msdu = ieee80211_michael_mic_verify,
|
||||
.set_key = ieee80211_tkip_set_key,
|
||||
.get_key = ieee80211_tkip_get_key,
|
||||
.print_stats = ieee80211_tkip_print_stats,
|
||||
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
|
||||
.extra_postfix_len = 8 + 4, /* MIC + ICV */
|
||||
.owner = THIS_MODULE,
|
||||
.name = "TKIP",
|
||||
.init = ieee80211_tkip_init,
|
||||
.deinit = ieee80211_tkip_deinit,
|
||||
.encrypt_mpdu = ieee80211_tkip_encrypt,
|
||||
.decrypt_mpdu = ieee80211_tkip_decrypt,
|
||||
.encrypt_msdu = ieee80211_michael_mic_add,
|
||||
.decrypt_msdu = ieee80211_michael_mic_verify,
|
||||
.set_key = ieee80211_tkip_set_key,
|
||||
.get_key = ieee80211_tkip_get_key,
|
||||
.print_stats = ieee80211_tkip_print_stats,
|
||||
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
|
||||
.extra_postfix_len = 8 + 4, /* MIC + ICV */
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __init ieee80211_crypto_tkip_init(void)
|
||||
|
@@ -229,19 +229,19 @@ static char *prism2_wep_print_stats(char *p, void *priv)
|
||||
}
|
||||
|
||||
static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
|
||||
.name = "WEP",
|
||||
.init = prism2_wep_init,
|
||||
.deinit = prism2_wep_deinit,
|
||||
.encrypt_mpdu = prism2_wep_encrypt,
|
||||
.decrypt_mpdu = prism2_wep_decrypt,
|
||||
.encrypt_msdu = NULL,
|
||||
.decrypt_msdu = NULL,
|
||||
.set_key = prism2_wep_set_key,
|
||||
.get_key = prism2_wep_get_key,
|
||||
.print_stats = prism2_wep_print_stats,
|
||||
.extra_prefix_len = 4, /* IV */
|
||||
.extra_postfix_len = 4, /* ICV */
|
||||
.owner = THIS_MODULE,
|
||||
.name = "WEP",
|
||||
.init = prism2_wep_init,
|
||||
.deinit = prism2_wep_deinit,
|
||||
.encrypt_mpdu = prism2_wep_encrypt,
|
||||
.decrypt_mpdu = prism2_wep_decrypt,
|
||||
.encrypt_msdu = NULL,
|
||||
.decrypt_msdu = NULL,
|
||||
.set_key = prism2_wep_set_key,
|
||||
.get_key = prism2_wep_get_key,
|
||||
.print_stats = prism2_wep_print_stats,
|
||||
.extra_prefix_len = 4, /* IV */
|
||||
.extra_postfix_len = 4, /* ICV */
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __init ieee80211_crypto_wep_init(void)
|
||||
|
@@ -378,33 +378,47 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
|
||||
frag = WLAN_GET_SEQ_FRAG(sc);
|
||||
hdrlen = ieee80211_get_hdrlen(fc);
|
||||
|
||||
#ifdef NOT_YET
|
||||
#if WIRELESS_EXT > 15
|
||||
/* Put this code here so that we avoid duplicating it in all
|
||||
* Rx paths. - Jean II */
|
||||
#ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */
|
||||
/* If spy monitoring on */
|
||||
if (iface->spy_data.spy_number > 0) {
|
||||
if (ieee->spy_data.spy_number > 0) {
|
||||
struct iw_quality wstats;
|
||||
wstats.level = rx_stats->signal;
|
||||
wstats.noise = rx_stats->noise;
|
||||
wstats.updated = 6; /* No qual value */
|
||||
|
||||
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.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 */
|
||||
wireless_spy_update(dev, hdr->addr2, &wstats);
|
||||
wireless_spy_update(ieee->dev, hdr->addr2, &wstats);
|
||||
}
|
||||
#endif /* IW_WIRELESS_SPY */
|
||||
#endif /* WIRELESS_EXT > 15 */
|
||||
|
||||
#ifdef NOT_YET
|
||||
hostap_update_rx_stats(local->ap, hdr, rx_stats);
|
||||
#endif
|
||||
|
||||
#if WIRELESS_EXT > 15
|
||||
if (ieee->iw_mode == IW_MODE_MONITOR) {
|
||||
ieee80211_monitor_rx(ieee, skb, rx_stats);
|
||||
stats->rx_packets++;
|
||||
stats->rx_bytes += skb->len;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ieee->host_decrypt) {
|
||||
int idx = 0;
|
||||
@@ -771,8 +785,7 @@ static inline int ieee80211_is_ofdm_rate(u8 rate)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ieee80211_network_init(struct ieee80211_device *ieee,
|
||||
struct ieee80211_probe_response
|
||||
static inline int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee80211_probe_response
|
||||
*beacon,
|
||||
struct ieee80211_network *network,
|
||||
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
|
||||
*ieee,
|
||||
struct
|
||||
*ieee, struct
|
||||
ieee80211_probe_response
|
||||
*beacon,
|
||||
struct ieee80211_rx_stats
|
||||
*beacon, struct ieee80211_rx_stats
|
||||
*stats)
|
||||
{
|
||||
struct ieee80211_network network;
|
||||
|
Ссылка в новой задаче
Block a user