wpa_supplicant-0.7.3-nl80211-cipher-suites.patch 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. From d0f3f451f0002339ad75b43e79f1322f2e2e4ed1 Mon Sep 17 00:00:00 2001
  2. From: Jouni Malinen <jouni.malinen@atheros.com>
  3. Date: Mon, 13 Dec 2010 21:08:53 +0200
  4. Subject: [PATCH] nl80211: Set cipher suites when using user space SME
  5. Previously, pairwise and group cipher suites were configured only
  6. when kernel SME (nl80211 connect API) was used. However, mac80211
  7. needs this information even in the user space SME case for one
  8. thing: to disable HT when TKIP/WEP is used. Add
  9. NL80211_ATTR_CIPHER_SUITES_PAIRWISE to fix this special case with
  10. user space SME. This allows mac80211 to disable HT properly when
  11. the AP is configured with configuration that is not allowed.
  12. (cherry picked from commit aca016054885c17d58c41888698761f2e1ce2b39)
  13. ---
  14. src/drivers/driver_nl80211.c | 44 ++++++++++++++++++++++++++++++++++++++++++
  15. wpa_supplicant/sme.c | 2 +
  16. 2 files changed, 46 insertions(+), 0 deletions(-)
  17. diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
  18. index 364158c..fb75c2e 100644
  19. --- a/src/drivers/driver_nl80211.c
  20. +++ b/src/drivers/driver_nl80211.c
  21. @@ -3940,6 +3940,50 @@ static int wpa_driver_nl80211_associate(
  22. NLA_PUT(msg, NL80211_ATTR_IE, params->wpa_ie_len,
  23. params->wpa_ie);
  24. + if (params->pairwise_suite != CIPHER_NONE) {
  25. + int cipher;
  26. +
  27. + switch (params->pairwise_suite) {
  28. + case CIPHER_WEP40:
  29. + cipher = WLAN_CIPHER_SUITE_WEP40;
  30. + break;
  31. + case CIPHER_WEP104:
  32. + cipher = WLAN_CIPHER_SUITE_WEP104;
  33. + break;
  34. + case CIPHER_CCMP:
  35. + cipher = WLAN_CIPHER_SUITE_CCMP;
  36. + break;
  37. + case CIPHER_TKIP:
  38. + default:
  39. + cipher = WLAN_CIPHER_SUITE_TKIP;
  40. + break;
  41. + }
  42. + wpa_printf(MSG_DEBUG, " * pairwise=0x%x\n", cipher);
  43. + NLA_PUT_U32(msg, NL80211_ATTR_CIPHER_SUITES_PAIRWISE, cipher);
  44. + }
  45. +
  46. + if (params->group_suite != CIPHER_NONE) {
  47. + int cipher;
  48. +
  49. + switch (params->group_suite) {
  50. + case CIPHER_WEP40:
  51. + cipher = WLAN_CIPHER_SUITE_WEP40;
  52. + break;
  53. + case CIPHER_WEP104:
  54. + cipher = WLAN_CIPHER_SUITE_WEP104;
  55. + break;
  56. + case CIPHER_CCMP:
  57. + cipher = WLAN_CIPHER_SUITE_CCMP;
  58. + break;
  59. + case CIPHER_TKIP:
  60. + default:
  61. + cipher = WLAN_CIPHER_SUITE_TKIP;
  62. + break;
  63. + }
  64. + wpa_printf(MSG_DEBUG, " * group=0x%x\n", cipher);
  65. + NLA_PUT_U32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, cipher);
  66. + }
  67. +
  68. #ifdef CONFIG_IEEE80211W
  69. if (params->mgmt_frame_protection == MGMT_FRAME_PROTECTION_REQUIRED)
  70. NLA_PUT_U32(msg, NL80211_ATTR_USE_MFP, NL80211_MFP_REQUIRED);
  71. diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
  72. index 5604e97..878bbf0 100644
  73. --- a/wpa_supplicant/sme.c
  74. +++ b/wpa_supplicant/sme.c
  75. @@ -333,6 +333,8 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
  76. params.wpa_ie = wpa_s->sme.assoc_req_ie_len ?
  77. wpa_s->sme.assoc_req_ie : NULL;
  78. params.wpa_ie_len = wpa_s->sme.assoc_req_ie_len;
  79. + params.pairwise_suite = cipher_suite2driver(wpa_s->pairwise_cipher);
  80. + params.group_suite = cipher_suite2driver(wpa_s->group_cipher);
  81. #ifdef CONFIG_IEEE80211R
  82. if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies) {
  83. params.wpa_ie = wpa_s->sme.ft_ies;
  84. --
  85. 1.7.4-rc1