blob: 4b51c0ac27ac1b7ef27105aa16c379b6d0d42cdc [file] [log] [blame]
Johnny Kimc5c77ba2015-05-11 14:30:56 +09001#include "coreconfigurator.h"
Chaehyun Limdd322572015-09-22 22:47:43 +09002#include "wilc_wlan_if.h"
Glen Lee1028e5a2015-10-01 16:03:40 +09003#include "wilc_wlan.h"
Leo Kim24db7132015-09-16 18:36:01 +09004#include <linux/errno.h>
Chaehyun Lime215a872015-09-30 08:15:41 +09005#include <linux/slab.h>
Johnny Kimc5c77ba2015-05-11 14:30:56 +09006#define TAG_PARAM_OFFSET (MAC_HDR_LEN + TIME_STAMP_LEN + \
Leo Kime0990c12016-02-04 18:24:31 +09007 BEACON_INTERVAL_LEN + CAP_INFO_LEN)
Johnny Kimc5c77ba2015-05-11 14:30:56 +09008
Tony Cho9dd2f772015-10-02 14:22:03 +09009enum basic_frame_type {
Stanislav Kholmanskikh13994d12015-06-10 21:57:26 +030010 FRAME_TYPE_CONTROL = 0x04,
11 FRAME_TYPE_DATA = 0x08,
12 FRAME_TYPE_MANAGEMENT = 0x00,
13 FRAME_TYPE_RESERVED = 0x0C,
14 FRAME_TYPE_FORCE_32BIT = 0xFFFFFFFF
Tony Cho9dd2f772015-10-02 14:22:03 +090015};
Johnny Kimc5c77ba2015-05-11 14:30:56 +090016
Tony Cho9dd2f772015-10-02 14:22:03 +090017enum sub_frame_type {
Johnny Kimc5c77ba2015-05-11 14:30:56 +090018 ASSOC_REQ = 0x00,
19 ASSOC_RSP = 0x10,
20 REASSOC_REQ = 0x20,
21 REASSOC_RSP = 0x30,
22 PROBE_REQ = 0x40,
23 PROBE_RSP = 0x50,
24 BEACON = 0x80,
25 ATIM = 0x90,
26 DISASOC = 0xA0,
27 AUTH = 0xB0,
28 DEAUTH = 0xC0,
29 ACTION = 0xD0,
30 PS_POLL = 0xA4,
31 RTS = 0xB4,
32 CTS = 0xC4,
33 ACK = 0xD4,
34 CFEND = 0xE4,
35 CFEND_ACK = 0xF4,
36 DATA = 0x08,
37 DATA_ACK = 0x18,
38 DATA_POLL = 0x28,
39 DATA_POLL_ACK = 0x38,
40 NULL_FRAME = 0x48,
41 CFACK = 0x58,
42 CFPOLL = 0x68,
43 CFPOLL_ACK = 0x78,
44 QOS_DATA = 0x88,
45 QOS_DATA_ACK = 0x98,
46 QOS_DATA_POLL = 0xA8,
47 QOS_DATA_POLL_ACK = 0xB8,
48 QOS_NULL_FRAME = 0xC8,
49 QOS_CFPOLL = 0xE8,
50 QOS_CFPOLL_ACK = 0xF8,
51 BLOCKACK_REQ = 0x84,
52 BLOCKACK = 0x94,
53 FRAME_SUBTYPE_FORCE_32BIT = 0xFFFFFFFF
Tony Cho9dd2f772015-10-02 14:22:03 +090054};
Johnny Kimc5c77ba2015-05-11 14:30:56 +090055
Tony Cho9dd2f772015-10-02 14:22:03 +090056enum info_element_id {
Johnny Kimc5c77ba2015-05-11 14:30:56 +090057 ISSID = 0, /* Service Set Identifier */
58 ISUPRATES = 1, /* Supported Rates */
59 IFHPARMS = 2, /* FH parameter set */
60 IDSPARMS = 3, /* DS parameter set */
61 ICFPARMS = 4, /* CF parameter set */
62 ITIM = 5, /* Traffic Information Map */
63 IIBPARMS = 6, /* IBSS parameter set */
64 ICOUNTRY = 7, /* Country element */
65 IEDCAPARAMS = 12, /* EDCA parameter set */
66 ITSPEC = 13, /* Traffic Specification */
67 ITCLAS = 14, /* Traffic Classification */
68 ISCHED = 15, /* Schedule */
69 ICTEXT = 16, /* Challenge Text */
70 IPOWERCONSTRAINT = 32, /* Power Constraint */
71 IPOWERCAPABILITY = 33, /* Power Capability */
72 ITPCREQUEST = 34, /* TPC Request */
73 ITPCREPORT = 35, /* TPC Report */
74 ISUPCHANNEL = 36, /* Supported channel list */
75 ICHSWANNOUNC = 37, /* Channel Switch Announcement */
76 IMEASUREMENTREQUEST = 38, /* Measurement request */
77 IMEASUREMENTREPORT = 39, /* Measurement report */
78 IQUIET = 40, /* Quiet element Info */
79 IIBSSDFS = 41, /* IBSS DFS */
80 IERPINFO = 42, /* ERP Information */
81 ITSDELAY = 43, /* TS Delay */
82 ITCLASPROCESS = 44, /* TCLAS Processing */
83 IHTCAP = 45, /* HT Capabilities */
84 IQOSCAP = 46, /* QoS Capability */
85 IRSNELEMENT = 48, /* RSN Information Element */
86 IEXSUPRATES = 50, /* Extended Supported Rates */
87 IEXCHSWANNOUNC = 60, /* Extended Ch Switch Announcement*/
88 IHTOPERATION = 61, /* HT Information */
89 ISECCHOFF = 62, /* Secondary Channel Offeset */
90 I2040COEX = 72, /* 20/40 Coexistence IE */
91 I2040INTOLCHREPORT = 73, /* 20/40 Intolerant channel report*/
92 IOBSSSCAN = 74, /* OBSS Scan parameters */
93 IEXTCAP = 127, /* Extended capability */
94 IWMM = 221, /* WMM parameters */
95 IWPAELEMENT = 221, /* WPA Information Element */
96 INFOELEM_ID_FORCE_32BIT = 0xFFFFFFFF
Tony Cho9dd2f772015-10-02 14:22:03 +090097};
Johnny Kimc5c77ba2015-05-11 14:30:56 +090098
Chaehyun Lim9af382b2015-09-16 20:11:27 +090099static inline u16 get_beacon_period(u8 *data)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900100{
Amitoj Kaur Chawlab5c84cd2015-10-15 13:49:47 +0530101 u16 bcn_per;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900102
103 bcn_per = data[0];
104 bcn_per |= (data[1] << 8);
105
106 return bcn_per;
107}
108
Chaehyun Lim9af382b2015-09-16 20:11:27 +0900109static inline u32 get_beacon_timestamp_lo(u8 *data)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900110{
Chaehyun Lim4e4467f2015-06-11 14:35:55 +0900111 u32 time_stamp = 0;
112 u32 index = MAC_HDR_LEN;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900113
114 time_stamp |= data[index++];
115 time_stamp |= (data[index++] << 8);
116 time_stamp |= (data[index++] << 16);
117 time_stamp |= (data[index] << 24);
118
119 return time_stamp;
120}
121
Chaehyun Lim9af382b2015-09-16 20:11:27 +0900122static inline u32 get_beacon_timestamp_hi(u8 *data)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900123{
Chaehyun Lim8a54d912015-06-11 14:35:53 +0900124 u32 time_stamp = 0;
125 u32 index = (MAC_HDR_LEN + 4);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900126
127 time_stamp |= data[index++];
128 time_stamp |= (data[index++] << 8);
129 time_stamp |= (data[index++] << 16);
130 time_stamp |= (data[index] << 24);
131
132 return time_stamp;
133}
134
Tony Cho9dd2f772015-10-02 14:22:03 +0900135static inline enum sub_frame_type get_sub_type(u8 *header)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900136{
Tony Cho9dd2f772015-10-02 14:22:03 +0900137 return ((enum sub_frame_type)(header[0] & 0xFC));
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900138}
139
Chaehyun Lim9af382b2015-09-16 20:11:27 +0900140static inline u8 get_to_ds(u8 *header)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900141{
142 return (header[1] & 0x01);
143}
144
Chaehyun Lim9af382b2015-09-16 20:11:27 +0900145static inline u8 get_from_ds(u8 *header)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900146{
147 return ((header[1] & 0x02) >> 1);
148}
149
Glen Leeb57f9f32015-11-05 18:51:23 +0900150static inline void get_address1(u8 *pu8msa, u8 *addr)
151{
152 memcpy(addr, pu8msa + 4, 6);
153}
154
Glen Leeb57f9f32015-11-05 18:51:23 +0900155static inline void get_address2(u8 *pu8msa, u8 *addr)
156{
157 memcpy(addr, pu8msa + 10, 6);
158}
159
Glen Leeb57f9f32015-11-05 18:51:23 +0900160static inline void get_address3(u8 *pu8msa, u8 *addr)
161{
162 memcpy(addr, pu8msa + 16, 6);
163}
164
Chaehyun Lim9af382b2015-09-16 20:11:27 +0900165static inline void get_BSSID(u8 *data, u8 *bssid)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900166{
167 if (get_from_ds(data) == 1)
Glen Leeb57f9f32015-11-05 18:51:23 +0900168 get_address2(data, bssid);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900169 else if (get_to_ds(data) == 1)
Glen Leeb57f9f32015-11-05 18:51:23 +0900170 get_address1(data, bssid);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900171 else
Glen Leeb57f9f32015-11-05 18:51:23 +0900172 get_address3(data, bssid);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900173}
174
Chaehyun Lim9af382b2015-09-16 20:11:27 +0900175static inline void get_ssid(u8 *data, u8 *ssid, u8 *p_ssid_len)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900176{
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900177 u8 len = 0;
178 u8 i = 0;
179 u8 j = 0;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900180
Chaehyun Lim79024512016-03-03 21:05:17 +0900181 len = data[TAG_PARAM_OFFSET + 1];
182 j = TAG_PARAM_OFFSET + 2;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900183
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900184 if (len >= MAX_SSID_LEN)
185 len = 0;
186
187 for (i = 0; i < len; i++, j++)
188 ssid[i] = data[j];
189
190 ssid[len] = '\0';
191
192 *p_ssid_len = len;
193}
194
Chaehyun Lim9af382b2015-09-16 20:11:27 +0900195static inline u16 get_cap_info(u8 *data)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900196{
Chaehyun Limd85f5322015-06-11 14:35:54 +0900197 u16 cap_info = 0;
198 u16 index = MAC_HDR_LEN;
Tony Cho9dd2f772015-10-02 14:22:03 +0900199 enum sub_frame_type st;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900200
201 st = get_sub_type(data);
202
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900203 if ((st == BEACON) || (st == PROBE_RSP))
204 index += TIME_STAMP_LEN + BEACON_INTERVAL_LEN;
205
206 cap_info = data[index];
207 cap_info |= (data[index + 1] << 8);
208
209 return cap_info;
210}
211
Chaehyun Lim9af382b2015-09-16 20:11:27 +0900212static inline u16 get_assoc_resp_cap_info(u8 *data)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900213{
Amitoj Kaur Chawlab5c84cd2015-10-15 13:49:47 +0530214 u16 cap_info;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900215
216 cap_info = data[0];
217 cap_info |= (data[1] << 8);
218
219 return cap_info;
220}
221
Chaehyun Lim9af382b2015-09-16 20:11:27 +0900222static inline u16 get_asoc_status(u8 *data)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900223{
Amitoj Kaur Chawlab5c84cd2015-10-15 13:49:47 +0530224 u16 asoc_status;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900225
226 asoc_status = data[3];
227 asoc_status = (asoc_status << 8) | data[2];
228
229 return asoc_status;
230}
231
Chaehyun Lim9af382b2015-09-16 20:11:27 +0900232static inline u16 get_asoc_id(u8 *data)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900233{
Amitoj Kaur Chawlab5c84cd2015-10-15 13:49:47 +0530234 u16 asoc_id;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900235
236 asoc_id = data[4];
237 asoc_id |= (data[5] << 8);
238
239 return asoc_id;
240}
241
Leo Kim6c25d7c2016-01-28 16:13:37 +0900242static u8 *get_tim_elm(u8 *pu8msa, u16 rx_len, u16 tag_param_offset)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900243{
Leo Kimc8a06382016-01-28 16:13:38 +0900244 u16 index;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900245
Leo Kimc8a06382016-01-28 16:13:38 +0900246 index = tag_param_offset;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900247
Leo Kimc8a06382016-01-28 16:13:38 +0900248 while (index < (rx_len - FCS_LEN)) {
249 if (pu8msa[index] == ITIM)
250 return &pu8msa[index];
251 index += (IE_HDR_LEN + pu8msa[index + 1]);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900252 }
253
Ronit Halder0e04f3f2015-09-14 11:03:34 +0530254 return NULL;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900255}
256
Leo Kime1a9db82016-01-28 16:13:36 +0900257static u8 get_current_channel_802_11n(u8 *pu8msa, u16 rx_len)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900258{
Chaehyun Limd85f5322015-06-11 14:35:54 +0900259 u16 index;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900260
261 index = TAG_PARAM_OFFSET;
Leo Kime1a9db82016-01-28 16:13:36 +0900262 while (index < (rx_len - FCS_LEN)) {
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900263 if (pu8msa[index] == IDSPARMS)
Stanislav Kholmanskikhcea3b202015-06-10 21:57:25 +0300264 return pu8msa[index + 2];
Aybuke Ozdemir86e41802015-10-17 15:25:34 +0300265 index += pu8msa[index + 1] + IE_HDR_LEN;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900266 }
267
Leo Kim43b36e42016-01-28 16:13:35 +0900268 return 0;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900269}
270
Leo Kim6b5180a2016-02-04 18:24:10 +0900271s32 wilc_parse_network_info(u8 *msg_buffer,
272 struct network_info **ret_network_info)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900273{
Leo Kim6b5180a2016-02-04 18:24:10 +0900274 struct network_info *network_info = NULL;
Leo Kim5fd5e1e2016-02-04 18:15:42 +0900275 u8 msg_type = 0;
276 u8 msg_id = 0;
277 u16 msg_len = 0;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900278
Leo Kim5fd5e1e2016-02-04 18:15:42 +0900279 u16 wid_id = (u16)WID_NIL;
280 u16 wid_len = 0;
281 u8 *wid_val = NULL;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900282
Leo Kim5fd5e1e2016-02-04 18:15:42 +0900283 msg_type = msg_buffer[0];
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900284
Chris Park3b9d7dc2016-02-22 13:12:00 +0900285 if ('N' != msg_type)
Leo Kim24db7132015-09-16 18:36:01 +0900286 return -EFAULT;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900287
Leo Kim5fd5e1e2016-02-04 18:15:42 +0900288 msg_id = msg_buffer[1];
289 msg_len = MAKE_WORD16(msg_buffer[2], msg_buffer[3]);
290 wid_id = MAKE_WORD16(msg_buffer[4], msg_buffer[5]);
291 wid_len = MAKE_WORD16(msg_buffer[6], msg_buffer[7]);
292 wid_val = &msg_buffer[8];
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900293
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900294 {
Leo Kime5096812016-02-04 18:15:43 +0900295 u8 *msa = NULL;
Leo Kime1a9db82016-01-28 16:13:36 +0900296 u16 rx_len = 0;
Leo Kime5096812016-02-04 18:15:43 +0900297 u8 *tim_elm = NULL;
298 u8 *ies = NULL;
299 u16 ies_len = 0;
300 u8 index = 0;
301 u32 tsf_lo;
302 u32 tsf_hi;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900303
Leo Kim6b5180a2016-02-04 18:24:10 +0900304 network_info = kzalloc(sizeof(*network_info), GFP_KERNEL);
Leo Kim5fd5e1e2016-02-04 18:15:42 +0900305 if (!network_info)
Chaehyun Lima78d9a32015-08-17 11:05:15 +0900306 return -ENOMEM;
307
Leo Kim5c23a292016-02-04 18:24:11 +0900308 network_info->rssi = wid_val[0];
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900309
Leo Kime5096812016-02-04 18:15:43 +0900310 msa = &wid_val[1];
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900311
Leo Kim5fd5e1e2016-02-04 18:15:42 +0900312 rx_len = wid_len - 1;
Leo Kimfa5e2d12016-02-04 18:24:12 +0900313 network_info->cap_info = get_cap_info(msa);
Leo Kimafb70652016-02-04 18:24:22 +0900314 network_info->tsf_lo = get_beacon_timestamp_lo(msa);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900315
Leo Kime5096812016-02-04 18:15:43 +0900316 tsf_lo = get_beacon_timestamp_lo(msa);
317 tsf_hi = get_beacon_timestamp_hi(msa);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900318
Leo Kim17d2f2b2016-02-04 18:24:26 +0900319 network_info->tsf_hi = tsf_lo | ((u64)tsf_hi << 32);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900320
Leo Kima36e89e2016-02-04 18:24:14 +0900321 get_ssid(msa, network_info->ssid, &network_info->ssid_len);
Leo Kim38d3bb72016-02-04 18:24:15 +0900322 get_BSSID(msa, network_info->bssid);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900323
Leo Kim405a8c72016-02-04 18:24:18 +0900324 network_info->ch = get_current_channel_802_11n(msa,
Leo Kime1a9db82016-01-28 16:13:36 +0900325 rx_len + FCS_LEN);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900326
Leo Kime5096812016-02-04 18:15:43 +0900327 index = MAC_HDR_LEN + TIME_STAMP_LEN;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900328
Leo Kim4b313e92016-02-04 18:24:16 +0900329 network_info->beacon_period = get_beacon_period(msa + index);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900330
Leo Kime5096812016-02-04 18:15:43 +0900331 index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900332
Leo Kime5096812016-02-04 18:15:43 +0900333 tim_elm = get_tim_elm(msa, rx_len + FCS_LEN, index);
334 if (tim_elm)
Leo Kimdf340fd2016-02-04 18:24:17 +0900335 network_info->dtim_period = tim_elm[3];
Chaehyun Lim79024512016-03-03 21:05:17 +0900336 ies = &msa[TAG_PARAM_OFFSET];
337 ies_len = rx_len - TAG_PARAM_OFFSET;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900338
Leo Kime5096812016-02-04 18:15:43 +0900339 if (ies_len > 0) {
Leo Kim390b6db2016-02-04 18:24:23 +0900340 network_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
Colin Ian Kingf54e9942016-03-21 22:42:11 +0000341 if (!network_info->ies) {
342 kfree(network_info);
Chaehyun Lima78d9a32015-08-17 11:05:15 +0900343 return -ENOMEM;
Colin Ian Kingf54e9942016-03-21 22:42:11 +0000344 }
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900345 }
Leo Kim390b6db2016-02-04 18:24:23 +0900346 network_info->ies_len = ies_len;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900347 }
348
Leo Kim5fd5e1e2016-02-04 18:15:42 +0900349 *ret_network_info = network_info;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900350
Chaehyun Lim74a443e2015-09-22 22:47:45 +0900351 return 0;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900352}
353
Leo Kim946a9dd2016-02-04 18:15:45 +0900354s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
Leo Kim40d96e12016-02-04 18:24:08 +0900355 struct connect_resp_info **ret_connect_resp_info)
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900356{
Leo Kim40d96e12016-02-04 18:24:08 +0900357 struct connect_resp_info *connect_resp_info = NULL;
Leo Kimebd7a9b2016-02-04 18:15:46 +0900358 u16 assoc_resp_len = 0;
359 u8 *ies = NULL;
360 u16 ies_len = 0;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900361
Leo Kim40d96e12016-02-04 18:24:08 +0900362 connect_resp_info = kzalloc(sizeof(*connect_resp_info), GFP_KERNEL);
Leo Kimebd7a9b2016-02-04 18:15:46 +0900363 if (!connect_resp_info)
Chaehyun Lima78d9a32015-08-17 11:05:15 +0900364 return -ENOMEM;
365
Leo Kimebd7a9b2016-02-04 18:15:46 +0900366 assoc_resp_len = (u16)buffer_len;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900367
Leo Kimba7b6ff2016-02-04 18:24:09 +0900368 connect_resp_info->status = get_asoc_status(buffer);
369 if (connect_resp_info->status == SUCCESSFUL_STATUSCODE) {
370 connect_resp_info->capability = get_assoc_resp_cap_info(buffer);
371 connect_resp_info->assoc_id = get_asoc_id(buffer);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900372
Leo Kimebd7a9b2016-02-04 18:15:46 +0900373 ies = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
Leo Kime0990c12016-02-04 18:24:31 +0900374 ies_len = assoc_resp_len - (CAP_INFO_LEN + STATUS_CODE_LEN +
375 AID_LEN);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900376
Leo Kimba7b6ff2016-02-04 18:24:09 +0900377 connect_resp_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
Colin Ian Kingf54e9942016-03-21 22:42:11 +0000378 if (!connect_resp_info->ies) {
379 kfree(connect_resp_info);
Chaehyun Lima78d9a32015-08-17 11:05:15 +0900380 return -ENOMEM;
Colin Ian Kingf54e9942016-03-21 22:42:11 +0000381 }
Chaehyun Lima78d9a32015-08-17 11:05:15 +0900382
Leo Kimba7b6ff2016-02-04 18:24:09 +0900383 connect_resp_info->ies_len = ies_len;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900384 }
385
Leo Kimebd7a9b2016-02-04 18:15:46 +0900386 *ret_connect_resp_info = connect_resp_info;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900387
Leo Kim66d77cb2016-02-04 18:15:44 +0900388 return 0;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900389}