.. | .. |
---|
976 | 976 | } |
---|
977 | 977 | |
---|
978 | 978 | int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, |
---|
979 | | - int *pairwise_cipher, int *gmcs, u32 *akm, u8 *mfp_opt, u8 *spp_opt) |
---|
| 979 | + int *pairwise_cipher, int *gmcs, u32 *akm, u8 *mfp_opt) |
---|
980 | 980 | { |
---|
981 | 981 | struct rsne_info info; |
---|
982 | 982 | int i, ret = _SUCCESS; |
---|
.. | .. |
---|
1019 | 1019 | *mfp_opt = MFP_NO; |
---|
1020 | 1020 | if (info.cap) |
---|
1021 | 1021 | *mfp_opt = GET_RSN_CAP_MFP_OPTION(info.cap); |
---|
1022 | | - } |
---|
1023 | | - |
---|
1024 | | - if (spp_opt) { |
---|
1025 | | - *spp_opt = 0; |
---|
1026 | | - if (info.cap) |
---|
1027 | | - *spp_opt = GET_RSN_CAP_SPP_OPT(info.cap); |
---|
1028 | 1022 | } |
---|
1029 | 1023 | |
---|
1030 | 1024 | exit: |
---|
.. | .. |
---|
1273 | 1267 | * @wps_ielen: Length limit from wps_ie |
---|
1274 | 1268 | * @target_attr_id: The attribute ID of WPS attribute to search |
---|
1275 | 1269 | * @buf_content: If not NULL and the WPS attribute is found, WPS attribute content will be copied to the buf starting from buf_content |
---|
1276 | | - * If len_content is NULL, only copy one byte. |
---|
1277 | 1270 | * @len_content: If not NULL and the WPS attribute is found, will set to the length of the WPS attribute content |
---|
1278 | 1271 | * |
---|
1279 | 1272 | * Returns: the address of the specific WPS attribute content found, or NULL |
---|
.. | .. |
---|
1283 | 1276 | u8 *attr_ptr; |
---|
1284 | 1277 | u32 attr_len; |
---|
1285 | 1278 | |
---|
| 1279 | + if (len_content) |
---|
| 1280 | + *len_content = 0; |
---|
| 1281 | + |
---|
1286 | 1282 | attr_ptr = rtw_get_wps_attr(wps_ie, wps_ielen, target_attr_id, NULL, &attr_len); |
---|
1287 | 1283 | |
---|
1288 | 1284 | if (attr_ptr && attr_len) { |
---|
1289 | | - if (len_content) { |
---|
1290 | | - if ((buf_content && (*len_content > (attr_len - 4))) || !buf_content) |
---|
1291 | | - *len_content = attr_len - 4; |
---|
1292 | | - } |
---|
| 1285 | + if (buf_content) |
---|
| 1286 | + _rtw_memcpy(buf_content, attr_ptr + 4, attr_len - 4); |
---|
1293 | 1287 | |
---|
1294 | | - if (len_content && buf_content) { |
---|
1295 | | - _rtw_memcpy(buf_content, attr_ptr + 4, *len_content); |
---|
1296 | | - } else if (buf_content) { |
---|
1297 | | - _rtw_memcpy(buf_content, attr_ptr + 4, 1); |
---|
1298 | | - } |
---|
| 1288 | + if (len_content) |
---|
| 1289 | + *len_content = attr_len - 4; |
---|
1299 | 1290 | |
---|
1300 | 1291 | return attr_ptr + 4; |
---|
1301 | 1292 | } |
---|
1302 | | - |
---|
1303 | | - if (len_content) |
---|
1304 | | - *len_content = 0; |
---|
1305 | 1293 | |
---|
1306 | 1294 | return NULL; |
---|
1307 | 1295 | } |
---|
.. | .. |
---|
2326 | 2314 | * @p2p_ielen: Length limit from p2p_ie |
---|
2327 | 2315 | * @target_attr_id: The attribute ID of P2P attribute to search |
---|
2328 | 2316 | * @buf_content: If not NULL and the P2P attribute is found, P2P attribute content will be copied to the buf starting from buf_content |
---|
2329 | | - * If len_content is NULL, only copy one byte. |
---|
2330 | 2317 | * @len_content: If not NULL and the P2P attribute is found, will set to the length of the P2P attribute content |
---|
2331 | 2318 | * |
---|
2332 | 2319 | * Returns: the address of the specific P2P attribute content found, or NULL |
---|
.. | .. |
---|
2336 | 2323 | u8 *attr_ptr; |
---|
2337 | 2324 | u32 attr_len; |
---|
2338 | 2325 | |
---|
| 2326 | + if (len_content) |
---|
| 2327 | + *len_content = 0; |
---|
| 2328 | + |
---|
2339 | 2329 | attr_ptr = rtw_get_p2p_attr(p2p_ie, p2p_ielen, target_attr_id, NULL, &attr_len); |
---|
2340 | 2330 | |
---|
2341 | 2331 | if (attr_ptr && attr_len) { |
---|
2342 | | - if (len_content) { |
---|
2343 | | - if ((buf_content && (*len_content > (attr_len - 3))) || !buf_content) |
---|
2344 | | - *len_content = attr_len - 3; |
---|
2345 | | - } |
---|
| 2332 | + if (buf_content) |
---|
| 2333 | + _rtw_memcpy(buf_content, attr_ptr + 3, attr_len - 3); |
---|
2346 | 2334 | |
---|
2347 | | - if (len_content && buf_content) { |
---|
2348 | | - _rtw_memcpy(buf_content, attr_ptr + 3, *len_content); |
---|
2349 | | - } else if (buf_content) { |
---|
2350 | | - _rtw_memcpy(buf_content, attr_ptr + 3, 1); |
---|
2351 | | - } |
---|
| 2335 | + if (len_content) |
---|
| 2336 | + *len_content = attr_len - 3; |
---|
2352 | 2337 | |
---|
2353 | 2338 | return attr_ptr + 3; |
---|
2354 | 2339 | } |
---|
2355 | | - |
---|
2356 | | - if (len_content) |
---|
2357 | | - *len_content = 0; |
---|
2358 | 2340 | |
---|
2359 | 2341 | return NULL; |
---|
2360 | 2342 | } |
---|
.. | .. |
---|
3180 | 3162 | action = (action >= ACT_PUBLIC_MAX) ? ACT_PUBLIC_MAX : action; |
---|
3181 | 3163 | return _action_public_str[action]; |
---|
3182 | 3164 | } |
---|
3183 | | -/*tmp for sta mode, root cause have to wait supplicant's update.*/ |
---|
3184 | | -void rtw_set_spp_amsdu_mode(u8 mode, u8 *rsn_ie, int rsn_ie_len) |
---|
3185 | | -{ |
---|
3186 | | - struct rsne_info info; |
---|
3187 | | - int i, ret = _SUCCESS; |
---|
3188 | | - u8 spp_req_cap = 0; |
---|
3189 | | - |
---|
3190 | | - if (mode == RTW_AMSDU_MODE_NON_SPP ) { |
---|
3191 | | - spp_req_cap = (u8)(~SPP_CAP | ~SPP_REQ); |
---|
3192 | | - } else if (mode == RTW_AMSDU_MODE_SPP) { |
---|
3193 | | - spp_req_cap = (u8)(SPP_CAP | SPP_REQ); |
---|
3194 | | - } else if (mode == RTW_AMSDU_MODE_ALL_DROP) { |
---|
3195 | | - spp_req_cap = (u8)(~SPP_CAP | SPP_REQ); |
---|
3196 | | - } else { |
---|
3197 | | - RTW_INFO("%s unexpected mode = %d, please check the config\n", __func__, mode); |
---|
3198 | | - return; |
---|
3199 | | - } |
---|
3200 | | - |
---|
3201 | | - ret = rtw_rsne_info_parse(rsn_ie, rsn_ie_len, &info); |
---|
3202 | | - if (ret != _SUCCESS) |
---|
3203 | | - return; |
---|
3204 | | - |
---|
3205 | | - SET_RSN_CAP_SPP(info.cap, spp_req_cap); |
---|
3206 | | - RTW_INFO("%s set spp opt = %d\n", __func__, GET_RSN_CAP_SPP_OPT(info.cap)); |
---|
3207 | | -} |
---|
3208 | | - |
---|
3209 | | -u8 rtw_check_amsdu_disable(u8 mode, u8 spp_opt) |
---|
3210 | | -{ |
---|
3211 | | - u8 ret = _FALSE; |
---|
3212 | | - RTW_INFO("%s spp_opt=%u \n", __func__, spp_opt); |
---|
3213 | | - |
---|
3214 | | - /* pp amsdu: peer's required has to be 0, or disable */ |
---|
3215 | | - if ((mode == RTW_AMSDU_MODE_NON_SPP) && (spp_opt & SPP_REQ)) |
---|
3216 | | - ret = _TRUE; |
---|
3217 | | - /* spp amsdu: peer's cap has to be 1, or disable */ |
---|
3218 | | - else if ((mode == RTW_AMSDU_MODE_SPP) && ~(spp_opt & SPP_CAP)) |
---|
3219 | | - ret = _TRUE; |
---|
3220 | | - /* mode = all drop */ |
---|
3221 | | - else if (mode == RTW_AMSDU_MODE_ALL_DROP) |
---|
3222 | | - ret = _TRUE; |
---|
3223 | | - else |
---|
3224 | | - ret = _FALSE; |
---|
3225 | | - return ret; |
---|
3226 | | -} |
---|
3227 | | - |
---|
3228 | | - |
---|
3229 | 3165 | |
---|