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 "common/nan_de.h"
14 #include "config.h"
15 #include "wpa_supplicant_i.h"
16 #include "wps_supplicant.h"
17 #include "dbus/dbus_common.h"
18 #include "dbus/dbus_new.h"
19 #include "rsn_supp/wpa.h"
20 #include "rsn_supp/pmksa_cache.h"
21 #include "fst/fst.h"
22 #include "crypto/tls.h"
23 #include "bss.h"
24 #include "driver_i.h"
25 #include "scan.h"
26 #include "p2p_supplicant.h"
27 #include "sme.h"
28 #include "notify.h"
29 #include "aidl/vendor/aidl.h"
30 #include "aidl/mainline/callback_bridge.h"
31
32 #ifdef MAINLINE_SUPPLICANT
33 #include "aidl/mainline/service.h"
34 #endif
35
wpas_notify_supplicant_initialized(struct wpa_global * global)36 int wpas_notify_supplicant_initialized(struct wpa_global *global)
37 {
38 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
39 if (global->params.dbus_ctrl_interface) {
40 global->dbus = wpas_dbus_init(global);
41 if (global->dbus == NULL)
42 return -1;
43 }
44 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
45
46 #ifdef CONFIG_AIDL
47 // Initialize AIDL here if daemonize is disabled.
48 // Otherwise initialize it later.
49 if (!global->params.daemonize) {
50 global->aidl = wpas_aidl_init(global);
51 if (!global->aidl)
52 return -1;
53 }
54 #endif /* CONFIG_AIDL */
55
56 #ifdef MAINLINE_SUPPLICANT
57 global->aidl = mainline_aidl_init(global);
58 if (!global->aidl)
59 return -1;
60 #endif /* MAINLINE_SUPPLICANT */
61
62 return 0;
63 }
64
65
wpas_notify_supplicant_deinitialized(struct wpa_global * global)66 void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
67 {
68 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
69 if (global->dbus)
70 wpas_dbus_deinit(global->dbus);
71 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
72
73 #ifdef CONFIG_AIDL
74 if (global->aidl)
75 wpas_aidl_deinit(global->aidl);
76 #endif /* CONFIG_AIDL */
77
78 #ifdef MAINLINE_SUPPLICANT
79 if (global->aidl)
80 mainline_aidl_deinit(global->aidl);
81 #endif /* MAINLINE_SUPPLICANT */
82
83 }
84
85
wpas_notify_iface_added(struct wpa_supplicant * wpa_s)86 int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
87 {
88 if (!wpa_s->p2p_mgmt) {
89 if (wpas_dbus_register_interface(wpa_s))
90 return -1;
91 }
92
93 #ifdef CONFIG_AIDL
94 /*
95 * AIDL initialization may not be complete here if daemonize is enabled.
96 * Initialization is done after daemonizing in order to avoid
97 * issues with the file descriptor.
98 */
99 if (!wpa_s->global->aidl)
100 return 0;
101 /* AIDL interface wants to keep track of the P2P mgmt iface. */
102 if (wpas_aidl_register_interface(wpa_s))
103 return -1;
104 #endif
105
106 return 0;
107 }
108
109
wpas_notify_iface_removed(struct wpa_supplicant * wpa_s)110 void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
111 {
112 if (!wpa_s->p2p_mgmt) {
113 /* unregister interface in new DBus ctrl iface */
114 wpas_dbus_unregister_interface(wpa_s);
115 }
116
117 /* AIDL interface wants to keep track of the P2P mgmt iface. */
118 wpas_aidl_unregister_interface(wpa_s);
119 }
120
121
wpas_notify_state_changed(struct wpa_supplicant * wpa_s,enum wpa_states new_state,enum wpa_states old_state)122 void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
123 enum wpa_states new_state,
124 enum wpa_states old_state)
125 {
126 struct wpa_ssid *ssid = wpa_s->current_ssid;
127
128 if (wpa_s->p2p_mgmt)
129 return;
130
131 /* notify the new DBus API */
132 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
133
134 #ifdef CONFIG_FST
135 if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
136 if (new_state == WPA_COMPLETED)
137 fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid);
138 else if (old_state >= WPA_ASSOCIATED &&
139 new_state < WPA_ASSOCIATED)
140 fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
141 }
142 #endif /* CONFIG_FST */
143
144 if (new_state == WPA_COMPLETED) {
145 wpas_p2p_notif_connected(wpa_s);
146 if (ssid)
147 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
148 ssid->bssid_set ? ssid->bssid : NULL);
149 } else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED) {
150 wpas_p2p_notif_disconnected(wpa_s);
151 }
152
153 sme_state_changed(wpa_s);
154
155 #ifdef ANDROID
156 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
157 "id=%d state=%d BSSID=" MACSTR " SSID=%s",
158 wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
159 new_state,
160 MAC2STR(wpa_s->bssid),
161 wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
162 wpa_ssid_txt(wpa_s->current_ssid->ssid,
163 wpa_s->current_ssid->ssid_len) : "");
164 #endif /* ANDROID */
165
166 wpas_aidl_notify_state_changed(wpa_s);
167 }
168
169
wpas_notify_disconnect_reason(struct wpa_supplicant * wpa_s)170 void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
171 {
172 if (wpa_s->p2p_mgmt)
173 return;
174
175 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
176
177 wpas_aidl_notify_disconnect_reason(wpa_s);
178 }
179
180
wpas_notify_mlo_info_change_reason(struct wpa_supplicant * wpa_s,enum mlo_info_change_reason reason)181 void wpas_notify_mlo_info_change_reason(struct wpa_supplicant *wpa_s,
182 enum mlo_info_change_reason reason)
183 {
184 if (wpa_s->p2p_mgmt)
185 return;
186
187 wpas_aidl_notify_mlo_info_change_reason(wpa_s, reason);
188 }
189
190
wpas_notify_auth_status_code(struct wpa_supplicant * wpa_s)191 void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s)
192 {
193 if (wpa_s->p2p_mgmt)
194 return;
195
196 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_STATUS_CODE);
197 }
198
199
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)200 void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
201 const u8 *bssid, u8 timed_out,
202 const u8 *assoc_resp_ie, size_t assoc_resp_ie_len)
203 {
204 if (wpa_s->p2p_mgmt)
205 return;
206
207 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
208
209 wpas_aidl_notify_assoc_reject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len);
210 }
211
wpas_notify_auth_timeout(struct wpa_supplicant * wpa_s)212 void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
213 if (wpa_s->p2p_mgmt)
214 return;
215
216 wpas_aidl_notify_auth_timeout(wpa_s);
217 }
218
wpas_notify_roam_time(struct wpa_supplicant * wpa_s)219 void wpas_notify_roam_time(struct wpa_supplicant *wpa_s)
220 {
221 if (wpa_s->p2p_mgmt)
222 return;
223
224 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME);
225 }
226
227
wpas_notify_roam_complete(struct wpa_supplicant * wpa_s)228 void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s)
229 {
230 if (wpa_s->p2p_mgmt)
231 return;
232
233 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE);
234 }
235
236
wpas_notify_scan_in_progress_6ghz(struct wpa_supplicant * wpa_s)237 void wpas_notify_scan_in_progress_6ghz(struct wpa_supplicant *wpa_s)
238 {
239 if (wpa_s->p2p_mgmt)
240 return;
241
242 wpas_dbus_signal_prop_changed(wpa_s,
243 WPAS_DBUS_PROP_SCAN_IN_PROGRESS_6GHZ);
244 }
245
246
wpas_notify_session_length(struct wpa_supplicant * wpa_s)247 void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
248 {
249 if (wpa_s->p2p_mgmt)
250 return;
251
252 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH);
253 }
254
255
wpas_notify_bss_tm_status(struct wpa_supplicant * wpa_s)256 void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
257 {
258 if (wpa_s->p2p_mgmt)
259 return;
260
261 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
262
263 #ifdef CONFIG_WNM
264 wpas_aidl_notify_bss_tm_status(wpa_s);
265 #endif
266 }
267
268
wpas_notify_network_changed(struct wpa_supplicant * wpa_s)269 void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
270 {
271 if (wpa_s->p2p_mgmt)
272 return;
273
274 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
275 }
276
277
wpas_notify_ap_scan_changed(struct wpa_supplicant * wpa_s)278 void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
279 {
280 if (wpa_s->p2p_mgmt)
281 return;
282
283 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
284 }
285
286
wpas_notify_bssid_changed(struct wpa_supplicant * wpa_s)287 void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
288 {
289 if (wpa_s->p2p_mgmt)
290 return;
291
292 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
293
294 wpas_aidl_notify_bssid_changed(wpa_s);
295 }
296
297
wpas_notify_mac_address_changed(struct wpa_supplicant * wpa_s)298 void wpas_notify_mac_address_changed(struct wpa_supplicant *wpa_s)
299 {
300 if (wpa_s->p2p_mgmt)
301 return;
302
303 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_MAC_ADDRESS);
304 }
305
306
wpas_notify_auth_changed(struct wpa_supplicant * wpa_s)307 void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
308 {
309 if (wpa_s->p2p_mgmt)
310 return;
311
312 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
313 }
314
315
wpas_notify_network_enabled_changed(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)316 void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
317 struct wpa_ssid *ssid)
318 {
319 if (wpa_s->p2p_mgmt)
320 return;
321
322 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
323 }
324
325
wpas_notify_network_selected(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)326 void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
327 struct wpa_ssid *ssid)
328 {
329 if (wpa_s->p2p_mgmt)
330 return;
331
332 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
333 }
334
335
wpas_notify_network_request(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,enum wpa_ctrl_req_type rtype,const char * default_txt)336 void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
337 struct wpa_ssid *ssid,
338 enum wpa_ctrl_req_type rtype,
339 const char *default_txt)
340 {
341 if (wpa_s->p2p_mgmt)
342 return;
343
344 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
345
346 wpas_aidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
347 }
348
349
wpas_notify_permanent_id_req_denied(struct wpa_supplicant * wpa_s)350 void wpas_notify_permanent_id_req_denied(struct wpa_supplicant *wpa_s)
351 {
352 wpas_aidl_notify_permanent_id_req_denied(wpa_s);
353 }
354
355
wpas_notify_scanning(struct wpa_supplicant * wpa_s)356 void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
357 {
358 if (wpa_s->p2p_mgmt)
359 return;
360
361 /* notify the new DBus API */
362 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
363 }
364
365
wpas_notify_scan_done(struct wpa_supplicant * wpa_s,int success)366 void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
367 {
368 if (wpa_s->p2p_mgmt)
369 return;
370
371 wpas_dbus_signal_scan_done(wpa_s, success);
372 }
373
374
wpas_notify_scan_results(struct wpa_supplicant * wpa_s)375 void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
376 {
377 if (wpa_s->p2p_mgmt)
378 return;
379
380 wpas_wps_notify_scan_results(wpa_s);
381 }
382
383
wpas_notify_wps_credential(struct wpa_supplicant * wpa_s,const struct wps_credential * cred)384 void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
385 const struct wps_credential *cred)
386 {
387 if (wpa_s->p2p_mgmt)
388 return;
389
390 #ifdef CONFIG_WPS
391 /* notify the new DBus API */
392 wpas_dbus_signal_wps_cred(wpa_s, cred);
393 #endif /* CONFIG_WPS */
394 }
395
396
wpas_notify_wps_event_m2d(struct wpa_supplicant * wpa_s,struct wps_event_m2d * m2d)397 void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
398 struct wps_event_m2d *m2d)
399 {
400 if (wpa_s->p2p_mgmt)
401 return;
402
403 #ifdef CONFIG_WPS
404 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
405 #endif /* CONFIG_WPS */
406 }
407
408
wpas_notify_wps_event_fail(struct wpa_supplicant * wpa_s,struct wps_event_fail * fail)409 void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
410 struct wps_event_fail *fail)
411 {
412 if (wpa_s->p2p_mgmt)
413 return;
414
415 #ifdef CONFIG_WPS
416 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
417
418 wpas_aidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
419 fail->config_error,
420 fail->error_indication);
421 #endif /* CONFIG_WPS */
422 }
423
424
wpas_notify_wps_event_success(struct wpa_supplicant * wpa_s)425 void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
426 {
427 if (wpa_s->p2p_mgmt)
428 return;
429
430 #ifdef CONFIG_WPS
431 wpas_dbus_signal_wps_event_success(wpa_s);
432
433 wpas_aidl_notify_wps_event_success(wpa_s);
434 #endif /* CONFIG_WPS */
435 }
436
wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant * wpa_s)437 void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
438 {
439 if (wpa_s->p2p_mgmt)
440 return;
441
442 #ifdef CONFIG_WPS
443 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
444
445 wpas_aidl_notify_wps_event_pbc_overlap(wpa_s);
446 #endif /* CONFIG_WPS */
447 }
448
449
wpas_notify_network_added(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)450 void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
451 struct wpa_ssid *ssid)
452 {
453 if (wpa_s->p2p_mgmt)
454 return;
455
456 /*
457 * Networks objects created during any P2P activities should not be
458 * exposed out. They might/will confuse certain non-P2P aware
459 * applications since these network objects won't behave like
460 * regular ones.
461 */
462 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
463 wpas_dbus_register_network(wpa_s, ssid);
464 wpas_aidl_register_network(wpa_s, ssid);
465 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_ADDED "%d",
466 ssid->id);
467 }
468 }
469
470
wpas_notify_persistent_group_added(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)471 void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
472 struct wpa_ssid *ssid)
473 {
474 #ifdef CONFIG_P2P
475 wpas_dbus_register_persistent_group(wpa_s, ssid);
476 wpas_aidl_register_network(wpa_s, ssid);
477 #endif /* CONFIG_P2P */
478 }
479
480
wpas_notify_persistent_group_removed(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)481 void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
482 struct wpa_ssid *ssid)
483 {
484 #ifdef CONFIG_P2P
485 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
486 wpas_aidl_unregister_network(wpa_s, ssid);
487 #endif /* CONFIG_P2P */
488 }
489
490
wpas_notify_network_removed(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)491 void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
492 struct wpa_ssid *ssid)
493 {
494 if (wpa_s->next_ssid == ssid)
495 wpa_s->next_ssid = NULL;
496 if (wpa_s->last_ssid == ssid)
497 wpa_s->last_ssid = NULL;
498 if (wpa_s->current_ssid == ssid)
499 wpa_s->current_ssid = NULL;
500 if (wpa_s->ml_connect_probe_ssid == ssid) {
501 wpa_s->ml_connect_probe_ssid = NULL;
502 wpa_s->ml_connect_probe_bss = NULL;
503 }
504 if (wpa_s->connect_without_scan == ssid)
505 wpa_s->connect_without_scan = NULL;
506 #if defined(CONFIG_SME) && defined(CONFIG_SAE)
507 if (wpa_s->sme.ext_auth_wpa_ssid == ssid)
508 wpa_s->sme.ext_auth_wpa_ssid = NULL;
509 #endif /* CONFIG_SME && CONFIG_SAE */
510 if (wpa_s->wpa) {
511 if ((wpa_key_mgmt_sae(ssid->key_mgmt) &&
512 (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_SAE_OFFLOAD_STA)) ||
513 ((ssid->key_mgmt & WPA_KEY_MGMT_OWE) &&
514 (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA))) {
515 /* For cases when PMK is generated at the driver */
516 struct wpa_pmkid_params params;
517
518 os_memset(¶ms, 0, sizeof(params));
519 params.ssid = ssid->ssid;
520 params.ssid_len = ssid->ssid_len;
521 wpa_drv_remove_pmkid(wpa_s, ¶ms);
522 }
523 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
524 }
525 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
526 !wpa_s->p2p_mgmt) {
527 wpas_dbus_unregister_network(wpa_s, ssid->id);
528 wpas_aidl_unregister_network(wpa_s, ssid);
529 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
530 ssid->id);
531 }
532 if (network_is_persistent_group(ssid))
533 wpas_notify_persistent_group_removed(wpa_s, ssid);
534
535 wpas_p2p_network_removed(wpa_s, ssid);
536 }
537
538
wpas_notify_bss_added(struct wpa_supplicant * wpa_s,u8 bssid[],unsigned int id)539 void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
540 u8 bssid[], unsigned int id)
541 {
542 if (wpa_s->p2p_mgmt)
543 return;
544
545 wpas_dbus_register_bss(wpa_s, bssid, id);
546 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
547 id, MAC2STR(bssid));
548 }
549
550
wpas_notify_bss_removed(struct wpa_supplicant * wpa_s,u8 bssid[],unsigned int id)551 void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
552 u8 bssid[], unsigned int id)
553 {
554 if (wpa_s->p2p_mgmt)
555 return;
556
557 wpas_dbus_unregister_bss(wpa_s, bssid, id);
558 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
559 id, MAC2STR(bssid));
560 }
561
562
wpas_notify_bss_freq_changed(struct wpa_supplicant * wpa_s,unsigned int id)563 void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
564 unsigned int id)
565 {
566 if (wpa_s->p2p_mgmt)
567 return;
568
569 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
570 }
571
572
wpas_notify_bss_signal_changed(struct wpa_supplicant * wpa_s,unsigned int id)573 void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
574 unsigned int id)
575 {
576 if (wpa_s->p2p_mgmt)
577 return;
578
579 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
580 id);
581 }
582
583
wpas_notify_bss_privacy_changed(struct wpa_supplicant * wpa_s,unsigned int id)584 void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
585 unsigned int id)
586 {
587 if (wpa_s->p2p_mgmt)
588 return;
589
590 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
591 id);
592 }
593
594
wpas_notify_bss_mode_changed(struct wpa_supplicant * wpa_s,unsigned int id)595 void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
596 unsigned int id)
597 {
598 if (wpa_s->p2p_mgmt)
599 return;
600
601 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
602 }
603
604
wpas_notify_bss_wpaie_changed(struct wpa_supplicant * wpa_s,unsigned int id)605 void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
606 unsigned int id)
607 {
608 if (wpa_s->p2p_mgmt)
609 return;
610
611 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
612 }
613
614
wpas_notify_bss_rsnie_changed(struct wpa_supplicant * wpa_s,unsigned int id)615 void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
616 unsigned int id)
617 {
618 if (wpa_s->p2p_mgmt)
619 return;
620
621 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
622 }
623
624
wpas_notify_bss_wps_changed(struct wpa_supplicant * wpa_s,unsigned int id)625 void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
626 unsigned int id)
627 {
628 if (wpa_s->p2p_mgmt)
629 return;
630
631 #ifdef CONFIG_WPS
632 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
633 #endif /* CONFIG_WPS */
634 }
635
636
wpas_notify_bss_ies_changed(struct wpa_supplicant * wpa_s,unsigned int id)637 void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
638 unsigned int id)
639 {
640 if (wpa_s->p2p_mgmt)
641 return;
642
643 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
644 }
645
646
wpas_notify_bss_rates_changed(struct wpa_supplicant * wpa_s,unsigned int id)647 void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
648 unsigned int id)
649 {
650 if (wpa_s->p2p_mgmt)
651 return;
652
653 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
654 }
655
656
wpas_notify_bss_seen(struct wpa_supplicant * wpa_s,unsigned int id)657 void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
658 {
659 if (wpa_s->p2p_mgmt)
660 return;
661
662 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
663 }
664
665
wpas_notify_bss_anqp_changed(struct wpa_supplicant * wpa_s,unsigned int id)666 void wpas_notify_bss_anqp_changed(struct wpa_supplicant *wpa_s, unsigned int id)
667 {
668 if (wpa_s->p2p_mgmt)
669 return;
670
671 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_ANQP, id);
672 }
673
674
wpas_notify_blob_added(struct wpa_supplicant * wpa_s,const char * name)675 void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
676 {
677 if (wpa_s->p2p_mgmt)
678 return;
679
680 wpas_dbus_signal_blob_added(wpa_s, name);
681 }
682
683
wpas_notify_blob_removed(struct wpa_supplicant * wpa_s,const char * name)684 void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
685 {
686 if (wpa_s->p2p_mgmt)
687 return;
688
689 wpas_dbus_signal_blob_removed(wpa_s, name);
690 }
691
692
wpas_notify_debug_level_changed(struct wpa_global * global)693 void wpas_notify_debug_level_changed(struct wpa_global *global)
694 {
695 wpas_dbus_signal_debug_level_changed(global);
696 }
697
698
wpas_notify_debug_timestamp_changed(struct wpa_global * global)699 void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
700 {
701 wpas_dbus_signal_debug_timestamp_changed(global);
702 }
703
704
wpas_notify_debug_show_keys_changed(struct wpa_global * global)705 void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
706 {
707 wpas_dbus_signal_debug_show_keys_changed(global);
708 }
709
710
wpas_notify_suspend(struct wpa_global * global)711 void wpas_notify_suspend(struct wpa_global *global)
712 {
713 struct wpa_supplicant *wpa_s;
714
715 os_get_time(&global->suspend_time);
716 wpa_printf(MSG_DEBUG, "System suspend notification");
717 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
718 wpa_drv_suspend(wpa_s);
719 }
720
721
wpas_notify_resume(struct wpa_global * global)722 void wpas_notify_resume(struct wpa_global *global)
723 {
724 struct os_time now;
725 int slept;
726 struct wpa_supplicant *wpa_s;
727
728 if (global->suspend_time.sec == 0)
729 slept = -1;
730 else {
731 os_get_time(&now);
732 slept = now.sec - global->suspend_time.sec;
733 }
734 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
735 slept);
736
737 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
738 wpa_drv_resume(wpa_s);
739 if (wpa_s->wpa_state == WPA_DISCONNECTED)
740 wpa_supplicant_req_scan(wpa_s, 0, 100000);
741 }
742 }
743
744
745 #ifdef CONFIG_P2P
746
wpas_notify_p2p_find_stopped(struct wpa_supplicant * wpa_s)747 void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
748 {
749 /* Notify P2P find has stopped */
750 wpas_dbus_signal_p2p_find_stopped(wpa_s);
751
752 wpas_aidl_notify_p2p_find_stopped(wpa_s);
753 }
754
755
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)756 void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
757 const u8 *addr, const struct p2p_peer_info *info,
758 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
759 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
760 int new_device)
761 {
762 if (new_device) {
763 /* Create the new peer object */
764 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
765 }
766
767 /* Notify a new peer has been detected*/
768 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
769
770 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
771 peer_wfd_device_info,
772 peer_wfd_device_info_len,
773 peer_wfd_r2_device_info,
774 peer_wfd_r2_device_info_len);
775 }
776
777
wpas_notify_p2p_device_lost(struct wpa_supplicant * wpa_s,const u8 * dev_addr)778 void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
779 const u8 *dev_addr)
780 {
781 wpas_dbus_unregister_peer(wpa_s, dev_addr);
782
783 /* Create signal on interface object*/
784 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
785
786 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
787 }
788
789
wpas_notify_p2p_group_removed(struct wpa_supplicant * wpa_s,const struct wpa_ssid * ssid,const char * role)790 void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
791 const struct wpa_ssid *ssid,
792 const char *role)
793 {
794 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
795
796 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
797
798 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
799 }
800
801
wpas_notify_p2p_go_neg_req(struct wpa_supplicant * wpa_s,const u8 * src,u16 dev_passwd_id,u8 go_intent)802 void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
803 const u8 *src, u16 dev_passwd_id, u8 go_intent)
804 {
805 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
806
807 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
808 }
809
810
wpas_notify_p2p_go_neg_completed(struct wpa_supplicant * wpa_s,struct p2p_go_neg_results * res)811 void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
812 struct p2p_go_neg_results *res)
813 {
814 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
815
816 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
817 }
818
819
wpas_notify_p2p_invitation_result(struct wpa_supplicant * wpa_s,int status,const u8 * bssid)820 void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
821 int status, const u8 *bssid)
822 {
823 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
824
825 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
826 }
827
828
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)829 void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
830 int freq, const u8 *sa, u8 dialog_token,
831 u16 update_indic, const u8 *tlvs,
832 size_t tlvs_len)
833 {
834 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
835 update_indic, tlvs, tlvs_len);
836 }
837
838
wpas_notify_p2p_sd_response(struct wpa_supplicant * wpa_s,const u8 * sa,u16 update_indic,const u8 * tlvs,size_t tlvs_len)839 void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
840 const u8 *sa, u16 update_indic,
841 const u8 *tlvs, size_t tlvs_len)
842 {
843 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
844 tlvs, tlvs_len);
845
846 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
847 tlvs, tlvs_len);
848 }
849
850
851 /**
852 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
853 * @dev_addr: Who sent the request or responded to our request.
854 * @request: Will be 1 if request, 0 for response.
855 * @status: Valid only in case of response (0 in case of success)
856 * @config_methods: WPS config methods
857 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
858 * @group_ifname: Group interface name of the group owner in case the provision
859 * discovery request is received with P2P Group ID attribute.
860 * i.e., valid only when the peer device is joining an
861 * operating P2P group.
862 *
863 * This can be used to notify:
864 * - Requests or responses
865 * - Various config methods
866 * - Failure condition in case of response
867 */
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,const char * group_ifname)868 void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
869 const u8 *dev_addr, int request,
870 enum p2p_prov_disc_status status,
871 u16 config_methods,
872 unsigned int generated_pin,
873 const char *group_ifname)
874 {
875 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
876 status, config_methods,
877 generated_pin);
878
879 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
880 status, config_methods,
881 generated_pin, group_ifname);
882
883 }
884
885
wpas_notify_p2p_group_started(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,int persistent,int client,const u8 * ip)886 void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
887 struct wpa_ssid *ssid, int persistent,
888 int client, const u8 *ip)
889 {
890 /* Notify a group has been started */
891 wpas_dbus_register_p2p_group(wpa_s, ssid);
892
893 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
894
895 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client, ip);
896 }
897
898
wpas_notify_p2p_group_formation_failure(struct wpa_supplicant * wpa_s,const char * reason)899 void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
900 const char *reason)
901 {
902 /* Notify a group formation failed */
903 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
904
905 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
906 }
907
908
wpas_notify_p2p_wps_failed(struct wpa_supplicant * wpa_s,struct wps_event_fail * fail)909 void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
910 struct wps_event_fail *fail)
911 {
912 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
913 }
914
915
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)916 void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
917 const u8 *sa, const u8 *go_dev_addr,
918 const u8 *bssid, int id, int op_freq)
919 {
920 /* Notify a P2P Invitation Request */
921 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
922 id, op_freq);
923
924 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
925 id, op_freq);
926 }
927
wpas_notify_p2p_bootstrap_req(struct wpa_supplicant * wpa_s,const u8 * src,u16 bootstrap_method)928 void wpas_notify_p2p_bootstrap_req(struct wpa_supplicant *wpa_s,
929 const u8 *src, u16 bootstrap_method)
930 {
931 wpas_dbus_signal_p2p_bootstrap_req(wpa_s, src, bootstrap_method);
932 wpas_aidl_notify_p2p_bootstrap_request(wpa_s, src, P2P_SC_SUCCESS, bootstrap_method, NULL);
933 }
934
wpas_notify_p2p_bootstrap_rsp(struct wpa_supplicant * wpa_s,const u8 * src,int status,u16 bootstrap_method)935 void wpas_notify_p2p_bootstrap_rsp(struct wpa_supplicant *wpa_s,
936 const u8 *src, int status,
937 u16 bootstrap_method)
938 {
939 wpas_dbus_signal_p2p_bootstrap_rsp(wpa_s, src, status,
940 bootstrap_method);
941 wpas_aidl_notify_p2p_bootstrap_response(wpa_s, src, status, bootstrap_method, NULL);
942 }
943
944 #endif /* CONFIG_P2P */
945
946
wpas_notify_ap_sta_authorized(struct wpa_supplicant * wpa_s,const u8 * sta,const u8 * p2p_dev_addr,const u8 * ip)947 static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
948 const u8 *sta,
949 const u8 *p2p_dev_addr, const u8 *ip)
950 {
951 #ifdef CONFIG_P2P
952 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
953
954 /*
955 * Create 'peer-joined' signal on group object -- will also
956 * check P2P itself.
957 */
958 if (p2p_dev_addr)
959 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
960 #endif /* CONFIG_P2P */
961
962 /* Register the station */
963 wpas_dbus_register_sta(wpa_s, sta);
964
965 /* Notify listeners a new station has been authorized */
966 wpas_dbus_signal_sta_authorized(wpa_s, sta);
967
968 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr, ip);
969 }
970
971
wpas_notify_ap_sta_deauthorized(struct wpa_supplicant * wpa_s,const u8 * sta,const u8 * p2p_dev_addr)972 static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
973 const u8 *sta,
974 const u8 *p2p_dev_addr)
975 {
976 #ifdef CONFIG_P2P
977 /*
978 * Create 'peer-disconnected' signal on group object if this
979 * is a P2P group.
980 */
981 if (p2p_dev_addr)
982 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
983 #endif /* CONFIG_P2P */
984
985 /* Notify listeners a station has been deauthorized */
986 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
987
988 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
989 /* Unregister the station */
990 wpas_dbus_unregister_sta(wpa_s, sta);
991 }
992
993
wpas_notify_sta_authorized(struct wpa_supplicant * wpa_s,const u8 * mac_addr,int authorized,const u8 * p2p_dev_addr,const u8 * ip)994 void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
995 const u8 *mac_addr, int authorized,
996 const u8 *p2p_dev_addr, const u8 *ip)
997 {
998 if (authorized)
999 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr,
1000 ip);
1001 else
1002 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
1003 }
1004
1005
wpas_notify_certification(struct wpa_supplicant * wpa_s,struct tls_cert_data * cert,const char * cert_hash)1006 void wpas_notify_certification(struct wpa_supplicant *wpa_s,
1007 struct tls_cert_data *cert,
1008 const char *cert_hash)
1009 {
1010 int i;
1011
1012 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
1013 "depth=%d subject='%s'%s%s%s%s",
1014 cert->depth, cert->subject, cert_hash ? " hash=" : "",
1015 cert_hash ? cert_hash : "",
1016 cert->tod == 2 ? " tod=2" : "",
1017 cert->tod == 1 ? " tod=1" : "");
1018
1019 if (cert->cert) {
1020 char *cert_hex;
1021 size_t len = wpabuf_len(cert->cert) * 2 + 1;
1022 cert_hex = os_malloc(len);
1023 if (cert_hex) {
1024 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
1025 wpabuf_len(cert->cert));
1026 wpa_msg_ctrl(wpa_s, MSG_INFO,
1027 WPA_EVENT_EAP_PEER_CERT
1028 "depth=%d subject='%s' cert=%s",
1029 cert->depth, cert->subject, cert_hex);
1030 os_free(cert_hex);
1031 }
1032 }
1033
1034 for (i = 0; i < cert->num_altsubject; i++)
1035 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
1036 "depth=%d %s", cert->depth, cert->altsubject[i]);
1037
1038 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
1039 cert->altsubject, cert->num_altsubject,
1040 cert_hash, cert->cert);
1041
1042 /* notify the new DBus API */
1043 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
1044 cert->altsubject, cert->num_altsubject,
1045 cert_hash, cert->cert);
1046 }
1047
1048
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)1049 void wpas_notify_preq(struct wpa_supplicant *wpa_s,
1050 const u8 *addr, const u8 *dst, const u8 *bssid,
1051 const u8 *ie, size_t ie_len, u32 ssi_signal)
1052 {
1053 #ifdef CONFIG_AP
1054 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
1055 #endif /* CONFIG_AP */
1056 }
1057
1058
wpas_notify_eap_status(struct wpa_supplicant * wpa_s,const char * status,const char * parameter)1059 void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
1060 const char *parameter)
1061 {
1062 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
1063 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
1064 "status='%s' parameter='%s'",
1065 status, parameter);
1066 }
1067
1068
wpas_notify_eap_error(struct wpa_supplicant * wpa_s,int error_code)1069 void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
1070 {
1071 wpa_dbg(wpa_s, MSG_ERROR,
1072 "EAP Error code = %d", error_code);
1073 wpas_aidl_notify_eap_error(wpa_s, error_code);
1074 }
1075
1076
wpas_notify_psk_mismatch(struct wpa_supplicant * wpa_s)1077 void wpas_notify_psk_mismatch(struct wpa_supplicant *wpa_s)
1078 {
1079 wpas_dbus_signal_psk_mismatch(wpa_s);
1080 }
1081
1082
wpas_notify_network_bssid_set_changed(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)1083 void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
1084 struct wpa_ssid *ssid)
1085 {
1086 if (wpa_s->current_ssid != ssid)
1087 return;
1088
1089 wpa_dbg(wpa_s, MSG_DEBUG,
1090 "Network bssid config changed for the current network - within-ESS roaming %s",
1091 ssid->bssid_set ? "disabled" : "enabled");
1092
1093 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
1094 ssid->bssid_set ? ssid->bssid : NULL);
1095 }
1096
1097
wpas_notify_network_type_changed(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)1098 void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
1099 struct wpa_ssid *ssid)
1100 {
1101 #ifdef CONFIG_P2P
1102 if (ssid->disabled == 2) {
1103 /* Changed from normal network profile to persistent group */
1104 ssid->disabled = 0;
1105 wpas_dbus_unregister_network(wpa_s, ssid->id);
1106 ssid->disabled = 2;
1107 ssid->p2p_persistent_group = 1;
1108 wpas_dbus_register_persistent_group(wpa_s, ssid);
1109 } else {
1110 /* Changed from persistent group to normal network profile */
1111 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
1112 ssid->p2p_persistent_group = 0;
1113 wpas_dbus_register_network(wpa_s, ssid);
1114 }
1115 #endif /* CONFIG_P2P */
1116 }
1117
wpas_notify_anqp_query_done(struct wpa_supplicant * wpa_s,const u8 * bssid,const char * result,const struct wpa_bss_anqp * anqp)1118 void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1119 const char *result,
1120 const struct wpa_bss_anqp *anqp)
1121 {
1122 wpa_msg(wpa_s, MSG_INFO, ANQP_QUERY_DONE "addr=" MACSTR " result=%s",
1123 MAC2STR(bssid), result);
1124 #ifdef CONFIG_INTERWORKING
1125 if (!wpa_s || !bssid || !anqp)
1126 return;
1127
1128 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
1129 wpas_dbus_signal_anqp_query_done(wpa_s, bssid, result);
1130 #endif /* CONFIG_INTERWORKING */
1131 }
1132
wpas_notify_hs20_icon_query_done(struct wpa_supplicant * wpa_s,const u8 * bssid,const char * file_name,const u8 * image,u32 image_length)1133 void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1134 const char* file_name, const u8* image,
1135 u32 image_length)
1136 {
1137 #ifdef CONFIG_HS20
1138 if (!wpa_s || !bssid || !file_name || !image)
1139 return;
1140
1141 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
1142 image_length);
1143 #endif /* CONFIG_HS20 */
1144 }
1145
wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant * wpa_s,const char * url,u8 osu_method)1146 void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1147 const char* url,
1148 u8 osu_method)
1149 {
1150 #ifdef CONFIG_HS20
1151 if (!wpa_s || !url)
1152 return;
1153
1154 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
1155 #endif /* CONFIG_HS20 */
1156 }
1157
wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant * wpa_s,u8 code,u16 reauth_delay,const char * url)1158 void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1159 u8 code, u16 reauth_delay,
1160 const char *url)
1161 {
1162 #ifdef CONFIG_HS20
1163 if (!wpa_s)
1164 return;
1165
1166 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
1167 url);
1168 #endif /* CONFIG_HS20 */
1169 }
1170
1171
1172 #ifdef CONFIG_MESH
1173
wpas_notify_mesh_group_started(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid)1174 void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1175 struct wpa_ssid *ssid)
1176 {
1177 if (wpa_s->p2p_mgmt)
1178 return;
1179
1180 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1181 }
1182
1183
wpas_notify_mesh_group_removed(struct wpa_supplicant * wpa_s,const u8 * meshid,u8 meshid_len,u16 reason_code)1184 void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1185 const u8 *meshid, u8 meshid_len,
1186 u16 reason_code)
1187 {
1188 if (wpa_s->p2p_mgmt)
1189 return;
1190
1191 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1192 reason_code);
1193 }
1194
1195
wpas_notify_mesh_peer_connected(struct wpa_supplicant * wpa_s,const u8 * peer_addr)1196 void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1197 const u8 *peer_addr)
1198 {
1199 if (wpa_s->p2p_mgmt)
1200 return;
1201
1202 wpa_msg(wpa_s, MSG_INFO, MESH_PEER_CONNECTED MACSTR,
1203 MAC2STR(peer_addr));
1204 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1205 }
1206
1207
wpas_notify_mesh_peer_disconnected(struct wpa_supplicant * wpa_s,const u8 * peer_addr,u16 reason_code)1208 void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
1209 const u8 *peer_addr, u16 reason_code)
1210 {
1211 if (wpa_s->p2p_mgmt)
1212 return;
1213
1214 wpa_msg(wpa_s, MSG_INFO, MESH_PEER_DISCONNECTED MACSTR,
1215 MAC2STR(peer_addr));
1216 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1217 }
1218
1219 #endif /* CONFIG_MESH */
1220
1221 /*
1222 * DPP Notifications
1223 */
1224
1225 /* DPP Success notifications */
1226
wpas_notify_dpp_config_received(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,bool conn_status_requested)1227 void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
1228 struct wpa_ssid *ssid, bool conn_status_requested)
1229 {
1230 #ifdef CONFIG_DPP
1231 if (!wpa_s)
1232 return;
1233
1234 wpas_aidl_notify_dpp_config_received(wpa_s, ssid, conn_status_requested);
1235 #endif /* CONFIG_DPP */
1236 }
1237
wpas_notify_dpp_config_sent(struct wpa_supplicant * wpa_s)1238 void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
1239 {
1240 #ifdef CONFIG_DPP
1241 if (!wpa_s)
1242 return;
1243
1244 wpas_aidl_notify_dpp_config_sent(wpa_s);
1245 #endif /* CONFIG_DPP */
1246 }
1247
1248 #ifdef CONFIG_DPP
wpas_notify_dpp_connection_status_sent(struct wpa_supplicant * wpa_s,enum dpp_status_error result)1249 void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
1250 enum dpp_status_error result)
1251 {
1252 #ifdef CONFIG_DPP2
1253 if (!wpa_s)
1254 return;
1255
1256 wpas_aidl_notify_dpp_connection_status_sent(wpa_s, result);
1257 #endif /* CONFIG_DPP2 */
1258 }
1259 #endif /* CONFIG_DPP */
1260
1261 /* DPP Progress notifications */
wpas_notify_dpp_auth_success(struct wpa_supplicant * wpa_s)1262 void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
1263 {
1264 #ifdef CONFIG_DPP
1265 if (!wpa_s)
1266 return;
1267
1268 wpas_aidl_notify_dpp_auth_success(wpa_s);
1269 #endif /* CONFIG_DPP */
1270 }
1271
wpas_notify_dpp_resp_pending(struct wpa_supplicant * wpa_s)1272 void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
1273 {
1274 #ifdef CONFIG_DPP
1275 if (!wpa_s)
1276 return;
1277
1278 wpas_aidl_notify_dpp_resp_pending(wpa_s);
1279 #endif /* CONFIG_DPP */
1280 }
1281
1282 /* DPP Failure notifications */
wpas_notify_dpp_not_compatible(struct wpa_supplicant * wpa_s)1283 void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
1284 {
1285 #ifdef CONFIG_DPP
1286 if (!wpa_s)
1287 return;
1288
1289 wpas_aidl_notify_dpp_not_compatible(wpa_s);
1290 #endif /* CONFIG_DPP */
1291 }
1292
wpas_notify_dpp_missing_auth(struct wpa_supplicant * wpa_s)1293 void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
1294 {
1295 #ifdef CONFIG_DPP
1296 if (!wpa_s)
1297 return;
1298
1299 wpas_aidl_notify_dpp_missing_auth(wpa_s);
1300 #endif /* CONFIG_DPP */
1301 }
1302
wpas_notify_dpp_configuration_failure(struct wpa_supplicant * wpa_s)1303 void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
1304 {
1305 #ifdef CONFIG_DPP
1306 if (!wpa_s)
1307 return;
1308
1309 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
1310 #endif /* CONFIG_DPP */
1311 }
1312
wpas_notify_dpp_timeout(struct wpa_supplicant * wpa_s)1313 void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
1314 {
1315 #ifdef CONFIG_DPP
1316 if (!wpa_s)
1317 return;
1318
1319 wpas_aidl_notify_dpp_timeout(wpa_s);
1320 #endif /* CONFIG_DPP */
1321 }
1322
wpas_notify_dpp_auth_failure(struct wpa_supplicant * wpa_s)1323 void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
1324 {
1325 #ifdef CONFIG_DPP
1326 if (!wpa_s)
1327 return;
1328
1329 wpas_aidl_notify_dpp_auth_failure(wpa_s);
1330 #endif /* CONFIG_DPP */
1331 }
1332
wpas_notify_dpp_failure(struct wpa_supplicant * wpa_s)1333 void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
1334 {
1335 #ifdef CONFIG_DPP
1336 if (!wpa_s)
1337 return;
1338
1339 wpas_aidl_notify_dpp_fail(wpa_s);
1340 #endif /* CONFIG_DPP */
1341 }
1342
wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant * wpa_s)1343 void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1344 {
1345 #ifdef CONFIG_DPP2
1346 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
1347 #endif /* CONFIG_DPP2 */
1348 }
1349
wpas_notify_dpp_config_accepted(struct wpa_supplicant * wpa_s)1350 void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1351 {
1352 #ifdef CONFIG_DPP2
1353 wpas_aidl_notify_dpp_config_accepted(wpa_s);
1354 #endif /* CONFIG_DPP2 */
1355 }
1356
1357 #ifdef CONFIG_DPP
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)1358 void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1359 enum dpp_status_error status, const char *ssid,
1360 const char *channel_list, unsigned short band_list[], int size)
1361 {
1362 #ifdef CONFIG_DPP2
1363 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
1364 #endif /* CONFIG_DPP2 */
1365 }
1366 #endif /* CONFIG_DPP */
1367
wpas_notify_dpp_config_rejected(struct wpa_supplicant * wpa_s)1368 void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1369 {
1370 #ifdef CONFIG_DPP2
1371 wpas_aidl_notify_dpp_config_rejected(wpa_s);
1372 #endif /* CONFIG_DPP2 */
1373 }
1374
wpas_notify_pmk_cache_added(struct wpa_supplicant * wpa_s,struct rsn_pmksa_cache_entry * entry)1375 void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1376 struct rsn_pmksa_cache_entry *entry)
1377 {
1378 if (!wpa_s)
1379 return;
1380
1381 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
1382 }
1383
wpas_notify_transition_disable(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,u8 bitmap)1384 void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1385 struct wpa_ssid *ssid,
1386 u8 bitmap)
1387 {
1388 if (!wpa_s)
1389 return;
1390
1391 if (!ssid)
1392 return;
1393
1394 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
1395 }
1396
wpas_notify_network_not_found(struct wpa_supplicant * wpa_s)1397 void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1398 {
1399 if (!wpa_s)
1400 return;
1401
1402 wpas_aidl_notify_network_not_found(wpa_s);
1403 }
1404
1405 #ifdef CONFIG_INTERWORKING
1406
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)1407 void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1408 struct wpa_bss *bss,
1409 struct wpa_cred *cred, int excluded,
1410 const char *type, int bh, int bss_load,
1411 int conn_capab)
1412 {
1413 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1414 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1415 MAC2STR(bss->bssid), type,
1416 bh ? " below_min_backhaul=1" : "",
1417 bss_load ? " over_max_bss_load=1" : "",
1418 conn_capab ? " conn_capab_missing=1" : "",
1419 cred->id, cred->priority, cred->sp_priority);
1420
1421 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1422 bh, bss_load, conn_capab);
1423 }
1424
1425
wpas_notify_interworking_select_done(struct wpa_supplicant * wpa_s)1426 void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1427 {
1428 wpas_dbus_signal_interworking_select_done(wpa_s);
1429 }
1430
1431
1432 #endif /* CONFIG_INTERWORKING */
1433
wpas_notify_eap_method_selected(struct wpa_supplicant * wpa_s,const char * reason_string)1434 void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1435 const char* reason_string)
1436 {
1437 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1438 }
1439
wpas_notify_ssid_temp_disabled(struct wpa_supplicant * wpa_s,const char * reason_string)1440 void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1441 const char *reason_string)
1442 {
1443 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1444 }
1445
wpas_notify_open_ssl_failure(struct wpa_supplicant * wpa_s,const char * reason_string)1446 void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1447 const char *reason_string)
1448 {
1449 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1450 }
1451
wpas_notify_qos_policy_reset(struct wpa_supplicant * wpa_s)1452 void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1453 {
1454 if (!wpa_s)
1455 return;
1456
1457 wpas_aidl_notify_qos_policy_reset(wpa_s);
1458 }
1459
wpas_notify_qos_policy_request(struct wpa_supplicant * wpa_s,struct dscp_policy_data * policies,int num_policies)1460 void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1461 struct dscp_policy_data *policies, int num_policies)
1462 {
1463 if (!wpa_s || !policies)
1464 return;
1465
1466 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1467 }
1468
wpas_notify_frequency_changed(struct wpa_supplicant * wpa_s,int frequency)1469 void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency)
1470 {
1471 if (!wpa_s)
1472 return;
1473
1474 wpas_aidl_notify_frequency_changed(wpa_s, frequency);
1475 }
1476
wpas_get_certificate(const char * alias,uint8_t ** value)1477 ssize_t wpas_get_certificate(const char *alias, uint8_t** value)
1478 {
1479 wpa_printf(MSG_INFO, "wpas_get_certificate");
1480 return wpas_aidl_get_certificate(alias, value);
1481 }
1482
wpas_list_aliases(const char * prefix,char *** aliases)1483 ssize_t wpas_list_aliases(const char *prefix, char ***aliases)
1484 {
1485 return wpas_aidl_list_aliases(prefix, aliases);
1486 }
1487
wpas_notify_signal_change(struct wpa_supplicant * wpa_s)1488 void wpas_notify_signal_change(struct wpa_supplicant *wpa_s)
1489 {
1490 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SIGNAL_CHANGE);
1491 }
1492
wpas_notify_qos_policy_scs_response(struct wpa_supplicant * wpa_s,unsigned int num_scs_resp,int ** scs_resp)1493 void wpas_notify_qos_policy_scs_response(struct wpa_supplicant *wpa_s,
1494 unsigned int num_scs_resp, int **scs_resp)
1495 {
1496 if (!wpa_s || !num_scs_resp || !scs_resp)
1497 return;
1498
1499 wpas_aidl_notify_qos_policy_scs_response(wpa_s, num_scs_resp, scs_resp);
1500 }
1501
wpas_notify_hs20_t_c_acceptance(struct wpa_supplicant * wpa_s,const char * url)1502 void wpas_notify_hs20_t_c_acceptance(struct wpa_supplicant *wpa_s,
1503 const char *url)
1504 {
1505 #ifdef CONFIG_HS20
1506 if (!wpa_s || !url)
1507 return;
1508
1509 wpa_msg(wpa_s, MSG_INFO, HS20_T_C_ACCEPTANCE "%s", url);
1510 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
1511 wpas_dbus_signal_hs20_t_c_acceptance(wpa_s, url);
1512 #endif /* CONFIG_HS20 */
1513 }
1514
1515 #ifdef CONFIG_NAN_USD
1516
wpas_notify_nan_discovery_result(struct wpa_supplicant * wpa_s,enum nan_service_protocol_type srv_proto_type,int subscribe_id,int peer_publish_id,const u8 * peer_addr,bool fsd,bool fsd_gas,const u8 * ssi,size_t ssi_len)1517 void wpas_notify_nan_discovery_result(struct wpa_supplicant *wpa_s,
1518 enum nan_service_protocol_type
1519 srv_proto_type,
1520 int subscribe_id, int peer_publish_id,
1521 const u8 *peer_addr,
1522 bool fsd, bool fsd_gas,
1523 const u8 *ssi, size_t ssi_len)
1524 {
1525 char *ssi_hex;
1526
1527 ssi_hex = os_zalloc(2 * ssi_len + 1);
1528 if (!ssi_hex)
1529 return;
1530 if (ssi)
1531 wpa_snprintf_hex(ssi_hex, 2 * ssi_len + 1, ssi, ssi_len);
1532 wpa_msg_global(wpa_s, MSG_INFO, NAN_DISCOVERY_RESULT
1533 "subscribe_id=%d publish_id=%d address=" MACSTR
1534 " fsd=%d fsd_gas=%d srv_proto_type=%u ssi=%s",
1535 subscribe_id, peer_publish_id, MAC2STR(peer_addr),
1536 fsd, fsd_gas, srv_proto_type, ssi_hex);
1537 os_free(ssi_hex);
1538
1539 wpas_aidl_notify_usd_service_discovered(wpa_s, srv_proto_type,
1540 subscribe_id, peer_publish_id, peer_addr, fsd, ssi, ssi_len);
1541 mainline_aidl_notify_usd_service_discovered(wpa_s, srv_proto_type,
1542 subscribe_id, peer_publish_id, peer_addr, fsd, ssi, ssi_len);
1543
1544 wpas_dbus_signal_nan_discovery_result(wpa_s, srv_proto_type,
1545 subscribe_id, peer_publish_id,
1546 peer_addr, fsd, fsd_gas,
1547 ssi, ssi_len);
1548 }
1549
1550
wpas_notify_nan_replied(struct wpa_supplicant * wpa_s,enum nan_service_protocol_type srv_proto_type,int publish_id,int peer_subscribe_id,const u8 * peer_addr,const u8 * ssi,size_t ssi_len)1551 void wpas_notify_nan_replied(struct wpa_supplicant *wpa_s,
1552 enum nan_service_protocol_type srv_proto_type,
1553 int publish_id, int peer_subscribe_id,
1554 const u8 *peer_addr,
1555 const u8 *ssi, size_t ssi_len)
1556 {
1557 char *ssi_hex;
1558
1559 ssi_hex = os_zalloc(2 * ssi_len + 1);
1560 if (!ssi_hex)
1561 return;
1562 if (ssi)
1563 wpa_snprintf_hex(ssi_hex, 2 * ssi_len + 1, ssi, ssi_len);
1564 wpa_msg_global(wpa_s, MSG_INFO, NAN_REPLIED
1565 "publish_id=%d address=" MACSTR
1566 " subscribe_id=%d srv_proto_type=%u ssi=%s",
1567 publish_id, MAC2STR(peer_addr), peer_subscribe_id,
1568 srv_proto_type, ssi_hex);
1569 os_free(ssi_hex);
1570
1571 wpas_aidl_notify_usd_publish_replied(wpa_s, srv_proto_type,
1572 publish_id, peer_subscribe_id, peer_addr, ssi, ssi_len);
1573 mainline_aidl_notify_usd_publish_replied(wpa_s, srv_proto_type,
1574 publish_id, peer_subscribe_id, peer_addr, ssi, ssi_len);
1575
1576 wpas_dbus_signal_nan_replied(wpa_s, srv_proto_type, publish_id,
1577 peer_subscribe_id, peer_addr,
1578 ssi, ssi_len);
1579 }
1580
1581
wpas_notify_nan_receive(struct wpa_supplicant * wpa_s,int id,int peer_instance_id,const u8 * peer_addr,const u8 * ssi,size_t ssi_len)1582 void wpas_notify_nan_receive(struct wpa_supplicant *wpa_s, int id,
1583 int peer_instance_id, const u8 *peer_addr,
1584 const u8 *ssi, size_t ssi_len)
1585 {
1586 char *ssi_hex;
1587
1588 ssi_hex = os_zalloc(2 * ssi_len + 1);
1589 if (!ssi_hex)
1590 return;
1591 if (ssi)
1592 wpa_snprintf_hex(ssi_hex, 2 * ssi_len + 1, ssi, ssi_len);
1593 wpa_msg_global(wpa_s, MSG_INFO, NAN_RECEIVE
1594 "id=%d peer_instance_id=%d address=" MACSTR " ssi=%s",
1595 id, peer_instance_id, MAC2STR(peer_addr), ssi_hex);
1596 os_free(ssi_hex);
1597
1598 wpas_aidl_notify_usd_message_received(wpa_s, id, peer_instance_id,
1599 peer_addr, ssi, ssi_len);
1600 mainline_aidl_notify_usd_message_received(wpa_s, id, peer_instance_id,
1601 peer_addr, ssi, ssi_len);
1602
1603 wpas_dbus_signal_nan_receive(wpa_s, id, peer_instance_id, peer_addr,
1604 ssi, ssi_len);
1605 }
1606
1607
nan_reason_txt(enum nan_de_reason reason)1608 static const char * nan_reason_txt(enum nan_de_reason reason)
1609 {
1610 switch (reason) {
1611 case NAN_DE_REASON_TIMEOUT:
1612 return "timeout";
1613 case NAN_DE_REASON_USER_REQUEST:
1614 return "user-request";
1615 case NAN_DE_REASON_FAILURE:
1616 return "failure";
1617 }
1618
1619 return "unknown";
1620 }
1621
1622
wpas_notify_nan_publish_terminated(struct wpa_supplicant * wpa_s,int publish_id,enum nan_de_reason reason)1623 void wpas_notify_nan_publish_terminated(struct wpa_supplicant *wpa_s,
1624 int publish_id,
1625 enum nan_de_reason reason)
1626 {
1627 wpa_msg_global(wpa_s, MSG_INFO, NAN_PUBLISH_TERMINATED
1628 "publish_id=%d reason=%s",
1629 publish_id, nan_reason_txt(reason));
1630
1631 wpas_aidl_notify_usd_publish_terminated(wpa_s, publish_id, reason);
1632 mainline_aidl_notify_usd_publish_terminated(wpa_s, publish_id, reason);
1633
1634 wpas_dbus_signal_nan_publish_terminated(wpa_s, publish_id,
1635 nan_reason_txt(reason));
1636 }
1637
1638
wpas_notify_nan_subscribe_terminated(struct wpa_supplicant * wpa_s,int subscribe_id,enum nan_de_reason reason)1639 void wpas_notify_nan_subscribe_terminated(struct wpa_supplicant *wpa_s,
1640 int subscribe_id,
1641 enum nan_de_reason reason)
1642 {
1643 wpa_msg_global(wpa_s, MSG_INFO, NAN_SUBSCRIBE_TERMINATED
1644 "subscribe_id=%d reason=%s",
1645 subscribe_id, nan_reason_txt(reason));
1646
1647 wpas_aidl_notify_usd_subscribe_terminated(wpa_s, subscribe_id, reason);
1648 mainline_aidl_notify_usd_subscribe_terminated(wpa_s, subscribe_id, reason);
1649
1650 wpas_dbus_signal_nan_subscribe_terminated(wpa_s, subscribe_id,
1651 nan_reason_txt(reason));
1652 }
1653
1654 #endif /* CONFIG_NAN_USD */
1655