1 /*
2 * wpa_supplicant - Event notifications
3 * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8
9 #include "utils/includes.h"
10
11 #include "utils/common.h"
12 #include "common/wpa_ctrl.h"
13 #include "config.h"
14 #include "wpa_supplicant_i.h"
15 #include "wps_supplicant.h"
16 #include "dbus/dbus_common.h"
17 #include "dbus/dbus_new.h"
18 #include "rsn_supp/wpa.h"
19 #include "fst/fst.h"
20 #include "crypto/tls.h"
21 #include "bss.h"
22 #include "driver_i.h"
23 #include "scan.h"
24 #include "p2p_supplicant.h"
25 #include "sme.h"
26 #include "notify.h"
27 #include "aidl/aidl.h"
28
wpas_notify_supplicant_initialized(struct wpa_global * global)29 int wpas_notify_supplicant_initialized(struct wpa_global *global)
30 {
31 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
32 if (global->params.dbus_ctrl_interface) {
33 global->dbus = wpas_dbus_init(global);
34 if (global->dbus == NULL)
35 return -1;
36 }
37 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
38
39 #ifdef CONFIG_AIDL
40 global->aidl = wpas_aidl_init(global);
41 if (!global->aidl)
42 return -1;
43 #endif /* CONFIG_AIDL */
44
45 return 0;
46 }
47
48
wpas_notify_supplicant_deinitialized(struct wpa_global * global)49 void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
50 {
51 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
52 if (global->dbus)
53 wpas_dbus_deinit(global->dbus);
54 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
55
56 #ifdef CONFIG_AIDL
57 if (global->aidl)
58 wpas_aidl_deinit(global->aidl);
59 #endif /* CONFIG_AIDL */
60 }
61
62
wpas_notify_iface_added(struct wpa_supplicant * wpa_s)63 int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
64 {
65 if (!wpa_s->p2p_mgmt) {
66 if (wpas_dbus_register_interface(wpa_s))
67 return -1;
68 }
69
70 /* HIDL interface wants to keep track of the P2P mgmt iface. */
71 if (wpas_aidl_register_interface(wpa_s))
72 return -1;
73
74 return 0;
75 }
76
77
wpas_notify_iface_removed(struct wpa_supplicant * wpa_s)78 void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
79 {
80 if (!wpa_s->p2p_mgmt) {
81 /* unregister interface in new DBus ctrl iface */
82 wpas_dbus_unregister_interface(wpa_s);
83 }
84
85 /* HIDL interface wants to keep track of the P2P mgmt iface. */
86 wpas_aidl_unregister_interface(wpa_s);
87 }
88
89
wpas_notify_state_changed(struct wpa_supplicant * wpa_s,enum wpa_states new_state,enum wpa_states old_state)90 void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
91 enum wpa_states new_state,
92 enum wpa_states old_state)
93 {
94 if (wpa_s->p2p_mgmt)
95 return;
96
97 /* notify the new DBus API */
98 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
99
100 #ifdef CONFIG_FST
101 if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
102 if (new_state == WPA_COMPLETED)
103 fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid);
104 else if (old_state >= WPA_ASSOCIATED &&
105 new_state < WPA_ASSOCIATED)
106 fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
107 }
108 #endif /* CONFIG_FST */
109
110 if (new_state == WPA_COMPLETED)
111 wpas_p2p_notif_connected(wpa_s);
112 else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
113 wpas_p2p_notif_disconnected(wpa_s);
114
115 sme_state_changed(wpa_s);
116
117 #ifdef ANDROID
118 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
119 "id=%d state=%d BSSID=" MACSTR " SSID=%s",
120 wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
121 new_state,
122 MAC2STR(wpa_s->bssid),
123 wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
124 wpa_ssid_txt(wpa_s->current_ssid->ssid,
125 wpa_s->current_ssid->ssid_len) : "");
126 #endif /* ANDROID */
127
128 wpas_aidl_notify_state_changed(wpa_s);
129 }
130
131
wpas_notify_disconnect_reason(struct wpa_supplicant * wpa_s)132 void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
133 {
134 if (wpa_s->p2p_mgmt)
135 return;
136
137 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
138
139 wpas_aidl_notify_disconnect_reason(wpa_s);
140 }
141
142
wpas_notify_auth_status_code(struct wpa_supplicant * wpa_s)143 void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s)
144 {
145 if (wpa_s->p2p_mgmt)
146 return;
147
148 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_STATUS_CODE);
149 }
150
151
wpas_notify_assoc_status_code(struct wpa_supplicant * wpa_s,const u8 * bssid,u8 timed_out,const u8 * assoc_resp_ie,size_t assoc_resp_ie_len)152 void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
153 const u8 *bssid, u8 timed_out,
154 const u8 *assoc_resp_ie, size_t assoc_resp_ie_len)
155 {
156 if (wpa_s->p2p_mgmt)
157 return;
158
159 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
160
161 wpas_aidl_notify_assoc_reject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len);
162 }
163
wpas_notify_auth_timeout(struct wpa_supplicant * wpa_s)164 void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
165 if (wpa_s->p2p_mgmt)
166 return;
167
168 wpas_aidl_notify_auth_timeout(wpa_s);
169 }
170
wpas_notify_roam_time(struct wpa_supplicant * wpa_s)171 void wpas_notify_roam_time(struct wpa_supplicant *wpa_s)
172 {
173 if (wpa_s->p2p_mgmt)
174 return;
175
176 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME);
177 }
178
179
wpas_notify_roam_complete(struct wpa_supplicant * wpa_s)180 void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s)
181 {
182 if (wpa_s->p2p_mgmt)
183 return;
184
185 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE);
186 }
187
188
wpas_notify_session_length(struct wpa_supplicant * wpa_s)189 void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
190 {
191 if (wpa_s->p2p_mgmt)
192 return;
193
194 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH);
195 }
196
197
wpas_notify_bss_tm_status(struct wpa_supplicant * wpa_s)198 void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
199 {
200 if (wpa_s->p2p_mgmt)
201 return;
202
203 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
204
205 #ifdef CONFIG_WNM
206 wpas_aidl_notify_bss_tm_status(wpa_s);
207 #endif
208 }
209
210
wpas_notify_network_changed(struct wpa_supplicant * wpa_s)211 void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
212 {
213 if (wpa_s->p2p_mgmt)
214 return;
215
216 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
217 }
218
219
wpas_notify_ap_scan_changed(struct wpa_supplicant * wpa_s)220 void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
221 {
222 if (wpa_s->p2p_mgmt)
223 return;
224
225 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
226 }
227
228
wpas_notify_bssid_changed(struct wpa_supplicant * wpa_s)229 void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
230 {
231 if (wpa_s->p2p_mgmt)
232 return;
233
234 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
235
236 wpas_aidl_notify_bssid_changed(wpa_s);
237 }
238
239
wpas_notify_auth_changed(struct wpa_supplicant * wpa_s)240 void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
241 {
242 if (wpa_s->p2p_mgmt)
243 return;
244
245 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
246 }
247
248
wpas_notify_network_enabled_changed(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)249 void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
250 struct wpa_ssid *ssid)
251 {
252 if (wpa_s->p2p_mgmt)
253 return;
254
255 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
256 }
257
258
wpas_notify_network_selected(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)259 void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
260 struct wpa_ssid *ssid)
261 {
262 if (wpa_s->p2p_mgmt)
263 return;
264
265 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
266 }
267
268
wpas_notify_network_request(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,enum wpa_ctrl_req_type rtype,const char * default_txt)269 void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
270 struct wpa_ssid *ssid,
271 enum wpa_ctrl_req_type rtype,
272 const char *default_txt)
273 {
274 if (wpa_s->p2p_mgmt)
275 return;
276
277 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
278
279 wpas_aidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
280 }
281
282
wpas_notify_scanning(struct wpa_supplicant * wpa_s)283 void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
284 {
285 if (wpa_s->p2p_mgmt)
286 return;
287
288 /* notify the new DBus API */
289 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
290 }
291
292
wpas_notify_scan_done(struct wpa_supplicant * wpa_s,int success)293 void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
294 {
295 if (wpa_s->p2p_mgmt)
296 return;
297
298 wpas_dbus_signal_scan_done(wpa_s, success);
299 }
300
301
wpas_notify_scan_results(struct wpa_supplicant * wpa_s)302 void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
303 {
304 if (wpa_s->p2p_mgmt)
305 return;
306
307 wpas_wps_notify_scan_results(wpa_s);
308 }
309
310
wpas_notify_wps_credential(struct wpa_supplicant * wpa_s,const struct wps_credential * cred)311 void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
312 const struct wps_credential *cred)
313 {
314 if (wpa_s->p2p_mgmt)
315 return;
316
317 #ifdef CONFIG_WPS
318 /* notify the new DBus API */
319 wpas_dbus_signal_wps_cred(wpa_s, cred);
320 #endif /* CONFIG_WPS */
321 }
322
323
wpas_notify_wps_event_m2d(struct wpa_supplicant * wpa_s,struct wps_event_m2d * m2d)324 void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
325 struct wps_event_m2d *m2d)
326 {
327 if (wpa_s->p2p_mgmt)
328 return;
329
330 #ifdef CONFIG_WPS
331 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
332 #endif /* CONFIG_WPS */
333 }
334
335
wpas_notify_wps_event_fail(struct wpa_supplicant * wpa_s,struct wps_event_fail * fail)336 void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
337 struct wps_event_fail *fail)
338 {
339 if (wpa_s->p2p_mgmt)
340 return;
341
342 #ifdef CONFIG_WPS
343 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
344
345 wpas_aidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
346 fail->config_error,
347 fail->error_indication);
348 #endif /* CONFIG_WPS */
349 }
350
351
wpas_notify_wps_event_success(struct wpa_supplicant * wpa_s)352 void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
353 {
354 if (wpa_s->p2p_mgmt)
355 return;
356
357 #ifdef CONFIG_WPS
358 wpas_dbus_signal_wps_event_success(wpa_s);
359
360 wpas_aidl_notify_wps_event_success(wpa_s);
361 #endif /* CONFIG_WPS */
362 }
363
wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant * wpa_s)364 void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
365 {
366 if (wpa_s->p2p_mgmt)
367 return;
368
369 #ifdef CONFIG_WPS
370 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
371
372 wpas_aidl_notify_wps_event_pbc_overlap(wpa_s);
373 #endif /* CONFIG_WPS */
374 }
375
376
wpas_notify_network_added(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)377 void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
378 struct wpa_ssid *ssid)
379 {
380 if (wpa_s->p2p_mgmt)
381 return;
382
383 /*
384 * Networks objects created during any P2P activities should not be
385 * exposed out. They might/will confuse certain non-P2P aware
386 * applications since these network objects won't behave like
387 * regular ones.
388 */
389 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
390 wpas_dbus_register_network(wpa_s, ssid);
391 wpas_aidl_register_network(wpa_s, ssid);
392 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_ADDED "%d",
393 ssid->id);
394 }
395 }
396
397
wpas_notify_persistent_group_added(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)398 void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
399 struct wpa_ssid *ssid)
400 {
401 #ifdef CONFIG_P2P
402 wpas_dbus_register_persistent_group(wpa_s, ssid);
403 wpas_aidl_register_network(wpa_s, ssid);
404 #endif /* CONFIG_P2P */
405 }
406
407
wpas_notify_persistent_group_removed(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)408 void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
409 struct wpa_ssid *ssid)
410 {
411 #ifdef CONFIG_P2P
412 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
413 wpas_aidl_unregister_network(wpa_s, ssid);
414 #endif /* CONFIG_P2P */
415 }
416
417
wpas_notify_network_removed(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)418 void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
419 struct wpa_ssid *ssid)
420 {
421 if (wpa_s->next_ssid == ssid)
422 wpa_s->next_ssid = NULL;
423 if (wpa_s->last_ssid == ssid)
424 wpa_s->last_ssid = NULL;
425 if (wpa_s->current_ssid == ssid)
426 wpa_s->current_ssid = NULL;
427 if (wpa_s->wpa)
428 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
429 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
430 !wpa_s->p2p_mgmt) {
431 wpas_dbus_unregister_network(wpa_s, ssid->id);
432 wpas_aidl_unregister_network(wpa_s, ssid);
433 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
434 ssid->id);
435 }
436 if (network_is_persistent_group(ssid))
437 wpas_notify_persistent_group_removed(wpa_s, ssid);
438
439 wpas_p2p_network_removed(wpa_s, ssid);
440
441 #ifdef CONFIG_PASN
442 if (wpa_s->pasn.ssid == ssid)
443 wpa_s->pasn.ssid = NULL;
444 #endif /* CONFIG_PASN */
445 }
446
447
wpas_notify_bss_added(struct wpa_supplicant * wpa_s,u8 bssid[],unsigned int id)448 void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
449 u8 bssid[], unsigned int id)
450 {
451 if (wpa_s->p2p_mgmt)
452 return;
453
454 wpas_dbus_register_bss(wpa_s, bssid, id);
455 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
456 id, MAC2STR(bssid));
457 }
458
459
wpas_notify_bss_removed(struct wpa_supplicant * wpa_s,u8 bssid[],unsigned int id)460 void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
461 u8 bssid[], unsigned int id)
462 {
463 if (wpa_s->p2p_mgmt)
464 return;
465
466 wpas_dbus_unregister_bss(wpa_s, bssid, id);
467 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
468 id, MAC2STR(bssid));
469 }
470
471
wpas_notify_bss_freq_changed(struct wpa_supplicant * wpa_s,unsigned int id)472 void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
473 unsigned int id)
474 {
475 if (wpa_s->p2p_mgmt)
476 return;
477
478 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
479 }
480
481
wpas_notify_bss_signal_changed(struct wpa_supplicant * wpa_s,unsigned int id)482 void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
483 unsigned int id)
484 {
485 if (wpa_s->p2p_mgmt)
486 return;
487
488 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
489 id);
490 }
491
492
wpas_notify_bss_privacy_changed(struct wpa_supplicant * wpa_s,unsigned int id)493 void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
494 unsigned int id)
495 {
496 if (wpa_s->p2p_mgmt)
497 return;
498
499 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
500 id);
501 }
502
503
wpas_notify_bss_mode_changed(struct wpa_supplicant * wpa_s,unsigned int id)504 void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
505 unsigned int id)
506 {
507 if (wpa_s->p2p_mgmt)
508 return;
509
510 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
511 }
512
513
wpas_notify_bss_wpaie_changed(struct wpa_supplicant * wpa_s,unsigned int id)514 void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
515 unsigned int id)
516 {
517 if (wpa_s->p2p_mgmt)
518 return;
519
520 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
521 }
522
523
wpas_notify_bss_rsnie_changed(struct wpa_supplicant * wpa_s,unsigned int id)524 void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
525 unsigned int id)
526 {
527 if (wpa_s->p2p_mgmt)
528 return;
529
530 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
531 }
532
533
wpas_notify_bss_wps_changed(struct wpa_supplicant * wpa_s,unsigned int id)534 void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
535 unsigned int id)
536 {
537 if (wpa_s->p2p_mgmt)
538 return;
539
540 #ifdef CONFIG_WPS
541 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
542 #endif /* CONFIG_WPS */
543 }
544
545
wpas_notify_bss_ies_changed(struct wpa_supplicant * wpa_s,unsigned int id)546 void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
547 unsigned int id)
548 {
549 if (wpa_s->p2p_mgmt)
550 return;
551
552 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
553 }
554
555
wpas_notify_bss_rates_changed(struct wpa_supplicant * wpa_s,unsigned int id)556 void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
557 unsigned int id)
558 {
559 if (wpa_s->p2p_mgmt)
560 return;
561
562 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
563 }
564
565
wpas_notify_bss_seen(struct wpa_supplicant * wpa_s,unsigned int id)566 void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
567 {
568 if (wpa_s->p2p_mgmt)
569 return;
570
571 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
572 }
573
574
wpas_notify_blob_added(struct wpa_supplicant * wpa_s,const char * name)575 void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
576 {
577 if (wpa_s->p2p_mgmt)
578 return;
579
580 wpas_dbus_signal_blob_added(wpa_s, name);
581 }
582
583
wpas_notify_blob_removed(struct wpa_supplicant * wpa_s,const char * name)584 void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
585 {
586 if (wpa_s->p2p_mgmt)
587 return;
588
589 wpas_dbus_signal_blob_removed(wpa_s, name);
590 }
591
592
wpas_notify_debug_level_changed(struct wpa_global * global)593 void wpas_notify_debug_level_changed(struct wpa_global *global)
594 {
595 wpas_dbus_signal_debug_level_changed(global);
596 }
597
598
wpas_notify_debug_timestamp_changed(struct wpa_global * global)599 void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
600 {
601 wpas_dbus_signal_debug_timestamp_changed(global);
602 }
603
604
wpas_notify_debug_show_keys_changed(struct wpa_global * global)605 void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
606 {
607 wpas_dbus_signal_debug_show_keys_changed(global);
608 }
609
610
wpas_notify_suspend(struct wpa_global * global)611 void wpas_notify_suspend(struct wpa_global *global)
612 {
613 struct wpa_supplicant *wpa_s;
614
615 os_get_time(&global->suspend_time);
616 wpa_printf(MSG_DEBUG, "System suspend notification");
617 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
618 wpa_drv_suspend(wpa_s);
619 }
620
621
wpas_notify_resume(struct wpa_global * global)622 void wpas_notify_resume(struct wpa_global *global)
623 {
624 struct os_time now;
625 int slept;
626 struct wpa_supplicant *wpa_s;
627
628 if (global->suspend_time.sec == 0)
629 slept = -1;
630 else {
631 os_get_time(&now);
632 slept = now.sec - global->suspend_time.sec;
633 }
634 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
635 slept);
636
637 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
638 wpa_drv_resume(wpa_s);
639 if (wpa_s->wpa_state == WPA_DISCONNECTED)
640 wpa_supplicant_req_scan(wpa_s, 0, 100000);
641 }
642 }
643
644
645 #ifdef CONFIG_P2P
646
wpas_notify_p2p_find_stopped(struct wpa_supplicant * wpa_s)647 void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
648 {
649 /* Notify P2P find has stopped */
650 wpas_dbus_signal_p2p_find_stopped(wpa_s);
651
652 wpas_aidl_notify_p2p_find_stopped(wpa_s);
653 }
654
655
wpas_notify_p2p_device_found(struct wpa_supplicant * wpa_s,const u8 * addr,const struct p2p_peer_info * info,const u8 * peer_wfd_device_info,u8 peer_wfd_device_info_len,const u8 * peer_wfd_r2_device_info,u8 peer_wfd_r2_device_info_len,int new_device)656 void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
657 const u8 *addr, const struct p2p_peer_info *info,
658 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
659 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
660 int new_device)
661 {
662 if (new_device) {
663 /* Create the new peer object */
664 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
665 }
666
667 /* Notify a new peer has been detected*/
668 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
669
670 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
671 peer_wfd_device_info,
672 peer_wfd_device_info_len,
673 peer_wfd_r2_device_info,
674 peer_wfd_r2_device_info_len);
675 }
676
677
wpas_notify_p2p_device_lost(struct wpa_supplicant * wpa_s,const u8 * dev_addr)678 void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
679 const u8 *dev_addr)
680 {
681 wpas_dbus_unregister_peer(wpa_s, dev_addr);
682
683 /* Create signal on interface object*/
684 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
685
686 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
687 }
688
689
wpas_notify_p2p_group_removed(struct wpa_supplicant * wpa_s,const struct wpa_ssid * ssid,const char * role)690 void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
691 const struct wpa_ssid *ssid,
692 const char *role)
693 {
694 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
695
696 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
697
698 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
699 }
700
701
wpas_notify_p2p_go_neg_req(struct wpa_supplicant * wpa_s,const u8 * src,u16 dev_passwd_id,u8 go_intent)702 void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
703 const u8 *src, u16 dev_passwd_id, u8 go_intent)
704 {
705 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
706
707 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
708 }
709
710
wpas_notify_p2p_go_neg_completed(struct wpa_supplicant * wpa_s,struct p2p_go_neg_results * res)711 void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
712 struct p2p_go_neg_results *res)
713 {
714 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
715
716 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
717 }
718
719
wpas_notify_p2p_invitation_result(struct wpa_supplicant * wpa_s,int status,const u8 * bssid)720 void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
721 int status, const u8 *bssid)
722 {
723 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
724
725 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
726 }
727
728
wpas_notify_p2p_sd_request(struct wpa_supplicant * wpa_s,int freq,const u8 * sa,u8 dialog_token,u16 update_indic,const u8 * tlvs,size_t tlvs_len)729 void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
730 int freq, const u8 *sa, u8 dialog_token,
731 u16 update_indic, const u8 *tlvs,
732 size_t tlvs_len)
733 {
734 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
735 update_indic, tlvs, tlvs_len);
736 }
737
738
wpas_notify_p2p_sd_response(struct wpa_supplicant * wpa_s,const u8 * sa,u16 update_indic,const u8 * tlvs,size_t tlvs_len)739 void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
740 const u8 *sa, u16 update_indic,
741 const u8 *tlvs, size_t tlvs_len)
742 {
743 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
744 tlvs, tlvs_len);
745
746 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
747 tlvs, tlvs_len);
748 }
749
750
751 /**
752 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
753 * @dev_addr: Who sent the request or responded to our request.
754 * @request: Will be 1 if request, 0 for response.
755 * @status: Valid only in case of response (0 in case of success)
756 * @config_methods: WPS config methods
757 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
758 *
759 * This can be used to notify:
760 * - Requests or responses
761 * - Various config methods
762 * - Failure condition in case of response
763 */
wpas_notify_p2p_provision_discovery(struct wpa_supplicant * wpa_s,const u8 * dev_addr,int request,enum p2p_prov_disc_status status,u16 config_methods,unsigned int generated_pin)764 void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
765 const u8 *dev_addr, int request,
766 enum p2p_prov_disc_status status,
767 u16 config_methods,
768 unsigned int generated_pin)
769 {
770 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
771 status, config_methods,
772 generated_pin);
773
774 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
775 status, config_methods,
776 generated_pin);
777
778 }
779
780
wpas_notify_p2p_group_started(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,int persistent,int client,const u8 * ip)781 void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
782 struct wpa_ssid *ssid, int persistent,
783 int client, const u8 *ip)
784 {
785 /* Notify a group has been started */
786 wpas_dbus_register_p2p_group(wpa_s, ssid);
787
788 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
789
790 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client);
791 }
792
793
wpas_notify_p2p_group_formation_failure(struct wpa_supplicant * wpa_s,const char * reason)794 void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
795 const char *reason)
796 {
797 /* Notify a group formation failed */
798 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
799
800 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
801 }
802
803
wpas_notify_p2p_wps_failed(struct wpa_supplicant * wpa_s,struct wps_event_fail * fail)804 void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
805 struct wps_event_fail *fail)
806 {
807 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
808 }
809
810
wpas_notify_p2p_invitation_received(struct wpa_supplicant * wpa_s,const u8 * sa,const u8 * go_dev_addr,const u8 * bssid,int id,int op_freq)811 void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
812 const u8 *sa, const u8 *go_dev_addr,
813 const u8 *bssid, int id, int op_freq)
814 {
815 /* Notify a P2P Invitation Request */
816 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
817 id, op_freq);
818
819 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
820 id, op_freq);
821 }
822
823 #endif /* CONFIG_P2P */
824
825
wpas_notify_ap_sta_authorized(struct wpa_supplicant * wpa_s,const u8 * sta,const u8 * p2p_dev_addr)826 static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
827 const u8 *sta,
828 const u8 *p2p_dev_addr)
829 {
830 #ifdef CONFIG_P2P
831 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
832
833 /*
834 * Create 'peer-joined' signal on group object -- will also
835 * check P2P itself.
836 */
837 if (p2p_dev_addr)
838 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
839 #endif /* CONFIG_P2P */
840
841 /* Register the station */
842 wpas_dbus_register_sta(wpa_s, sta);
843
844 /* Notify listeners a new station has been authorized */
845 wpas_dbus_signal_sta_authorized(wpa_s, sta);
846
847 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
848 }
849
850
wpas_notify_ap_sta_deauthorized(struct wpa_supplicant * wpa_s,const u8 * sta,const u8 * p2p_dev_addr)851 static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
852 const u8 *sta,
853 const u8 *p2p_dev_addr)
854 {
855 #ifdef CONFIG_P2P
856 /*
857 * Create 'peer-disconnected' signal on group object if this
858 * is a P2P group.
859 */
860 if (p2p_dev_addr)
861 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
862 #endif /* CONFIG_P2P */
863
864 /* Notify listeners a station has been deauthorized */
865 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
866
867 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
868 /* Unregister the station */
869 wpas_dbus_unregister_sta(wpa_s, sta);
870 }
871
872
wpas_notify_sta_authorized(struct wpa_supplicant * wpa_s,const u8 * mac_addr,int authorized,const u8 * p2p_dev_addr)873 void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
874 const u8 *mac_addr, int authorized,
875 const u8 *p2p_dev_addr)
876 {
877 if (authorized)
878 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
879 else
880 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
881 }
882
883
wpas_notify_certification(struct wpa_supplicant * wpa_s,struct tls_cert_data * cert,const char * cert_hash)884 void wpas_notify_certification(struct wpa_supplicant *wpa_s,
885 struct tls_cert_data *cert,
886 const char *cert_hash)
887 {
888 int i;
889
890 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
891 "depth=%d subject='%s'%s%s%s%s",
892 cert->depth, cert->subject, cert_hash ? " hash=" : "",
893 cert_hash ? cert_hash : "",
894 cert->tod == 2 ? " tod=2" : "",
895 cert->tod == 1 ? " tod=1" : "");
896
897 if (cert->cert) {
898 char *cert_hex;
899 size_t len = wpabuf_len(cert->cert) * 2 + 1;
900 cert_hex = os_malloc(len);
901 if (cert_hex) {
902 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
903 wpabuf_len(cert->cert));
904 wpa_msg_ctrl(wpa_s, MSG_INFO,
905 WPA_EVENT_EAP_PEER_CERT
906 "depth=%d subject='%s' cert=%s",
907 cert->depth, cert->subject, cert_hex);
908 os_free(cert_hex);
909 }
910 }
911
912 for (i = 0; i < cert->num_altsubject; i++)
913 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
914 "depth=%d %s", cert->depth, cert->altsubject[i]);
915
916 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
917 cert->altsubject, cert->num_altsubject,
918 cert_hash, cert->cert);
919
920 /* notify the new DBus API */
921 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
922 cert->altsubject, cert->num_altsubject,
923 cert_hash, cert->cert);
924 }
925
926
wpas_notify_preq(struct wpa_supplicant * wpa_s,const u8 * addr,const u8 * dst,const u8 * bssid,const u8 * ie,size_t ie_len,u32 ssi_signal)927 void wpas_notify_preq(struct wpa_supplicant *wpa_s,
928 const u8 *addr, const u8 *dst, const u8 *bssid,
929 const u8 *ie, size_t ie_len, u32 ssi_signal)
930 {
931 #ifdef CONFIG_AP
932 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
933 #endif /* CONFIG_AP */
934 }
935
936
wpas_notify_eap_status(struct wpa_supplicant * wpa_s,const char * status,const char * parameter)937 void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
938 const char *parameter)
939 {
940 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
941 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
942 "status='%s' parameter='%s'",
943 status, parameter);
944 }
945
946
wpas_notify_eap_error(struct wpa_supplicant * wpa_s,int error_code)947 void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
948 {
949 wpa_dbg(wpa_s, MSG_ERROR,
950 "EAP Error code = %d", error_code);
951 wpas_aidl_notify_eap_error(wpa_s, error_code);
952 }
953
954
wpas_notify_network_bssid_set_changed(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)955 void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
956 struct wpa_ssid *ssid)
957 {
958 if (wpa_s->current_ssid != ssid)
959 return;
960
961 wpa_dbg(wpa_s, MSG_DEBUG,
962 "Network bssid config changed for the current network - within-ESS roaming %s",
963 ssid->bssid_set ? "disabled" : "enabled");
964
965 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
966 ssid->bssid_set ? ssid->bssid : NULL);
967 }
968
969
wpas_notify_network_type_changed(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)970 void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
971 struct wpa_ssid *ssid)
972 {
973 #ifdef CONFIG_P2P
974 if (ssid->disabled == 2) {
975 /* Changed from normal network profile to persistent group */
976 ssid->disabled = 0;
977 wpas_dbus_unregister_network(wpa_s, ssid->id);
978 ssid->disabled = 2;
979 ssid->p2p_persistent_group = 1;
980 wpas_dbus_register_persistent_group(wpa_s, ssid);
981 } else {
982 /* Changed from persistent group to normal network profile */
983 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
984 ssid->p2p_persistent_group = 0;
985 wpas_dbus_register_network(wpa_s, ssid);
986 }
987 #endif /* CONFIG_P2P */
988 }
989
wpas_notify_anqp_query_done(struct wpa_supplicant * wpa_s,const u8 * bssid,const char * result,const struct wpa_bss_anqp * anqp)990 void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
991 const char *result,
992 const struct wpa_bss_anqp *anqp)
993 {
994 #ifdef CONFIG_INTERWORKING
995 if (!wpa_s || !bssid || !anqp)
996 return;
997
998 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
999 #endif /* CONFIG_INTERWORKING */
1000 }
1001
wpas_notify_hs20_icon_query_done(struct wpa_supplicant * wpa_s,const u8 * bssid,const char * file_name,const u8 * image,u32 image_length)1002 void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1003 const char* file_name, const u8* image,
1004 u32 image_length)
1005 {
1006 #ifdef CONFIG_HS20
1007 if (!wpa_s || !bssid || !file_name || !image)
1008 return;
1009
1010 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
1011 image_length);
1012 #endif /* CONFIG_HS20 */
1013 }
1014
wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant * wpa_s,const char * url,u8 osu_method)1015 void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1016 const char* url,
1017 u8 osu_method)
1018 {
1019 #ifdef CONFIG_HS20
1020 if (!wpa_s || !url)
1021 return;
1022
1023 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
1024 #endif /* CONFIG_HS20 */
1025 }
1026
wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant * wpa_s,u8 code,u16 reauth_delay,const char * url)1027 void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1028 u8 code, u16 reauth_delay,
1029 const char *url)
1030 {
1031 #ifdef CONFIG_HS20
1032 if (!wpa_s)
1033 return;
1034
1035 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
1036 url);
1037 #endif /* CONFIG_HS20 */
1038 }
1039
wpas_notify_hs20_rx_terms_and_conditions_acceptance(struct wpa_supplicant * wpa_s,const char * url)1040 void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
1041 struct wpa_supplicant *wpa_s, const char *url) {
1042 #ifdef CONFIG_HS20
1043 if (!wpa_s || !url)
1044 return;
1045
1046 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
1047 #endif /* CONFIG_HS20 */
1048 }
1049
1050 #ifdef CONFIG_MESH
1051
wpas_notify_mesh_group_started(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)1052 void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1053 struct wpa_ssid *ssid)
1054 {
1055 if (wpa_s->p2p_mgmt)
1056 return;
1057
1058 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1059 }
1060
1061
wpas_notify_mesh_group_removed(struct wpa_supplicant * wpa_s,const u8 * meshid,u8 meshid_len,u16 reason_code)1062 void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1063 const u8 *meshid, u8 meshid_len,
1064 u16 reason_code)
1065 {
1066 if (wpa_s->p2p_mgmt)
1067 return;
1068
1069 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1070 reason_code);
1071 }
1072
1073
wpas_notify_mesh_peer_connected(struct wpa_supplicant * wpa_s,const u8 * peer_addr)1074 void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1075 const u8 *peer_addr)
1076 {
1077 if (wpa_s->p2p_mgmt)
1078 return;
1079
1080 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1081 }
1082
1083
wpas_notify_mesh_peer_disconnected(struct wpa_supplicant * wpa_s,const u8 * peer_addr,u16 reason_code)1084 void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
1085 const u8 *peer_addr, u16 reason_code)
1086 {
1087 if (wpa_s->p2p_mgmt)
1088 return;
1089
1090 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1091 }
1092
1093 #endif /* CONFIG_MESH */
1094
1095 /*
1096 * DPP Notifications
1097 */
1098
1099 /* DPP Success notifications */
1100
wpas_notify_dpp_config_received(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)1101 void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
1102 struct wpa_ssid *ssid)
1103 {
1104 #ifdef CONFIG_DPP
1105 if (!wpa_s)
1106 return;
1107
1108 wpas_aidl_notify_dpp_config_received(wpa_s, ssid);
1109 #endif /* CONFIG_DPP */
1110 }
1111
wpas_notify_dpp_config_sent(struct wpa_supplicant * wpa_s)1112 void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
1113 {
1114 #ifdef CONFIG_DPP
1115 if (!wpa_s)
1116 return;
1117
1118 wpas_aidl_notify_dpp_config_sent(wpa_s);
1119 #endif /* CONFIG_DPP */
1120 }
1121
1122 /* DPP Progress notifications */
wpas_notify_dpp_auth_success(struct wpa_supplicant * wpa_s)1123 void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
1124 {
1125 #ifdef CONFIG_DPP
1126 if (!wpa_s)
1127 return;
1128
1129 wpas_aidl_notify_dpp_auth_success(wpa_s);
1130 #endif /* CONFIG_DPP */
1131 }
1132
wpas_notify_dpp_resp_pending(struct wpa_supplicant * wpa_s)1133 void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
1134 {
1135 #ifdef CONFIG_DPP
1136 if (!wpa_s)
1137 return;
1138
1139 wpas_aidl_notify_dpp_resp_pending(wpa_s);
1140 #endif /* CONFIG_DPP */
1141 }
1142
1143 /* DPP Failure notifications */
wpas_notify_dpp_not_compatible(struct wpa_supplicant * wpa_s)1144 void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
1145 {
1146 #ifdef CONFIG_DPP
1147 if (!wpa_s)
1148 return;
1149
1150 wpas_aidl_notify_dpp_not_compatible(wpa_s);
1151 #endif /* CONFIG_DPP */
1152 }
1153
wpas_notify_dpp_missing_auth(struct wpa_supplicant * wpa_s)1154 void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
1155 {
1156 #ifdef CONFIG_DPP
1157 if (!wpa_s)
1158 return;
1159
1160 wpas_aidl_notify_dpp_missing_auth(wpa_s);
1161 #endif /* CONFIG_DPP */
1162 }
1163
wpas_notify_dpp_configuration_failure(struct wpa_supplicant * wpa_s)1164 void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
1165 {
1166 #ifdef CONFIG_DPP
1167 if (!wpa_s)
1168 return;
1169
1170 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
1171 #endif /* CONFIG_DPP */
1172 }
1173
wpas_notify_dpp_timeout(struct wpa_supplicant * wpa_s)1174 void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
1175 {
1176 #ifdef CONFIG_DPP
1177 if (!wpa_s)
1178 return;
1179
1180 wpas_aidl_notify_dpp_timeout(wpa_s);
1181 #endif /* CONFIG_DPP */
1182 }
1183
wpas_notify_dpp_auth_failure(struct wpa_supplicant * wpa_s)1184 void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
1185 {
1186 #ifdef CONFIG_DPP
1187 if (!wpa_s)
1188 return;
1189
1190 wpas_aidl_notify_dpp_auth_failure(wpa_s);
1191 #endif /* CONFIG_DPP */
1192 }
1193
wpas_notify_dpp_failure(struct wpa_supplicant * wpa_s)1194 void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
1195 {
1196 #ifdef CONFIG_DPP
1197 if (!wpa_s)
1198 return;
1199
1200 wpas_aidl_notify_dpp_fail(wpa_s);
1201 #endif /* CONFIG_DPP */
1202 }
1203
wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant * wpa_s)1204 void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1205 {
1206 #ifdef CONFIG_DPP2
1207 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
1208 #endif /* CONFIG_DPP2 */
1209 }
1210
wpas_notify_dpp_config_accepted(struct wpa_supplicant * wpa_s)1211 void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1212 {
1213 #ifdef CONFIG_DPP2
1214 wpas_aidl_notify_dpp_config_accepted(wpa_s);
1215 #endif /* CONFIG_DPP2 */
1216 }
1217
wpas_notify_dpp_conn_status(struct wpa_supplicant * wpa_s,enum dpp_status_error status,const char * ssid,const char * channel_list,unsigned short band_list[],int size)1218 void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1219 enum dpp_status_error status, const char *ssid,
1220 const char *channel_list, unsigned short band_list[], int size)
1221 {
1222 #ifdef CONFIG_DPP2
1223 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
1224 #endif /* CONFIG_DPP2 */
1225 }
1226
wpas_notify_dpp_config_rejected(struct wpa_supplicant * wpa_s)1227 void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1228 {
1229 #ifdef CONFIG_DPP2
1230 wpas_aidl_notify_dpp_config_rejected(wpa_s);
1231 #endif /* CONFIG_DPP2 */
1232 }
1233
wpas_notify_pmk_cache_added(struct wpa_supplicant * wpa_s,struct rsn_pmksa_cache_entry * entry)1234 void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1235 struct rsn_pmksa_cache_entry *entry)
1236 {
1237 if (!wpa_s)
1238 return;
1239
1240 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
1241 }
1242
wpas_notify_transition_disable(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,u8 bitmap)1243 void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1244 struct wpa_ssid *ssid,
1245 u8 bitmap)
1246 {
1247 if (!wpa_s)
1248 return;
1249
1250 if (!ssid)
1251 return;
1252
1253 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
1254 }
1255
wpas_notify_network_not_found(struct wpa_supplicant * wpa_s)1256 void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1257 {
1258 if (!wpa_s)
1259 return;
1260
1261 wpas_aidl_notify_network_not_found(wpa_s);
1262 }
1263
1264 #ifdef CONFIG_INTERWORKING
1265
wpas_notify_interworking_ap_added(struct wpa_supplicant * wpa_s,struct wpa_bss * bss,struct wpa_cred * cred,int excluded,const char * type,int bh,int bss_load,int conn_capab)1266 void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1267 struct wpa_bss *bss,
1268 struct wpa_cred *cred, int excluded,
1269 const char *type, int bh, int bss_load,
1270 int conn_capab)
1271 {
1272 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1273 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1274 MAC2STR(bss->bssid), type,
1275 bh ? " below_min_backhaul=1" : "",
1276 bss_load ? " over_max_bss_load=1" : "",
1277 conn_capab ? " conn_capab_missing=1" : "",
1278 cred->id, cred->priority, cred->sp_priority);
1279
1280 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1281 bh, bss_load, conn_capab);
1282 }
1283
1284
wpas_notify_interworking_select_done(struct wpa_supplicant * wpa_s)1285 void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1286 {
1287 wpas_dbus_signal_interworking_select_done(wpa_s);
1288 }
1289
1290 #endif /* CONFIG_INTERWORKING */
1291
wpas_notify_eap_method_selected(struct wpa_supplicant * wpa_s,const char * reason_string)1292 void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1293 const char* reason_string)
1294 {
1295 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1296 }
1297
wpas_notify_ssid_temp_disabled(struct wpa_supplicant * wpa_s,const char * reason_string)1298 void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1299 const char *reason_string)
1300 {
1301 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1302 }
1303
wpas_notify_open_ssl_failure(struct wpa_supplicant * wpa_s,const char * reason_string)1304 void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1305 const char *reason_string)
1306 {
1307 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1308 }
1309
wpas_notify_qos_policy_reset(struct wpa_supplicant * wpa_s)1310 void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1311 {
1312 if (!wpa_s)
1313 return;
1314
1315 wpas_aidl_notify_qos_policy_reset(wpa_s);
1316 }
1317
wpas_notify_qos_policy_request(struct wpa_supplicant * wpa_s,struct dscp_policy_data * policies,int num_policies)1318 void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1319 struct dscp_policy_data *policies, int num_policies)
1320 {
1321 if (!wpa_s || !policies)
1322 return;
1323
1324 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1325 }
1326
wpas_notify_frequency_changed(struct wpa_supplicant * wpa_s,int frequency)1327 void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency)
1328 {
1329 if (!wpa_s)
1330 return;
1331
1332 wpas_aidl_notify_frequency_changed(wpa_s, frequency);
1333 }
1334