diff options
author | Florian Schilhabel <florian.c.schilhabel@googlemail.com> | 2010-07-15 13:04:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-22 15:00:22 -0400 |
commit | 242f5a709c2fb8ee47f708d6066e350ebdbc0b23 (patch) | |
tree | 4b77746261a16e0c57dc7a0ba381489828f0dfb9 /drivers/staging | |
parent | 53faa56b78f1929d3e9d339b8c21541bd355b4eb (diff) |
staging: rtl8192su: added ioctl[SIOCSIWPMKSA] implementation
errors like:
ioctl[SIOCSIWPMKSA]: Invalid argument
should now be gone.
Signed-off-by: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/rtl8192su/ieee80211/ieee80211.h | 14 | ||||
-rw-r--r-- | drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c | 43 | ||||
-rw-r--r-- | drivers/staging/rtl8192su/r8192U_wx.c | 66 |
3 files changed, 122 insertions, 1 deletions
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211.h b/drivers/staging/rtl8192su/ieee80211/ieee80211.h index 1c14adbfb98..1d6789db4e4 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211.h | |||
@@ -1132,6 +1132,19 @@ enum { | |||
1132 | COUNTRY_CODE_MAX | 1132 | COUNTRY_CODE_MAX |
1133 | }; | 1133 | }; |
1134 | 1134 | ||
1135 | #define NUM_PMKID_CACHE 16 | ||
1136 | |||
1137 | typedef struct _RT_PMKID_LIST | ||
1138 | { | ||
1139 | u8 bUsed; | ||
1140 | u8 Bssid[6]; | ||
1141 | u8 PMKID[16]; | ||
1142 | u8 SsidBuf[33]; | ||
1143 | u8* ssid_octet; | ||
1144 | u16 ssid_length; | ||
1145 | } RT_PMKID_LIST, *PRT_PMKID_LIST; | ||
1146 | |||
1147 | |||
1135 | #include "ieee80211_r8192s.h" | 1148 | #include "ieee80211_r8192s.h" |
1136 | 1149 | ||
1137 | struct ieee80211_device { | 1150 | struct ieee80211_device { |
@@ -1255,6 +1268,7 @@ struct ieee80211_device { | |||
1255 | int bcrx_sta_key; /* use individual keys to override default keys even | 1268 | int bcrx_sta_key; /* use individual keys to override default keys even |
1256 | * with RX of broad/multicast frames */ | 1269 | * with RX of broad/multicast frames */ |
1257 | 1270 | ||
1271 | RT_PMKID_LIST PMKIDList[NUM_PMKID_CACHE]; | ||
1258 | /* Fragmentation structures */ | 1272 | /* Fragmentation structures */ |
1259 | // each streaming contain a entry | 1273 | // each streaming contain a entry |
1260 | struct ieee80211_frag_entry frag_cache[17][IEEE80211_FRAG_CACHE_LEN]; | 1274 | struct ieee80211_frag_entry frag_cache[17][IEEE80211_FRAG_CACHE_LEN]; |
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c index 2e2f6a0c8f2..02850479dd6 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c | |||
@@ -1042,6 +1042,33 @@ void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest) | |||
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | 1044 | ||
1045 | inline int SecIsInPMKIDList(struct ieee80211_device *ieee, u8 *bssid) | ||
1046 | { | ||
1047 | int i = 0; | ||
1048 | |||
1049 | do | ||
1050 | { | ||
1051 | if ((ieee->PMKIDList[i].bUsed) && (memcmp(ieee->PMKIDList[i].Bssid, bssid, ETH_ALEN) == 0)) | ||
1052 | { | ||
1053 | break; | ||
1054 | } | ||
1055 | else | ||
1056 | { | ||
1057 | i++; | ||
1058 | } | ||
1059 | } while (i < NUM_PMKID_CACHE); | ||
1060 | |||
1061 | if (i == NUM_PMKID_CACHE) | ||
1062 | { | ||
1063 | i = -1; | ||
1064 | } | ||
1065 | else | ||
1066 | { | ||
1067 | } | ||
1068 | |||
1069 | return (i); | ||
1070 | |||
1071 | } | ||
1045 | inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee) | 1072 | inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee) |
1046 | { | 1073 | { |
1047 | struct sk_buff *skb; | 1074 | struct sk_buff *skb; |
@@ -1058,6 +1085,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco | |||
1058 | unsigned int cxvernum_ie_len=0; | 1085 | unsigned int cxvernum_ie_len=0; |
1059 | struct ieee80211_crypt_data* crypt; | 1086 | struct ieee80211_crypt_data* crypt; |
1060 | int encrypt; | 1087 | int encrypt; |
1088 | int PMKCacheIdx; | ||
1061 | 1089 | ||
1062 | unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); | 1090 | unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); |
1063 | unsigned int wmm_info_len = beacon->qos_data.supported?9:0; | 1091 | unsigned int wmm_info_len = beacon->qos_data.supported?9:0; |
@@ -1099,6 +1127,14 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco | |||
1099 | { | 1127 | { |
1100 | cxvernum_ie_len = 5+2; | 1128 | cxvernum_ie_len = 5+2; |
1101 | } | 1129 | } |
1130 | |||
1131 | PMKCacheIdx = SecIsInPMKIDList(ieee, ieee->current_network.bssid); | ||
1132 | if (PMKCacheIdx >= 0) | ||
1133 | { | ||
1134 | wpa_ie_len += 18; | ||
1135 | printk("[PMK cache]: WPA2 IE length: %x\n", wpa_ie_len); | ||
1136 | } | ||
1137 | |||
1102 | len = sizeof(struct ieee80211_assoc_request_frame)+ 2 | 1138 | len = sizeof(struct ieee80211_assoc_request_frame)+ 2 |
1103 | + beacon->ssid_len//essid tagged val | 1139 | + beacon->ssid_len//essid tagged val |
1104 | + rate_len//rates tagged val | 1140 | + rate_len//rates tagged val |
@@ -1226,6 +1262,13 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco | |||
1226 | tag = skb_put(skb, wpa_ie_len); | 1262 | tag = skb_put(skb, wpa_ie_len); |
1227 | if (wpa_ie_len){ | 1263 | if (wpa_ie_len){ |
1228 | memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); | 1264 | memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); |
1265 | if (PMKCacheIdx >= 0) | ||
1266 | { | ||
1267 | tag = skb_put(skb, 18); | ||
1268 | *tag = 1; | ||
1269 | *(tag + 1) = 0; | ||
1270 | memcpy((tag + 2), &ieee->PMKIDList[PMKCacheIdx].PMKID, 16); | ||
1271 | } | ||
1229 | } | 1272 | } |
1230 | 1273 | ||
1231 | tag = skb_put(skb,wmm_info_len); | 1274 | tag = skb_put(skb,wmm_info_len); |
diff --git a/drivers/staging/rtl8192su/r8192U_wx.c b/drivers/staging/rtl8192su/r8192U_wx.c index 917578078b3..2005b811eba 100644 --- a/drivers/staging/rtl8192su/r8192U_wx.c +++ b/drivers/staging/rtl8192su/r8192U_wx.c | |||
@@ -1013,6 +1013,70 @@ static int r8192_wx_set_mlme(struct net_device *dev, | |||
1013 | return ret; | 1013 | return ret; |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | static int r8192_wx_set_pmkid(struct net_device *dev, | ||
1017 | struct iw_request_info *info, | ||
1018 | union iwreq_data *wrqu, char *extra) | ||
1019 | { | ||
1020 | int i; | ||
1021 | struct r8192_priv *priv = ieee80211_priv(dev); | ||
1022 | struct ieee80211_device* ieee = priv->ieee80211; | ||
1023 | struct iw_pmksa* pPMK = (struct iw_pmksa*)extra; | ||
1024 | int intReturn = false; | ||
1025 | |||
1026 | switch (pPMK->cmd) | ||
1027 | { | ||
1028 | case IW_PMKSA_ADD: | ||
1029 | for (i = 0; i < NUM_PMKID_CACHE; i++) | ||
1030 | { | ||
1031 | if (memcmp(ieee->PMKIDList[i].Bssid, pPMK->bssid.sa_data, ETH_ALEN) == 0) | ||
1032 | { | ||
1033 | memcpy(ieee->PMKIDList[i].PMKID, pPMK->pmkid, IW_PMKID_LEN); | ||
1034 | memcpy(ieee->PMKIDList[i].Bssid, pPMK->bssid.sa_data, ETH_ALEN); | ||
1035 | ieee->PMKIDList[i].bUsed = true; | ||
1036 | intReturn = true; | ||
1037 | goto __EXIT__; | ||
1038 | } | ||
1039 | } | ||
1040 | |||
1041 | for (i = 0; i < NUM_PMKID_CACHE; i++) | ||
1042 | { | ||
1043 | if (ieee->PMKIDList[i].bUsed == false) | ||
1044 | { | ||
1045 | memcpy(ieee->PMKIDList[i].PMKID, pPMK->pmkid, IW_PMKID_LEN); | ||
1046 | memcpy(ieee->PMKIDList[i].Bssid, pPMK->bssid.sa_data, ETH_ALEN); | ||
1047 | ieee->PMKIDList[i].bUsed = true; | ||
1048 | intReturn = true; | ||
1049 | goto __EXIT__; | ||
1050 | } | ||
1051 | } | ||
1052 | break; | ||
1053 | |||
1054 | case IW_PMKSA_REMOVE: | ||
1055 | for (i = 0; i < NUM_PMKID_CACHE; i++) | ||
1056 | { | ||
1057 | if (memcmp(ieee->PMKIDList[i].Bssid, pPMK->bssid.sa_data, ETH_ALEN) == true) | ||
1058 | { | ||
1059 | memset(&ieee->PMKIDList[i], 0x00, sizeof(RT_PMKID_LIST)); | ||
1060 | intReturn = true; | ||
1061 | break; | ||
1062 | } | ||
1063 | } | ||
1064 | break; | ||
1065 | |||
1066 | case IW_PMKSA_FLUSH: | ||
1067 | memset(&ieee->PMKIDList[0], 0x00, (sizeof(RT_PMKID_LIST) * NUM_PMKID_CACHE)); | ||
1068 | intReturn = true; | ||
1069 | break; | ||
1070 | |||
1071 | default: | ||
1072 | break; | ||
1073 | } | ||
1074 | |||
1075 | __EXIT__: | ||
1076 | return (intReturn); | ||
1077 | |||
1078 | } | ||
1079 | |||
1016 | static int r8192_wx_set_gen_ie(struct net_device *dev, | 1080 | static int r8192_wx_set_gen_ie(struct net_device *dev, |
1017 | struct iw_request_info *info, | 1081 | struct iw_request_info *info, |
1018 | union iwreq_data *data, char *extra) | 1082 | union iwreq_data *data, char *extra) |
@@ -1095,7 +1159,7 @@ static iw_handler r8192_wx_handlers[] = | |||
1095 | NULL,//r8192_wx_get_auth,//NULL, /* SIOCSIWAUTH */ | 1159 | NULL,//r8192_wx_get_auth,//NULL, /* SIOCSIWAUTH */ |
1096 | r8192_wx_set_enc_ext, /* SIOCSIWENCODEEXT */ | 1160 | r8192_wx_set_enc_ext, /* SIOCSIWENCODEEXT */ |
1097 | NULL,//r8192_wx_get_enc_ext,//NULL, /* SIOCSIWENCODEEXT */ | 1161 | NULL,//r8192_wx_get_enc_ext,//NULL, /* SIOCSIWENCODEEXT */ |
1098 | NULL, /* SIOCSIWPMKSA */ | 1162 | r8192_wx_set_pmkid, /* SIOCSIWPMKSA */ |
1099 | NULL, /*---hole---*/ | 1163 | NULL, /*---hole---*/ |
1100 | 1164 | ||
1101 | }; | 1165 | }; |