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