Skip to content

Commit aa28703

Browse files
krish2718jukkar
authored andcommitted
[toup] zephyr: Improve error logging
Useful in debugging. Signed-off-by: Chaitanya Tata <[email protected]> Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 81bdd83 commit aa28703

File tree

1 file changed

+51
-33
lines changed

1 file changed

+51
-33
lines changed

src/drivers/driver_zephyr.c

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
5959
char *ies = os_zalloc(data->auth.ies_len);
6060

6161
if (!ies) {
62-
wpa_printf(MSG_ERROR, "%s: Failed to alloc ies", __func__);
62+
wpa_printf(MSG_ERROR,
63+
"%s:%d Failed to alloc %d bytes\n",
64+
__func__, __LINE__, data->auth.ies_len);
6365
return;
6466
}
6567

@@ -73,8 +75,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
7375
char *frame = os_zalloc(data->rx_mgmt.frame_len);
7476

7577
if (!frame) {
76-
wpa_printf(MSG_ERROR, "%s: Failed to alloc frame",
77-
__func__);
78+
wpa_printf(MSG_ERROR,
79+
"%s:%d Failed to alloc %d bytes\n",
80+
__func__, __LINE__, data->rx_mgmt.frame_len);
7881
return;
7982
}
8083

@@ -89,8 +92,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
8992
char *frame = os_zalloc(data->tx_status.data_len);
9093

9194
if (!frame) {
92-
wpa_printf(MSG_ERROR, "%s: Failed to alloc frame\n",
93-
__func__);
95+
wpa_printf(MSG_ERROR,
96+
"%s:%d Failed to alloc %d bytes\n",
97+
__func__, __LINE__, data->tx_status.data_len);
9498
return;
9599
}
96100

@@ -104,8 +108,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
104108
char *addr = os_zalloc(ETH_ALEN);
105109

106110
if (!addr) {
107-
wpa_printf(MSG_ERROR, "%s: Failed to alloc addr\n",
108-
__func__);
111+
wpa_printf(MSG_ERROR,
112+
"%s:%d Failed to alloc %d bytes\n",
113+
__func__, __LINE__, ETH_ALEN);
109114
return;
110115
}
111116

@@ -116,8 +121,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
116121
char *req_ies = os_zalloc(data->assoc_info.req_ies_len);
117122

118123
if (!req_ies) {
119-
wpa_printf(MSG_ERROR, "%s: Failed to alloc req_ies\n",
120-
__func__);
124+
wpa_printf(MSG_ERROR,
125+
"%s:%d Failed to alloc %d bytes\n",
126+
__func__, __LINE__, data->assoc_info.req_ies_len);
121127
return;
122128
}
123129

@@ -129,8 +135,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
129135
char *resp_ies = os_zalloc(data->assoc_info.resp_ies_len);
130136

131137
if (!resp_ies) {
132-
wpa_printf(MSG_ERROR, "%s: Failed to alloc resp_ies\n",
133-
__func__);
138+
wpa_printf(MSG_ERROR,
139+
"%s:%d Failed to alloc %d bytes\n",
140+
__func__, __LINE__, data->assoc_info.resp_ies_len);
134141
return;
135142
}
136143

@@ -142,8 +149,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
142149
char *resp_frame = os_zalloc(data->assoc_info.resp_frame_len);
143150

144151
if (!resp_frame) {
145-
wpa_printf(MSG_ERROR, "%s: Failed to alloc resp_frame\n",
146-
__func__);
152+
wpa_printf(MSG_ERROR,
153+
"%s:%d Failed to alloc %d bytes\n",
154+
__func__, __LINE__, data->assoc_info.resp_frame_len);
147155
return;
148156
}
149157

@@ -156,8 +164,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
156164
char *bssid = os_zalloc(ETH_ALEN);
157165

158166
if (!bssid) {
159-
wpa_printf(MSG_ERROR, "%s: Failed to alloc bssid\n",
160-
__func__);
167+
wpa_printf(MSG_ERROR,
168+
"%s:%d Failed to alloc %d bytes\n",
169+
__func__, __LINE__, ETH_ALEN);
161170
return;
162171
}
163172

@@ -168,8 +177,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
168177
char *resp_ies = os_zalloc(data->assoc_reject.resp_ies_len);
169178

