diff options
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/aes_ccm.c | 6 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 16 | ||||
-rw-r--r-- | net/mac80211/debugfs_netdev.c | 5 | ||||
-rw-r--r-- | net/mac80211/ibss.c | 10 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 3 | ||||
-rw-r--r-- | net/mac80211/key.c | 24 | ||||
-rw-r--r-- | net/mac80211/key.h | 15 | ||||
-rw-r--r-- | net/mac80211/mesh.c | 6 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 4 | ||||
-rw-r--r-- | net/mac80211/rx.c | 30 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 2 | ||||
-rw-r--r-- | net/mac80211/sta_info.h | 5 | ||||
-rw-r--r-- | net/mac80211/util.c | 26 | ||||
-rw-r--r-- | net/mac80211/wep.c | 48 | ||||
-rw-r--r-- | net/mac80211/wpa.c | 68 |
15 files changed, 140 insertions, 128 deletions
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c index 0785e95c9924..be7614b9ed27 100644 --- a/net/mac80211/aes_ccm.c +++ b/net/mac80211/aes_ccm.c | |||
@@ -85,7 +85,7 @@ void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch, | |||
85 | *cpos++ = *pos++ ^ e[i]; | 85 | *cpos++ = *pos++ ^ e[i]; |
86 | } | 86 | } |
87 | 87 | ||
88 | for (i = 0; i < CCMP_MIC_LEN; i++) | 88 | for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) |
89 | mic[i] = b[i] ^ s_0[i]; | 89 | mic[i] = b[i] ^ s_0[i]; |
90 | } | 90 | } |
91 | 91 | ||
@@ -123,7 +123,7 @@ int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch, | |||
123 | crypto_cipher_encrypt_one(tfm, a, a); | 123 | crypto_cipher_encrypt_one(tfm, a, a); |
124 | } | 124 | } |
125 | 125 | ||
126 | for (i = 0; i < CCMP_MIC_LEN; i++) { | 126 | for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) { |
127 | if ((mic[i] ^ s_0[i]) != a[i]) | 127 | if ((mic[i] ^ s_0[i]) != a[i]) |
128 | return -1; | 128 | return -1; |
129 | } | 129 | } |
@@ -138,7 +138,7 @@ struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]) | |||
138 | 138 | ||
139 | tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); | 139 | tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); |
140 | if (!IS_ERR(tfm)) | 140 | if (!IS_ERR(tfm)) |
141 | crypto_cipher_setkey(tfm, key, ALG_CCMP_KEY_LEN); | 141 | crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP); |
142 | 142 | ||
143 | return tfm; | 143 | return tfm; |
144 | } | 144 | } |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 1a89c80e6407..eb4219051043 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -444,7 +444,7 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
444 | struct ieee80211_local *local = sdata->local; | 444 | struct ieee80211_local *local = sdata->local; |
445 | struct timespec uptime; | 445 | struct timespec uptime; |
446 | u64 packets = 0; | 446 | u64 packets = 0; |
447 | int ac; | 447 | int i, ac; |
448 | 448 | ||
449 | sinfo->generation = sdata->local->sta_generation; | 449 | sinfo->generation = sdata->local->sta_generation; |
450 | 450 | ||
@@ -488,6 +488,17 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
488 | sinfo->signal = (s8)sta->last_signal; | 488 | sinfo->signal = (s8)sta->last_signal; |
489 | sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); | 489 | sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); |
490 | } | 490 | } |
491 | if (sta->chains) { | ||
492 | sinfo->filled |= STATION_INFO_CHAIN_SIGNAL | | ||
493 | STATION_INFO_CHAIN_SIGNAL_AVG; | ||
494 | |||
495 | sinfo->chains = sta->chains; | ||
496 | for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { | ||
497 | sinfo->chain_signal[i] = sta->chain_signal_last[i]; | ||
498 | sinfo->chain_signal_avg[i] = | ||
499 | (s8) -ewma_read(&sta->chain_signal_avg[i]); | ||
500 | } | ||
501 | } | ||
491 | 502 | ||
492 | sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate); | 503 | sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate); |
493 | sta_set_rate_info_rx(sta, &sinfo->rxrate); | 504 | sta_set_rate_info_rx(sta, &sinfo->rxrate); |
@@ -728,7 +739,7 @@ static void ieee80211_get_et_strings(struct wiphy *wiphy, | |||
728 | 739 | ||
729 | if (sset == ETH_SS_STATS) { | 740 | if (sset == ETH_SS_STATS) { |
730 | sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats); | 741 | sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats); |
731 | memcpy(data, *ieee80211_gstrings_sta_stats, sz_sta_stats); | 742 | memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats); |
732 | } | 743 | } |
733 | drv_get_et_strings(sdata, sset, &(data[sz_sta_stats])); | 744 | drv_get_et_strings(sdata, sset, &(data[sz_sta_stats])); |
734 | } | 745 | } |
@@ -1735,6 +1746,7 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh, | |||
1735 | ifmsh->mesh_pp_id = setup->path_sel_proto; | 1746 | ifmsh->mesh_pp_id = setup->path_sel_proto; |
1736 | ifmsh->mesh_pm_id = setup->path_metric; | 1747 | ifmsh->mesh_pm_id = setup->path_metric; |
1737 | ifmsh->user_mpm = setup->user_mpm; | 1748 | ifmsh->user_mpm = setup->user_mpm; |
1749 | ifmsh->mesh_auth_id = setup->auth_id; | ||
1738 | ifmsh->security = IEEE80211_MESH_SEC_NONE; | 1750 | ifmsh->security = IEEE80211_MESH_SEC_NONE; |
1739 | if (setup->is_authenticated) | 1751 | if (setup->is_authenticated) |
1740 | ifmsh->security |= IEEE80211_MESH_SEC_AUTHED; | 1752 | ifmsh->security |= IEEE80211_MESH_SEC_AUTHED; |
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 14abcf44f974..f83074fe6670 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -471,6 +471,8 @@ __IEEE80211_IF_FILE_W(tsf); | |||
471 | IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC); | 471 | IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC); |
472 | 472 | ||
473 | #ifdef CONFIG_MAC80211_MESH | 473 | #ifdef CONFIG_MAC80211_MESH |
474 | IEEE80211_IF_FILE(estab_plinks, u.mesh.estab_plinks, ATOMIC); | ||
475 | |||
474 | /* Mesh stats attributes */ | 476 | /* Mesh stats attributes */ |
475 | IEEE80211_IF_FILE(fwded_mcast, u.mesh.mshstats.fwded_mcast, DEC); | 477 | IEEE80211_IF_FILE(fwded_mcast, u.mesh.mshstats.fwded_mcast, DEC); |
476 | IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC); | 478 | IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC); |
@@ -480,7 +482,6 @@ IEEE80211_IF_FILE(dropped_frames_congestion, | |||
480 | u.mesh.mshstats.dropped_frames_congestion, DEC); | 482 | u.mesh.mshstats.dropped_frames_congestion, DEC); |
481 | IEEE80211_IF_FILE(dropped_frames_no_route, | 483 | IEEE80211_IF_FILE(dropped_frames_no_route, |
482 | u.mesh.mshstats.dropped_frames_no_route, DEC); | 484 | u.mesh.mshstats.dropped_frames_no_route, DEC); |
483 | IEEE80211_IF_FILE(estab_plinks, u.mesh.estab_plinks, ATOMIC); | ||
484 | 485 | ||
485 | /* Mesh parameters */ | 486 | /* Mesh parameters */ |
486 | IEEE80211_IF_FILE(dot11MeshMaxRetries, | 487 | IEEE80211_IF_FILE(dot11MeshMaxRetries, |
@@ -583,6 +584,7 @@ static void add_wds_files(struct ieee80211_sub_if_data *sdata) | |||
583 | static void add_mesh_files(struct ieee80211_sub_if_data *sdata) | 584 | static void add_mesh_files(struct ieee80211_sub_if_data *sdata) |
584 | { | 585 | { |
585 | DEBUGFS_ADD_MODE(tsf, 0600); | 586 | DEBUGFS_ADD_MODE(tsf, 0600); |
587 | DEBUGFS_ADD_MODE(estab_plinks, 0400); | ||
586 | } | 588 | } |
587 | 589 | ||
588 | static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) | 590 | static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) |
@@ -598,7 +600,6 @@ static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) | |||
598 | MESHSTATS_ADD(dropped_frames_ttl); | 600 | MESHSTATS_ADD(dropped_frames_ttl); |
599 | MESHSTATS_ADD(dropped_frames_no_route); | 601 | MESHSTATS_ADD(dropped_frames_no_route); |
600 | MESHSTATS_ADD(dropped_frames_congestion); | 602 | MESHSTATS_ADD(dropped_frames_congestion); |
601 | MESHSTATS_ADD(estab_plinks); | ||
602 | #undef MESHSTATS_ADD | 603 | #undef MESHSTATS_ADD |
603 | } | 604 | } |
604 | 605 | ||
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 170f9a7fa319..956ba6316da5 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -341,6 +341,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
341 | struct ieee80211_local *local = sdata->local; | 341 | struct ieee80211_local *local = sdata->local; |
342 | struct sta_info *sta; | 342 | struct sta_info *sta; |
343 | struct ieee80211_chanctx_conf *chanctx_conf; | 343 | struct ieee80211_chanctx_conf *chanctx_conf; |
344 | struct ieee80211_supported_band *sband; | ||
344 | int band; | 345 | int band; |
345 | 346 | ||
346 | /* | 347 | /* |
@@ -380,8 +381,9 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
380 | sta->last_rx = jiffies; | 381 | sta->last_rx = jiffies; |
381 | 382 | ||
382 | /* make sure mandatory rates are always added */ | 383 | /* make sure mandatory rates are always added */ |
384 | sband = local->hw.wiphy->bands[band]; | ||
383 | sta->sta.supp_rates[band] = supp_rates | | 385 | sta->sta.supp_rates[band] = supp_rates | |
384 | ieee80211_mandatory_rates(local, band); | 386 | ieee80211_mandatory_rates(sband); |
385 | 387 | ||
386 | return ieee80211_ibss_finish_sta(sta, auth); | 388 | return ieee80211_ibss_finish_sta(sta, auth); |
387 | } | 389 | } |
@@ -492,7 +494,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
492 | prev_rates = sta->sta.supp_rates[band]; | 494 | prev_rates = sta->sta.supp_rates[band]; |
493 | /* make sure mandatory rates are always added */ | 495 | /* make sure mandatory rates are always added */ |
494 | sta->sta.supp_rates[band] = supp_rates | | 496 | sta->sta.supp_rates[band] = supp_rates | |
495 | ieee80211_mandatory_rates(local, band); | 497 | ieee80211_mandatory_rates(sband); |
496 | 498 | ||
497 | if (sta->sta.supp_rates[band] != prev_rates) { | 499 | if (sta->sta.supp_rates[band] != prev_rates) { |
498 | ibss_dbg(sdata, | 500 | ibss_dbg(sdata, |
@@ -624,6 +626,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, | |||
624 | struct ieee80211_local *local = sdata->local; | 626 | struct ieee80211_local *local = sdata->local; |
625 | struct sta_info *sta; | 627 | struct sta_info *sta; |
626 | struct ieee80211_chanctx_conf *chanctx_conf; | 628 | struct ieee80211_chanctx_conf *chanctx_conf; |
629 | struct ieee80211_supported_band *sband; | ||
627 | int band; | 630 | int band; |
628 | 631 | ||
629 | /* | 632 | /* |
@@ -658,8 +661,9 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, | |||
658 | sta->last_rx = jiffies; | 661 | sta->last_rx = jiffies; |
659 | 662 | ||
660 | /* make sure mandatory rates are always added */ | 663 | /* make sure mandatory rates are always added */ |
664 | sband = local->hw.wiphy->bands[band]; | ||
661 | sta->sta.supp_rates[band] = supp_rates | | 665 | sta->sta.supp_rates[band] = supp_rates | |
662 | ieee80211_mandatory_rates(local, band); | 666 | ieee80211_mandatory_rates(sband); |
663 | 667 | ||
664 | spin_lock(&ifibss->incomplete_lock); | 668 | spin_lock(&ifibss->incomplete_lock); |
665 | list_add(&sta->list, &ifibss->incomplete_stations); | 669 | list_add(&sta->list, &ifibss->incomplete_stations); |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 44be28cfc6c4..ba3cd284d104 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1506,9 +1506,6 @@ static inline void ieee802_11_parse_elems(u8 *start, size_t len, bool action, | |||
1506 | ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0); | 1506 | ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0); |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | u32 ieee80211_mandatory_rates(struct ieee80211_local *local, | ||
1510 | enum ieee80211_band band); | ||
1511 | |||
1512 | void ieee80211_dynamic_ps_enable_work(struct work_struct *work); | 1509 | void ieee80211_dynamic_ps_enable_work(struct work_struct *work); |
1513 | void ieee80211_dynamic_ps_disable_work(struct work_struct *work); | 1510 | void ieee80211_dynamic_ps_disable_work(struct work_struct *work); |
1514 | void ieee80211_dynamic_ps_timer(unsigned long data); | 1511 | void ieee80211_dynamic_ps_timer(unsigned long data); |
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 67059b88fea5..e39cc91d0cf1 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -335,12 +335,12 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, | |||
335 | switch (cipher) { | 335 | switch (cipher) { |
336 | case WLAN_CIPHER_SUITE_WEP40: | 336 | case WLAN_CIPHER_SUITE_WEP40: |
337 | case WLAN_CIPHER_SUITE_WEP104: | 337 | case WLAN_CIPHER_SUITE_WEP104: |
338 | key->conf.iv_len = WEP_IV_LEN; | 338 | key->conf.iv_len = IEEE80211_WEP_IV_LEN; |
339 | key->conf.icv_len = WEP_ICV_LEN; | 339 | key->conf.icv_len = IEEE80211_WEP_ICV_LEN; |
340 | break; | 340 | break; |
341 | case WLAN_CIPHER_SUITE_TKIP: | 341 | case WLAN_CIPHER_SUITE_TKIP: |
342 | key->conf.iv_len = TKIP_IV_LEN; | 342 | key->conf.iv_len = IEEE80211_TKIP_IV_LEN; |
343 | key->conf.icv_len = TKIP_ICV_LEN; | 343 | key->conf.icv_len = IEEE80211_TKIP_ICV_LEN; |
344 | if (seq) { | 344 | if (seq) { |
345 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) { | 345 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) { |
346 | key->u.tkip.rx[i].iv32 = | 346 | key->u.tkip.rx[i].iv32 = |
@@ -352,13 +352,13 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, | |||
352 | spin_lock_init(&key->u.tkip.txlock); | 352 | spin_lock_init(&key->u.tkip.txlock); |
353 | break; | 353 | break; |
354 | case WLAN_CIPHER_SUITE_CCMP: | 354 | case WLAN_CIPHER_SUITE_CCMP: |
355 | key->conf.iv_len = CCMP_HDR_LEN; | 355 | key->conf.iv_len = IEEE80211_CCMP_HDR_LEN; |
356 | key->conf.icv_len = CCMP_MIC_LEN; | 356 | key->conf.icv_len = IEEE80211_CCMP_MIC_LEN; |
357 | if (seq) { | 357 | if (seq) { |
358 | for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) | 358 | for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) |
359 | for (j = 0; j < CCMP_PN_LEN; j++) | 359 | for (j = 0; j < IEEE80211_CCMP_PN_LEN; j++) |
360 | key->u.ccmp.rx_pn[i][j] = | 360 | key->u.ccmp.rx_pn[i][j] = |
361 | seq[CCMP_PN_LEN - j - 1]; | 361 | seq[IEEE80211_CCMP_PN_LEN - j - 1]; |
362 | } | 362 | } |
363 | /* | 363 | /* |
364 | * Initialize AES key state here as an optimization so that | 364 | * Initialize AES key state here as an optimization so that |
@@ -375,9 +375,9 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, | |||
375 | key->conf.iv_len = 0; | 375 | key->conf.iv_len = 0; |
376 | key->conf.icv_len = sizeof(struct ieee80211_mmie); | 376 | key->conf.icv_len = sizeof(struct ieee80211_mmie); |
377 | if (seq) | 377 | if (seq) |
378 | for (j = 0; j < CMAC_PN_LEN; j++) | 378 | for (j = 0; j < IEEE80211_CMAC_PN_LEN; j++) |
379 | key->u.aes_cmac.rx_pn[j] = | 379 | key->u.aes_cmac.rx_pn[j] = |
380 | seq[CMAC_PN_LEN - j - 1]; | 380 | seq[IEEE80211_CMAC_PN_LEN - j - 1]; |
381 | /* | 381 | /* |
382 | * Initialize AES key state here as an optimization so that | 382 | * Initialize AES key state here as an optimization so that |
383 | * it does not need to be initialized for every packet. | 383 | * it does not need to be initialized for every packet. |
@@ -740,13 +740,13 @@ void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, | |||
740 | pn = key->u.ccmp.rx_pn[IEEE80211_NUM_TIDS]; | 740 | pn = key->u.ccmp.rx_pn[IEEE80211_NUM_TIDS]; |
741 | else | 741 | else |
742 | pn = key->u.ccmp.rx_pn[tid]; | 742 | pn = key->u.ccmp.rx_pn[tid]; |
743 | memcpy(seq->ccmp.pn, pn, CCMP_PN_LEN); | 743 | memcpy(seq->ccmp.pn, pn, IEEE80211_CCMP_PN_LEN); |
744 | break; | 744 | break; |
745 | case WLAN_CIPHER_SUITE_AES_CMAC: | 745 | case WLAN_CIPHER_SUITE_AES_CMAC: |
746 | if (WARN_ON(tid != 0)) | 746 | if (WARN_ON(tid != 0)) |
747 | return; | 747 | return; |
748 | pn = key->u.aes_cmac.rx_pn; | 748 | pn = key->u.aes_cmac.rx_pn; |
749 | memcpy(seq->aes_cmac.pn, pn, CMAC_PN_LEN); | 749 | memcpy(seq->aes_cmac.pn, pn, IEEE80211_CMAC_PN_LEN); |
750 | break; | 750 | break; |
751 | } | 751 | } |
752 | } | 752 | } |
diff --git a/net/mac80211/key.h b/net/mac80211/key.h index e8de3e6d7804..036d57e76a5e 100644 --- a/net/mac80211/key.h +++ b/net/mac80211/key.h | |||
@@ -19,17 +19,6 @@ | |||
19 | #define NUM_DEFAULT_KEYS 4 | 19 | #define NUM_DEFAULT_KEYS 4 |
20 | #define NUM_DEFAULT_MGMT_KEYS 2 | 20 | #define NUM_DEFAULT_MGMT_KEYS 2 |
21 | 21 | ||
22 | #define WEP_IV_LEN 4 | ||
23 | #define WEP_ICV_LEN 4 | ||
24 | #define ALG_CCMP_KEY_LEN 16 | ||
25 | #define CCMP_HDR_LEN 8 | ||
26 | #define CCMP_MIC_LEN 8 | ||
27 | #define CCMP_TK_LEN 16 | ||
28 | #define CCMP_PN_LEN 6 | ||
29 | #define TKIP_IV_LEN 8 | ||
30 | #define TKIP_ICV_LEN 4 | ||
31 | #define CMAC_PN_LEN 6 | ||
32 | |||
33 | struct ieee80211_local; | 22 | struct ieee80211_local; |
34 | struct ieee80211_sub_if_data; | 23 | struct ieee80211_sub_if_data; |
35 | struct sta_info; | 24 | struct sta_info; |
@@ -93,13 +82,13 @@ struct ieee80211_key { | |||
93 | * frames and the last counter is used with Robust | 82 | * frames and the last counter is used with Robust |
94 | * Management frames. | 83 | * Management frames. |
95 | */ | 84 | */ |
96 | u8 rx_pn[IEEE80211_NUM_TIDS + 1][CCMP_PN_LEN]; | 85 | u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN]; |
97 | struct crypto_cipher *tfm; | 86 | struct crypto_cipher *tfm; |
98 | u32 replays; /* dot11RSNAStatsCCMPReplays */ | 87 | u32 replays; /* dot11RSNAStatsCCMPReplays */ |
99 | } ccmp; | 88 | } ccmp; |
100 | struct { | 89 | struct { |
101 | atomic64_t tx_pn; | 90 | atomic64_t tx_pn; |
102 | u8 rx_pn[CMAC_PN_LEN]; | 91 | u8 rx_pn[IEEE80211_CMAC_PN_LEN]; |
103 | struct crypto_cipher *tfm; | 92 | struct crypto_cipher *tfm; |
104 | u32 replays; /* dot11RSNAStatsCMACReplays */ | 93 | u32 replays; /* dot11RSNAStatsCMACReplays */ |
105 | u32 icverrors; /* dot11RSNAStatsCMACICVErrors */ | 94 | u32 icverrors; /* dot11RSNAStatsCMACICVErrors */ |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 6952760881c8..c14bb816c6a3 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -741,6 +741,8 @@ int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) | |||
741 | BSS_CHANGED_BASIC_RATES | | 741 | BSS_CHANGED_BASIC_RATES | |
742 | BSS_CHANGED_BEACON_INT; | 742 | BSS_CHANGED_BEACON_INT; |
743 | enum ieee80211_band band = ieee80211_get_sdata_band(sdata); | 743 | enum ieee80211_band band = ieee80211_get_sdata_band(sdata); |
744 | struct ieee80211_supported_band *sband = | ||
745 | sdata->local->hw.wiphy->bands[band]; | ||
744 | 746 | ||
745 | local->fif_other_bss++; | 747 | local->fif_other_bss++; |
746 | /* mesh ifaces must set allmulti to forward mcast traffic */ | 748 | /* mesh ifaces must set allmulti to forward mcast traffic */ |
@@ -748,7 +750,6 @@ int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) | |||
748 | ieee80211_configure_filter(local); | 750 | ieee80211_configure_filter(local); |
749 | 751 | ||
750 | ifmsh->mesh_cc_id = 0; /* Disabled */ | 752 | ifmsh->mesh_cc_id = 0; /* Disabled */ |
751 | ifmsh->mesh_auth_id = 0; /* Disabled */ | ||
752 | /* register sync ops from extensible synchronization framework */ | 753 | /* register sync ops from extensible synchronization framework */ |
753 | ifmsh->sync_ops = ieee80211_mesh_sync_ops_get(ifmsh->mesh_sp_id); | 754 | ifmsh->sync_ops = ieee80211_mesh_sync_ops_get(ifmsh->mesh_sp_id); |
754 | ifmsh->adjusting_tbtt = false; | 755 | ifmsh->adjusting_tbtt = false; |
@@ -759,8 +760,7 @@ int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) | |||
759 | sdata->vif.bss_conf.ht_operation_mode = | 760 | sdata->vif.bss_conf.ht_operation_mode = |
760 | ifmsh->mshcfg.ht_opmode; | 761 | ifmsh->mshcfg.ht_opmode; |
761 | sdata->vif.bss_conf.enable_beacon = true; | 762 | sdata->vif.bss_conf.enable_beacon = true; |
762 | sdata->vif.bss_conf.basic_rates = | 763 | sdata->vif.bss_conf.basic_rates = ieee80211_mandatory_rates(sband); |
763 | ieee80211_mandatory_rates(local, band); | ||
764 | 764 | ||
765 | changed |= ieee80211_mps_local_status_update(sdata); | 765 | changed |= ieee80211_mps_local_status_update(sdata); |
766 | 766 | ||
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index a8c2130c8ba4..1da3d6be8e11 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1390,6 +1390,9 @@ static bool ieee80211_powersave_allowed(struct ieee80211_sub_if_data *sdata) | |||
1390 | IEEE80211_STA_CONNECTION_POLL)) | 1390 | IEEE80211_STA_CONNECTION_POLL)) |
1391 | return false; | 1391 | return false; |
1392 | 1392 | ||
1393 | if (!sdata->vif.bss_conf.dtim_period) | ||
1394 | return false; | ||
1395 | |||
1393 | rcu_read_lock(); | 1396 | rcu_read_lock(); |
1394 | sta = sta_info_get(sdata, mgd->bssid); | 1397 | sta = sta_info_get(sdata, mgd->bssid); |
1395 | if (sta) | 1398 | if (sta) |
@@ -3126,6 +3129,7 @@ ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
3126 | } | 3129 | } |
3127 | 3130 | ||
3128 | changed |= BSS_CHANGED_DTIM_PERIOD; | 3131 | changed |= BSS_CHANGED_DTIM_PERIOD; |
3132 | ieee80211_recalc_ps_vif(sdata); | ||
3129 | } | 3133 | } |
3130 | 3134 | ||
3131 | if (elems.erp_info) { | 3135 | if (elems.erp_info) { |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 8e2952620256..bdd7b4a719e9 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -258,6 +258,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
258 | pos += 2; | 258 | pos += 2; |
259 | 259 | ||
260 | if (status->flag & RX_FLAG_HT) { | 260 | if (status->flag & RX_FLAG_HT) { |
261 | unsigned int stbc; | ||
262 | |||
261 | rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS); | 263 | rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS); |
262 | *pos++ = local->hw.radiotap_mcs_details; | 264 | *pos++ = local->hw.radiotap_mcs_details; |
263 | *pos = 0; | 265 | *pos = 0; |
@@ -267,6 +269,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
267 | *pos |= IEEE80211_RADIOTAP_MCS_BW_40; | 269 | *pos |= IEEE80211_RADIOTAP_MCS_BW_40; |
268 | if (status->flag & RX_FLAG_HT_GF) | 270 | if (status->flag & RX_FLAG_HT_GF) |
269 | *pos |= IEEE80211_RADIOTAP_MCS_FMT_GF; | 271 | *pos |= IEEE80211_RADIOTAP_MCS_FMT_GF; |
272 | stbc = (status->flag & RX_FLAG_STBC_MASK) >> RX_FLAG_STBC_SHIFT; | ||
273 | *pos |= stbc << IEEE80211_RADIOTAP_MCS_STBC_SHIFT; | ||
270 | pos++; | 274 | pos++; |
271 | *pos++ = status->rate_idx; | 275 | *pos++ = status->rate_idx; |
272 | } | 276 | } |
@@ -1372,6 +1376,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1372 | struct sk_buff *skb = rx->skb; | 1376 | struct sk_buff *skb = rx->skb; |
1373 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 1377 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
1374 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1378 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1379 | int i; | ||
1375 | 1380 | ||
1376 | if (!sta) | 1381 | if (!sta) |
1377 | return RX_CONTINUE; | 1382 | return RX_CONTINUE; |
@@ -1422,6 +1427,19 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1422 | ewma_add(&sta->avg_signal, -status->signal); | 1427 | ewma_add(&sta->avg_signal, -status->signal); |
1423 | } | 1428 | } |
1424 | 1429 | ||
1430 | if (status->chains) { | ||
1431 | sta->chains = status->chains; | ||
1432 | for (i = 0; i < ARRAY_SIZE(status->chain_signal); i++) { | ||
1433 | int signal = status->chain_signal[i]; | ||
1434 | |||
1435 | if (!(status->chains & BIT(i))) | ||
1436 | continue; | ||
1437 | |||
1438 | sta->chain_signal_last[i] = signal; | ||
1439 | ewma_add(&sta->chain_signal_avg[i], -signal); | ||
1440 | } | ||
1441 | } | ||
1442 | |||
1425 | /* | 1443 | /* |
1426 | * Change STA power saving mode only at the end of a frame | 1444 | * Change STA power saving mode only at the end of a frame |
1427 | * exchange sequence. | 1445 | * exchange sequence. |
@@ -1608,7 +1626,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
1608 | entry->ccmp = 1; | 1626 | entry->ccmp = 1; |
1609 | memcpy(entry->last_pn, | 1627 | memcpy(entry->last_pn, |
1610 | rx->key->u.ccmp.rx_pn[queue], | 1628 | rx->key->u.ccmp.rx_pn[queue], |
1611 | CCMP_PN_LEN); | 1629 | IEEE80211_CCMP_PN_LEN); |
1612 | } | 1630 | } |
1613 | return RX_QUEUED; | 1631 | return RX_QUEUED; |
1614 | } | 1632 | } |
@@ -1627,21 +1645,21 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
1627 | * (IEEE 802.11i, 8.3.3.4.5) */ | 1645 | * (IEEE 802.11i, 8.3.3.4.5) */ |
1628 | if (entry->ccmp) { | 1646 | if (entry->ccmp) { |
1629 | int i; | 1647 | int i; |
1630 | u8 pn[CCMP_PN_LEN], *rpn; | 1648 | u8 pn[IEEE80211_CCMP_PN_LEN], *rpn; |
1631 | int queue; | 1649 | int queue; |
1632 | if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP) | 1650 | if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP) |
1633 | return RX_DROP_UNUSABLE; | 1651 | return RX_DROP_UNUSABLE; |
1634 | memcpy(pn, entry->last_pn, CCMP_PN_LEN); | 1652 | memcpy(pn, entry->last_pn, IEEE80211_CCMP_PN_LEN); |
1635 | for (i = CCMP_PN_LEN - 1; i >= 0; i--) { | 1653 | for (i = IEEE80211_CCMP_PN_LEN - 1; i >= 0; i--) { |
1636 | pn[i]++; | 1654 | pn[i]++; |
1637 | if (pn[i]) | 1655 | if (pn[i]) |
1638 | break; | 1656 | break; |
1639 | } | 1657 | } |
1640 | queue = rx->security_idx; | 1658 | queue = rx->security_idx; |
1641 | rpn = rx->key->u.ccmp.rx_pn[queue]; | 1659 | rpn = rx->key->u.ccmp.rx_pn[queue]; |
1642 | if (memcmp(pn, rpn, CCMP_PN_LEN)) | 1660 | if (memcmp(pn, rpn, IEEE80211_CCMP_PN_LEN)) |
1643 | return RX_DROP_UNUSABLE; | 1661 | return RX_DROP_UNUSABLE; |
1644 | memcpy(entry->last_pn, pn, CCMP_PN_LEN); | 1662 | memcpy(entry->last_pn, pn, IEEE80211_CCMP_PN_LEN); |
1645 | } | 1663 | } |
1646 | 1664 | ||
1647 | skb_pull(rx->skb, ieee80211_hdrlen(fc)); | 1665 | skb_pull(rx->skb, ieee80211_hdrlen(fc)); |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 11216bc13b27..a04c5671d7fd 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -358,6 +358,8 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
358 | do_posix_clock_monotonic_gettime(&uptime); | 358 | do_posix_clock_monotonic_gettime(&uptime); |
359 | sta->last_connected = uptime.tv_sec; | 359 | sta->last_connected = uptime.tv_sec; |
360 | ewma_init(&sta->avg_signal, 1024, 8); | 360 | ewma_init(&sta->avg_signal, 1024, 8); |
361 | for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++) | ||
362 | ewma_init(&sta->chain_signal_avg[i], 1024, 8); | ||
361 | 363 | ||
362 | if (sta_prepare_rate_control(local, sta, gfp)) { | 364 | if (sta_prepare_rate_control(local, sta, gfp)) { |
363 | kfree(sta); | 365 | kfree(sta); |
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index adc30045f99e..41c28b977f7c 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -344,6 +344,11 @@ struct sta_info { | |||
344 | int last_signal; | 344 | int last_signal; |
345 | struct ewma avg_signal; | 345 | struct ewma avg_signal; |
346 | int last_ack_signal; | 346 | int last_ack_signal; |
347 | |||
348 | u8 chains; | ||
349 | s8 chain_signal_last[IEEE80211_MAX_CHAINS]; | ||
350 | struct ewma chain_signal_avg[IEEE80211_MAX_CHAINS]; | ||
351 | |||
347 | /* Plus 1 for non-QoS frames */ | 352 | /* Plus 1 for non-QoS frames */ |
348 | __le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1]; | 353 | __le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1]; |
349 | 354 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 27e07150eb46..ffdfe4bc89ad 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1072,32 +1072,6 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, | |||
1072 | ieee80211_set_wmm_default(sdata, true); | 1072 | ieee80211_set_wmm_default(sdata, true); |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | u32 ieee80211_mandatory_rates(struct ieee80211_local *local, | ||
1076 | enum ieee80211_band band) | ||
1077 | { | ||
1078 | struct ieee80211_supported_band *sband; | ||
1079 | struct ieee80211_rate *bitrates; | ||
1080 | u32 mandatory_rates; | ||
1081 | enum ieee80211_rate_flags mandatory_flag; | ||
1082 | int i; | ||
1083 | |||
1084 | sband = local->hw.wiphy->bands[band]; | ||
1085 | if (WARN_ON(!sband)) | ||
1086 | return 1; | ||
1087 | |||
1088 | if (band == IEEE80211_BAND_2GHZ) | ||
1089 | mandatory_flag = IEEE80211_RATE_MANDATORY_B; | ||
1090 | else | ||
1091 | mandatory_flag = IEEE80211_RATE_MANDATORY_A; | ||
1092 | |||
1093 | bitrates = sband->bitrates; | ||
1094 | mandatory_rates = 0; | ||
1095 | for (i = 0; i < sband->n_bitrates; i++) | ||
1096 | if (bitrates[i].flags & mandatory_flag) | ||
1097 | mandatory_rates |= BIT(i); | ||
1098 | return mandatory_rates; | ||
1099 | } | ||
1100 | |||
1101 | void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, | 1075 | void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, |
1102 | u16 transaction, u16 auth_alg, u16 status, | 1076 | u16 transaction, u16 auth_alg, u16 status, |
1103 | const u8 *extra, size_t extra_len, const u8 *da, | 1077 | const u8 *extra, size_t extra_len, const u8 *da, |
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index c04d401dae92..6ee2b5863572 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -28,7 +28,7 @@ | |||
28 | int ieee80211_wep_init(struct ieee80211_local *local) | 28 | int ieee80211_wep_init(struct ieee80211_local *local) |
29 | { | 29 | { |
30 | /* start WEP IV from a random value */ | 30 | /* start WEP IV from a random value */ |
31 | get_random_bytes(&local->wep_iv, WEP_IV_LEN); | 31 | get_random_bytes(&local->wep_iv, IEEE80211_WEP_IV_LEN); |
32 | 32 | ||
33 | local->wep_tx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC); | 33 | local->wep_tx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC); |
34 | if (IS_ERR(local->wep_tx_tfm)) { | 34 | if (IS_ERR(local->wep_tx_tfm)) { |
@@ -98,20 +98,21 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, | |||
98 | 98 | ||
99 | hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 99 | hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
100 | 100 | ||
101 | if (WARN_ON(skb_tailroom(skb) < WEP_ICV_LEN || | 101 | if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN || |
102 | skb_headroom(skb) < WEP_IV_LEN)) | 102 | skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) |
103 | return NULL; | 103 | return NULL; |
104 | 104 | ||
105 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 105 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
106 | newhdr = skb_push(skb, WEP_IV_LEN); | 106 | newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN); |
107 | memmove(newhdr, newhdr + WEP_IV_LEN, hdrlen); | 107 | memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen); |
108 | 108 | ||
109 | /* the HW only needs room for the IV, but not the actual IV */ | 109 | /* the HW only needs room for the IV, but not the actual IV */ |
110 | if (info->control.hw_key && | 110 | if (info->control.hw_key && |
111 | (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) | 111 | (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) |
112 | return newhdr + hdrlen; | 112 | return newhdr + hdrlen; |
113 | 113 | ||
114 | skb_set_network_header(skb, skb_network_offset(skb) + WEP_IV_LEN); | 114 | skb_set_network_header(skb, skb_network_offset(skb) + |
115 | IEEE80211_WEP_IV_LEN); | ||
115 | ieee80211_wep_get_iv(local, keylen, keyidx, newhdr + hdrlen); | 116 | ieee80211_wep_get_iv(local, keylen, keyidx, newhdr + hdrlen); |
116 | return newhdr + hdrlen; | 117 | return newhdr + hdrlen; |
117 | } | 118 | } |
@@ -125,8 +126,8 @@ static void ieee80211_wep_remove_iv(struct ieee80211_local *local, | |||
125 | unsigned int hdrlen; | 126 | unsigned int hdrlen; |
126 | 127 | ||
127 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 128 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
128 | memmove(skb->data + WEP_IV_LEN, skb->data, hdrlen); | 129 | memmove(skb->data + IEEE80211_WEP_IV_LEN, skb->data, hdrlen); |
129 | skb_pull(skb, WEP_IV_LEN); | 130 | skb_pull(skb, IEEE80211_WEP_IV_LEN); |
130 | } | 131 | } |
131 | 132 | ||
132 | 133 | ||
@@ -146,7 +147,7 @@ int ieee80211_wep_encrypt_data(struct crypto_cipher *tfm, u8 *rc4key, | |||
146 | put_unaligned(icv, (__le32 *)(data + data_len)); | 147 | put_unaligned(icv, (__le32 *)(data + data_len)); |
147 | 148 | ||
148 | crypto_cipher_setkey(tfm, rc4key, klen); | 149 | crypto_cipher_setkey(tfm, rc4key, klen); |
149 | for (i = 0; i < data_len + WEP_ICV_LEN; i++) | 150 | for (i = 0; i < data_len + IEEE80211_WEP_ICV_LEN; i++) |
150 | crypto_cipher_encrypt_one(tfm, data + i, data + i); | 151 | crypto_cipher_encrypt_one(tfm, data + i, data + i); |
151 | 152 | ||
152 | return 0; | 153 | return 0; |
@@ -172,7 +173,7 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local, | |||
172 | if (!iv) | 173 | if (!iv) |
173 | return -1; | 174 | return -1; |
174 | 175 | ||
175 | len = skb->len - (iv + WEP_IV_LEN - skb->data); | 176 | len = skb->len - (iv + IEEE80211_WEP_IV_LEN - skb->data); |
176 | 177 | ||
177 | /* Prepend 24-bit IV to RC4 key */ | 178 | /* Prepend 24-bit IV to RC4 key */ |
178 | memcpy(rc4key, iv, 3); | 179 | memcpy(rc4key, iv, 3); |
@@ -181,10 +182,10 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local, | |||
181 | memcpy(rc4key + 3, key, keylen); | 182 | memcpy(rc4key + 3, key, keylen); |
182 | 183 | ||
183 | /* Add room for ICV */ | 184 | /* Add room for ICV */ |
184 | skb_put(skb, WEP_ICV_LEN); | 185 | skb_put(skb, IEEE80211_WEP_ICV_LEN); |
185 | 186 | ||
186 | return ieee80211_wep_encrypt_data(local->wep_tx_tfm, rc4key, keylen + 3, | 187 | return ieee80211_wep_encrypt_data(local->wep_tx_tfm, rc4key, keylen + 3, |
187 | iv + WEP_IV_LEN, len); | 188 | iv + IEEE80211_WEP_IV_LEN, len); |
188 | } | 189 | } |
189 | 190 | ||
190 | 191 | ||
@@ -201,11 +202,11 @@ int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, | |||
201 | return -1; | 202 | return -1; |
202 | 203 | ||
203 | crypto_cipher_setkey(tfm, rc4key, klen); | 204 | crypto_cipher_setkey(tfm, rc4key, klen); |
204 | for (i = 0; i < data_len + WEP_ICV_LEN; i++) | 205 | for (i = 0; i < data_len + IEEE80211_WEP_ICV_LEN; i++) |
205 | crypto_cipher_decrypt_one(tfm, data + i, data + i); | 206 | crypto_cipher_decrypt_one(tfm, data + i, data + i); |
206 | 207 | ||
207 | crc = cpu_to_le32(~crc32_le(~0, data, data_len)); | 208 | crc = cpu_to_le32(~crc32_le(~0, data, data_len)); |
208 | if (memcmp(&crc, data + data_len, WEP_ICV_LEN) != 0) | 209 | if (memcmp(&crc, data + data_len, IEEE80211_WEP_ICV_LEN) != 0) |
209 | /* ICV mismatch */ | 210 | /* ICV mismatch */ |
210 | return -1; | 211 | return -1; |
211 | 212 | ||
@@ -237,10 +238,10 @@ static int ieee80211_wep_decrypt(struct ieee80211_local *local, | |||
237 | return -1; | 238 | return -1; |
238 | 239 | ||
239 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 240 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
240 | if (skb->len < hdrlen + WEP_IV_LEN + WEP_ICV_LEN) | 241 | if (skb->len < hdrlen + IEEE80211_WEP_IV_LEN + IEEE80211_WEP_ICV_LEN) |
241 | return -1; | 242 | return -1; |
242 | 243 | ||
243 | len = skb->len - hdrlen - WEP_IV_LEN - WEP_ICV_LEN; | 244 | len = skb->len - hdrlen - IEEE80211_WEP_IV_LEN - IEEE80211_WEP_ICV_LEN; |
244 | 245 | ||
245 | keyidx = skb->data[hdrlen + 3] >> 6; | 246 | keyidx = skb->data[hdrlen + 3] >> 6; |
246 | 247 | ||
@@ -256,16 +257,16 @@ static int ieee80211_wep_decrypt(struct ieee80211_local *local, | |||
256 | memcpy(rc4key + 3, key->conf.key, key->conf.keylen); | 257 | memcpy(rc4key + 3, key->conf.key, key->conf.keylen); |
257 | 258 | ||
258 | if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen, | 259 | if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen, |
259 | skb->data + hdrlen + WEP_IV_LEN, | 260 | skb->data + hdrlen + |
260 | len)) | 261 | IEEE80211_WEP_IV_LEN, len)) |
261 | ret = -1; | 262 | ret = -1; |
262 | 263 | ||
263 | /* Trim ICV */ | 264 | /* Trim ICV */ |
264 | skb_trim(skb, skb->len - WEP_ICV_LEN); | 265 | skb_trim(skb, skb->len - IEEE80211_WEP_ICV_LEN); |
265 | 266 | ||
266 | /* Remove IV */ | 267 | /* Remove IV */ |
267 | memmove(skb->data + WEP_IV_LEN, skb->data, hdrlen); | 268 | memmove(skb->data + IEEE80211_WEP_IV_LEN, skb->data, hdrlen); |
268 | skb_pull(skb, WEP_IV_LEN); | 269 | skb_pull(skb, IEEE80211_WEP_IV_LEN); |
269 | 270 | ||
270 | return ret; | 271 | return ret; |
271 | } | 272 | } |
@@ -305,13 +306,14 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx) | |||
305 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) | 306 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) |
306 | return RX_DROP_UNUSABLE; | 307 | return RX_DROP_UNUSABLE; |
307 | } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) { | 308 | } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) { |
308 | if (!pskb_may_pull(rx->skb, ieee80211_hdrlen(fc) + WEP_IV_LEN)) | 309 | if (!pskb_may_pull(rx->skb, ieee80211_hdrlen(fc) + |
310 | IEEE80211_WEP_IV_LEN)) | ||
309 | return RX_DROP_UNUSABLE; | 311 | return RX_DROP_UNUSABLE; |
310 | if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key)) | 312 | if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key)) |
311 | rx->sta->wep_weak_iv_count++; | 313 | rx->sta->wep_weak_iv_count++; |
312 | ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); | 314 | ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); |
313 | /* remove ICV */ | 315 | /* remove ICV */ |
314 | if (pskb_trim(rx->skb, rx->skb->len - WEP_ICV_LEN)) | 316 | if (pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN)) |
315 | return RX_DROP_UNUSABLE; | 317 | return RX_DROP_UNUSABLE; |
316 | } | 318 | } |
317 | 319 | ||
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index c7c6d644486f..c9edfcb7a13b 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -62,10 +62,10 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) | |||
62 | 62 | ||
63 | tail = MICHAEL_MIC_LEN; | 63 | tail = MICHAEL_MIC_LEN; |
64 | if (!info->control.hw_key) | 64 | if (!info->control.hw_key) |
65 | tail += TKIP_ICV_LEN; | 65 | tail += IEEE80211_TKIP_ICV_LEN; |
66 | 66 | ||
67 | if (WARN_ON(skb_tailroom(skb) < tail || | 67 | if (WARN_ON(skb_tailroom(skb) < tail || |
68 | skb_headroom(skb) < TKIP_IV_LEN)) | 68 | skb_headroom(skb) < IEEE80211_TKIP_IV_LEN)) |
69 | return TX_DROP; | 69 | return TX_DROP; |
70 | 70 | ||
71 | key = &tx->key->conf.key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY]; | 71 | key = &tx->key->conf.key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY]; |
@@ -198,15 +198,16 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
198 | if (info->control.hw_key) | 198 | if (info->control.hw_key) |
199 | tail = 0; | 199 | tail = 0; |
200 | else | 200 | else |
201 | tail = TKIP_ICV_LEN; | 201 | tail = IEEE80211_TKIP_ICV_LEN; |
202 | 202 | ||
203 | if (WARN_ON(skb_tailroom(skb) < tail || | 203 | if (WARN_ON(skb_tailroom(skb) < tail || |
204 | skb_headroom(skb) < TKIP_IV_LEN)) | 204 | skb_headroom(skb) < IEEE80211_TKIP_IV_LEN)) |
205 | return -1; | 205 | return -1; |
206 | 206 | ||
207 | pos = skb_push(skb, TKIP_IV_LEN); | 207 | pos = skb_push(skb, IEEE80211_TKIP_IV_LEN); |
208 | memmove(pos, pos + TKIP_IV_LEN, hdrlen); | 208 | memmove(pos, pos + IEEE80211_TKIP_IV_LEN, hdrlen); |
209 | skb_set_network_header(skb, skb_network_offset(skb) + TKIP_IV_LEN); | 209 | skb_set_network_header(skb, skb_network_offset(skb) + |
210 | IEEE80211_TKIP_IV_LEN); | ||
210 | pos += hdrlen; | 211 | pos += hdrlen; |
211 | 212 | ||
212 | /* the HW only needs room for the IV, but not the actual IV */ | 213 | /* the HW only needs room for the IV, but not the actual IV */ |
@@ -227,7 +228,7 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
227 | return 0; | 228 | return 0; |
228 | 229 | ||
229 | /* Add room for ICV */ | 230 | /* Add room for ICV */ |
230 | skb_put(skb, TKIP_ICV_LEN); | 231 | skb_put(skb, IEEE80211_TKIP_ICV_LEN); |
231 | 232 | ||
232 | return ieee80211_tkip_encrypt_data(tx->local->wep_tx_tfm, | 233 | return ieee80211_tkip_encrypt_data(tx->local->wep_tx_tfm, |
233 | key, skb, pos, len); | 234 | key, skb, pos, len); |
@@ -290,11 +291,11 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) | |||
290 | return RX_DROP_UNUSABLE; | 291 | return RX_DROP_UNUSABLE; |
291 | 292 | ||
292 | /* Trim ICV */ | 293 | /* Trim ICV */ |
293 | skb_trim(skb, skb->len - TKIP_ICV_LEN); | 294 | skb_trim(skb, skb->len - IEEE80211_TKIP_ICV_LEN); |
294 | 295 | ||
295 | /* Remove IV */ | 296 | /* Remove IV */ |
296 | memmove(skb->data + TKIP_IV_LEN, skb->data, hdrlen); | 297 | memmove(skb->data + IEEE80211_TKIP_IV_LEN, skb->data, hdrlen); |
297 | skb_pull(skb, TKIP_IV_LEN); | 298 | skb_pull(skb, IEEE80211_TKIP_IV_LEN); |
298 | 299 | ||
299 | return RX_CONTINUE; | 300 | return RX_CONTINUE; |
300 | } | 301 | } |
@@ -337,9 +338,9 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch, | |||
337 | else | 338 | else |
338 | qos_tid = 0; | 339 | qos_tid = 0; |
339 | 340 | ||
340 | data_len = skb->len - hdrlen - CCMP_HDR_LEN; | 341 | data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN; |
341 | if (encrypted) | 342 | if (encrypted) |
342 | data_len -= CCMP_MIC_LEN; | 343 | data_len -= IEEE80211_CCMP_MIC_LEN; |
343 | 344 | ||
344 | /* First block, b_0 */ | 345 | /* First block, b_0 */ |
345 | b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */ | 346 | b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */ |
@@ -348,7 +349,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch, | |||
348 | */ | 349 | */ |
349 | b_0[1] = qos_tid | (mgmt << 4); | 350 | b_0[1] = qos_tid | (mgmt << 4); |
350 | memcpy(&b_0[2], hdr->addr2, ETH_ALEN); | 351 | memcpy(&b_0[2], hdr->addr2, ETH_ALEN); |
351 | memcpy(&b_0[8], pn, CCMP_PN_LEN); | 352 | memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN); |
352 | /* l(m) */ | 353 | /* l(m) */ |
353 | put_unaligned_be16(data_len, &b_0[14]); | 354 | put_unaligned_be16(data_len, &b_0[14]); |
354 | 355 | ||
@@ -424,15 +425,16 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
424 | if (info->control.hw_key) | 425 | if (info->control.hw_key) |
425 | tail = 0; | 426 | tail = 0; |
426 | else | 427 | else |
427 | tail = CCMP_MIC_LEN; | 428 | tail = IEEE80211_CCMP_MIC_LEN; |
428 | 429 | ||
429 | if (WARN_ON(skb_tailroom(skb) < tail || | 430 | if (WARN_ON(skb_tailroom(skb) < tail || |
430 | skb_headroom(skb) < CCMP_HDR_LEN)) | 431 | skb_headroom(skb) < IEEE80211_CCMP_HDR_LEN)) |
431 | return -1; | 432 | return -1; |
432 | 433 | ||
433 | pos = skb_push(skb, CCMP_HDR_LEN); | 434 | pos = skb_push(skb, IEEE80211_CCMP_HDR_LEN); |
434 | memmove(pos, pos + CCMP_HDR_LEN, hdrlen); | 435 | memmove(pos, pos + IEEE80211_CCMP_HDR_LEN, hdrlen); |
435 | skb_set_network_header(skb, skb_network_offset(skb) + CCMP_HDR_LEN); | 436 | skb_set_network_header(skb, skb_network_offset(skb) + |
437 | IEEE80211_CCMP_HDR_LEN); | ||
436 | 438 | ||
437 | /* the HW only needs room for the IV, but not the actual IV */ | 439 | /* the HW only needs room for the IV, but not the actual IV */ |
438 | if (info->control.hw_key && | 440 | if (info->control.hw_key && |
@@ -457,10 +459,10 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) | |||
457 | if (info->control.hw_key) | 459 | if (info->control.hw_key) |
458 | return 0; | 460 | return 0; |
459 | 461 | ||
460 | pos += CCMP_HDR_LEN; | 462 | pos += IEEE80211_CCMP_HDR_LEN; |
461 | ccmp_special_blocks(skb, pn, scratch, 0); | 463 | ccmp_special_blocks(skb, pn, scratch, 0); |
462 | ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len, | 464 | ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len, |
463 | pos, skb_put(skb, CCMP_MIC_LEN)); | 465 | pos, skb_put(skb, IEEE80211_CCMP_MIC_LEN)); |
464 | 466 | ||
465 | return 0; | 467 | return 0; |
466 | } | 468 | } |
@@ -490,7 +492,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
490 | struct ieee80211_key *key = rx->key; | 492 | struct ieee80211_key *key = rx->key; |
491 | struct sk_buff *skb = rx->skb; | 493 | struct sk_buff *skb = rx->skb; |
492 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 494 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
493 | u8 pn[CCMP_PN_LEN]; | 495 | u8 pn[IEEE80211_CCMP_PN_LEN]; |
494 | int data_len; | 496 | int data_len; |
495 | int queue; | 497 | int queue; |
496 | 498 | ||
@@ -500,12 +502,13 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
500 | !ieee80211_is_robust_mgmt_frame(hdr)) | 502 | !ieee80211_is_robust_mgmt_frame(hdr)) |
501 | return RX_CONTINUE; | 503 | return RX_CONTINUE; |
502 | 504 | ||
503 | data_len = skb->len - hdrlen - CCMP_HDR_LEN - CCMP_MIC_LEN; | 505 | data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - |
506 | IEEE80211_CCMP_MIC_LEN; | ||
504 | if (!rx->sta || data_len < 0) | 507 | if (!rx->sta || data_len < 0) |
505 | return RX_DROP_UNUSABLE; | 508 | return RX_DROP_UNUSABLE; |
506 | 509 | ||
507 | if (status->flag & RX_FLAG_DECRYPTED) { | 510 | if (status->flag & RX_FLAG_DECRYPTED) { |
508 | if (!pskb_may_pull(rx->skb, hdrlen + CCMP_HDR_LEN)) | 511 | if (!pskb_may_pull(rx->skb, hdrlen + IEEE80211_CCMP_HDR_LEN)) |
509 | return RX_DROP_UNUSABLE; | 512 | return RX_DROP_UNUSABLE; |
510 | } else { | 513 | } else { |
511 | if (skb_linearize(rx->skb)) | 514 | if (skb_linearize(rx->skb)) |
@@ -516,7 +519,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
516 | 519 | ||
517 | queue = rx->security_idx; | 520 | queue = rx->security_idx; |
518 | 521 | ||
519 | if (memcmp(pn, key->u.ccmp.rx_pn[queue], CCMP_PN_LEN) <= 0) { | 522 | if (memcmp(pn, key->u.ccmp.rx_pn[queue], IEEE80211_CCMP_PN_LEN) <= 0) { |
520 | key->u.ccmp.replays++; | 523 | key->u.ccmp.replays++; |
521 | return RX_DROP_UNUSABLE; | 524 | return RX_DROP_UNUSABLE; |
522 | } | 525 | } |
@@ -528,19 +531,20 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
528 | 531 | ||
529 | if (ieee80211_aes_ccm_decrypt( | 532 | if (ieee80211_aes_ccm_decrypt( |
530 | key->u.ccmp.tfm, scratch, | 533 | key->u.ccmp.tfm, scratch, |
531 | skb->data + hdrlen + CCMP_HDR_LEN, data_len, | 534 | skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN, |
532 | skb->data + skb->len - CCMP_MIC_LEN, | 535 | data_len, |
533 | skb->data + hdrlen + CCMP_HDR_LEN)) | 536 | skb->data + skb->len - IEEE80211_CCMP_MIC_LEN, |
537 | skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN)) | ||
534 | return RX_DROP_UNUSABLE; | 538 | return RX_DROP_UNUSABLE; |
535 | } | 539 | } |
536 | 540 | ||
537 | memcpy(key->u.ccmp.rx_pn[queue], pn, CCMP_PN_LEN); | 541 | memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN); |
538 | 542 | ||
539 | /* Remove CCMP header and MIC */ | 543 | /* Remove CCMP header and MIC */ |
540 | if (pskb_trim(skb, skb->len - CCMP_MIC_LEN)) | 544 | if (pskb_trim(skb, skb->len - IEEE80211_CCMP_MIC_LEN)) |
541 | return RX_DROP_UNUSABLE; | 545 | return RX_DROP_UNUSABLE; |
542 | memmove(skb->data + CCMP_HDR_LEN, skb->data, hdrlen); | 546 | memmove(skb->data + IEEE80211_CCMP_HDR_LEN, skb->data, hdrlen); |
543 | skb_pull(skb, CCMP_HDR_LEN); | 547 | skb_pull(skb, IEEE80211_CCMP_HDR_LEN); |
544 | 548 | ||
545 | return RX_CONTINUE; | 549 | return RX_CONTINUE; |
546 | } | 550 | } |