170179
if (!resp_ies) {
171-
wpa_printf(MSG_ERROR, "%s: Failed to alloc resp_ies\n",
172-
__func__);
180+
wpa_printf(MSG_ERROR,
181+
"%s:%d Failed to alloc %d bytes\n",
182+
__func__, __LINE__, data->assoc_reject.resp_ies_len);
173183
return;
174184
}
175185

@@ -182,8 +192,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
182192
char *sa = os_zalloc(ETH_ALEN);
183193

184194
if (!sa) {
185-
wpa_printf(MSG_ERROR, "%s: Failed to alloc SA\n",
186-
__func__);
195+
wpa_printf(MSG_ERROR,
196+
"%s:%d Failed to alloc %d bytes\n",
197+
__func__, __LINE__, ETH_ALEN);
187198
return;
188199
}
189200

@@ -193,8 +204,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
193204
char *ie = os_zalloc(data->deauth_info.ie_len);
194205

195206
if (!ie) {
196-
wpa_printf(MSG_ERROR, "%s: Failed to alloc ie\n",
197-
__func__);
207+
wpa_printf(MSG_ERROR,
208+
"%s:%d Failed to alloc %d bytes\n",
209+
__func__, __LINE__, data->deauth_info.ie_len);
198210
return;
199211
}
200212

@@ -206,8 +218,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
206218
char *sa = os_zalloc(ETH_ALEN);
207219

208220
if (!sa) {
209-
wpa_printf(MSG_ERROR, "%s: Failed to alloc SA\n",
210-
__func__);
221+
wpa_printf(MSG_ERROR,
222+
"%s:%d Failed to alloc %d bytes\n",
223+
__func__, __LINE__, ETH_ALEN);
211224
return;
212225
}
213226

@@ -217,8 +230,9 @@ void wpa_supplicant_event_wrapper(void *ctx,
217230
char *ie = os_zalloc(data->disassoc_info.ie_len);
218231

219232
if (!ie) {
220-
wpa_printf(MSG_ERROR, "%s: Failed to alloc ie\n",
221-
__func__);
233+
wpa_printf(MSG_ERROR,
234+
"%s:%d Failed to alloc %d bytes\n",
235+
__func__, __LINE__, data->disassoc_info.ie_len);
222236
return;
223237
}
224238

@@ -231,14 +245,16 @@ void wpa_supplicant_event_wrapper(void *ctx,
231245
char *da = os_zalloc(ETH_ALEN);
232246

233247
if (!sa) {
234-
wpa_printf(MSG_ERROR, "%s: Failed to alloc sa\n",
235-
__func__);
248+
wpa_printf(MSG_ERROR,
249+
"%s:%d Failed to alloc %d bytes\n",
250+
__func__, __LINE__, ETH_ALEN);
236251
return;
237252
}
238253

239254
if (!da) {
240-
wpa_printf(MSG_ERROR, "%s: Failed to alloc da\n",
241-
__func__);
255+
wpa_printf(MSG_ERROR,
256+
"%s:%d Failed to alloc %d bytes\n",
257+
__func__, __LINE__, ETH_ALEN);
242258
return;
243259
}
244260
os_memcpy(sa, data->unprot_deauth.sa, ETH_ALEN);
@@ -251,14 +267,16 @@ void wpa_supplicant_event_wrapper(void *ctx,
251267
char *da = os_zalloc(ETH_ALEN);
252268

253269
if (!sa) {
254-
wpa_printf(MSG_ERROR, "%s: Failed to alloc sa\n",
255-
__func__);
270+
wpa_printf(MSG_ERROR,
271+
"%s:%d Failed to alloc %d bytes\n",
272+
__func__, __LINE__, ETH_ALEN);
256273
return;
257274
}
258275

259276
if (!da) {
260-
wpa_printf(MSG_ERROR, "%s: Failed to alloc da\n",
261-
__func__);
277+
wpa_printf(MSG_ERROR,
278+
"%s:%d Failed to alloc %d bytes\n",
279+
__func__, __LINE__, ETH_ALEN);
262280
return;
263281
}
264282
os_memcpy(sa, data->unprot_disassoc.sa, ETH_ALEN);

0 commit comments

Comments
 (0)