blob: 943897df9e8e705ffee3ddfe97bddfb7186df5a6 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * wpa_supplicant - Event notifications
3 * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
4 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
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"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070017#include "dbus/dbus_new.h"
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080018#include "rsn_supp/wpa.h"
Sunil Ravi77d572f2023-01-17 23:58:31 +000019#include "rsn_supp/pmksa_cache.h"
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080020#include "fst/fst.h"
Hai Shalom81f62d82019-07-22 12:10:00 -070021#include "crypto/tls.h"
Hai Shalomc1a21442022-02-04 13:43:00 -080022#include "bss.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070023#include "driver_i.h"
24#include "scan.h"
25#include "p2p_supplicant.h"
26#include "sme.h"
27#include "notify.h"
Shivani Baranwalc58b6092022-12-01 11:17:24 +053028#include "aidl/aidl.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070029
30int wpas_notify_supplicant_initialized(struct wpa_global *global)
31{
Hai Shalom021b0b52019-04-10 11:17:58 -070032#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070033 if (global->params.dbus_ctrl_interface) {
34 global->dbus = wpas_dbus_init(global);
35 if (global->dbus == NULL)
36 return -1;
37 }
Hai Shalom021b0b52019-04-10 11:17:58 -070038#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070039
40 return 0;
41}
42
43
44void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
45{
Hai Shalom021b0b52019-04-10 11:17:58 -070046#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070047 if (global->dbus)
48 wpas_dbus_deinit(global->dbus);
Hai Shalom021b0b52019-04-10 11:17:58 -070049#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidte4663042016-04-04 10:07:49 -070050
Gabriel Biren57ededa2021-09-03 16:08:50 +000051#ifdef CONFIG_AIDL
52 if (global->aidl)
53 wpas_aidl_deinit(global->aidl);
54#endif /* CONFIG_AIDL */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070055}
56
57
58int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
59{
Hai Shalomc4809952019-04-30 14:45:55 -070060 if (!wpa_s->p2p_mgmt) {
61 if (wpas_dbus_register_interface(wpa_s))
62 return -1;
63 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070064
Kiran Kumar Lokerea9f98eb2023-03-17 13:01:12 -070065#ifdef CONFIG_AIDL
66 /* AIDL initialization may not be complete at this point.
67 * Initialization is done after daemonizing in order to avoid
68 * issues with the file descriptor.
69 */
70 if (!wpa_s || !wpa_s->global->aidl)
71 return 0;
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080072 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000073 if (wpas_aidl_register_interface(wpa_s))
Roshan Pius54e763a2016-07-06 15:41:53 -070074 return -1;
Kiran Kumar Lokerea9f98eb2023-03-17 13:01:12 -070075#endif
Roshan Pius54e763a2016-07-06 15:41:53 -070076
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070077 return 0;
78}
79
80
81void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
82{
Hai Shalomc4809952019-04-30 14:45:55 -070083 if (!wpa_s->p2p_mgmt) {
84 /* unregister interface in new DBus ctrl iface */
85 wpas_dbus_unregister_interface(wpa_s);
86 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070087
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080088 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000089 wpas_aidl_unregister_interface(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070090}
91
92
93void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
94 enum wpa_states new_state,
95 enum wpa_states old_state)
96{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080097 if (wpa_s->p2p_mgmt)
98 return;
99
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700100 /* notify the new DBus API */
101 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
102
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800103#ifdef CONFIG_FST
104 if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
105 if (new_state == WPA_COMPLETED)
106 fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid);
107 else if (old_state >= WPA_ASSOCIATED &&
108 new_state < WPA_ASSOCIATED)
109 fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
110 }
111#endif /* CONFIG_FST */
112
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700113 if (new_state == WPA_COMPLETED)
114 wpas_p2p_notif_connected(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700115 else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700116 wpas_p2p_notif_disconnected(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700117
118 sme_state_changed(wpa_s);
119
120#ifdef ANDROID
121 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
Irfan Sherifff20a4432012-04-16 16:48:34 -0700122 "id=%d state=%d BSSID=" MACSTR " SSID=%s",
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700123 wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
Irfan Sherifff20a4432012-04-16 16:48:34 -0700124 new_state,
Irfan Sheriffe78e7672012-08-01 11:10:15 -0700125 MAC2STR(wpa_s->bssid),
andy2_kuo5b5fb022012-05-22 11:53:07 -0700126 wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
127 wpa_ssid_txt(wpa_s->current_ssid->ssid,
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800128 wpa_s->current_ssid->ssid_len) : "");
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700129#endif /* ANDROID */
Roshan Piuse8d0d162016-08-01 13:09:26 -0700130
Gabriel Biren57ededa2021-09-03 16:08:50 +0000131 wpas_aidl_notify_state_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700132}
133
134
Dmitry Shmidt04949592012-07-19 12:16:46 -0700135void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
136{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800137 if (wpa_s->p2p_mgmt)
138 return;
139
Dmitry Shmidt04949592012-07-19 12:16:46 -0700140 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
Roshan Pius0974e962016-12-12 17:05:51 -0800141
Gabriel Biren57ededa2021-09-03 16:08:50 +0000142 wpas_aidl_notify_disconnect_reason(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700143}
144
145
Hai Shalom74f70d42019-02-11 14:42:39 -0800146void wpas_notify_auth_status_code(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_AUTH_STATUS_CODE);
152}
153
154
Sunil Ravi972b2042020-08-14 10:50:48 -0700155void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
Sunil Ravie06118e2021-01-03 08:39:46 -0800156 const u8 *bssid, u8 timed_out,
157 const u8 *assoc_resp_ie, size_t assoc_resp_ie_len)
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800158{
159 if (wpa_s->p2p_mgmt)
160 return;
161
162 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
Roshan Pius0974e962016-12-12 17:05:51 -0800163
Gabriel Biren57ededa2021-09-03 16:08:50 +0000164 wpas_aidl_notify_assoc_reject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len);
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800165}
166
Roshan Pius38e96762017-01-23 14:52:00 -0800167void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
168 if (wpa_s->p2p_mgmt)
169 return;
170
Gabriel Biren57ededa2021-09-03 16:08:50 +0000171 wpas_aidl_notify_auth_timeout(wpa_s);
Roshan Pius38e96762017-01-23 14:52:00 -0800172}
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800173
Hai Shalom74f70d42019-02-11 14:42:39 -0800174void wpas_notify_roam_time(struct wpa_supplicant *wpa_s)
175{
176 if (wpa_s->p2p_mgmt)
177 return;
178
179 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME);
180}
181
182
183void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s)
184{
185 if (wpa_s->p2p_mgmt)
186 return;
187
188 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE);
189}
190
191
192void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
193{
194 if (wpa_s->p2p_mgmt)
195 return;
196
197 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH);
198}
199
200
201void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
202{
203 if (wpa_s->p2p_mgmt)
204 return;
205
206 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
Sunil Ravi4018d712019-12-06 18:01:21 -0800207
208#ifdef CONFIG_WNM
Gabriel Biren57ededa2021-09-03 16:08:50 +0000209 wpas_aidl_notify_bss_tm_status(wpa_s);
Sunil Ravi4018d712019-12-06 18:01:21 -0800210#endif
Hai Shalom74f70d42019-02-11 14:42:39 -0800211}
212
213
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700214void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
215{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800216 if (wpa_s->p2p_mgmt)
217 return;
218
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700219 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
220}
221
222
223void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
224{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800225 if (wpa_s->p2p_mgmt)
226 return;
227
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700228 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
229}
230
231
232void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
233{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800234 if (wpa_s->p2p_mgmt)
235 return;
236
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700237 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
Roshan Piuse746d6b2017-03-21 08:53:04 -0700238
Gabriel Biren57ededa2021-09-03 16:08:50 +0000239 wpas_aidl_notify_bssid_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700240}
241
242
Sunil Ravi77d572f2023-01-17 23:58:31 +0000243void wpas_notify_mac_address_changed(struct wpa_supplicant *wpa_s)
244{
245 if (wpa_s->p2p_mgmt)
246 return;
247
248 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_MAC_ADDRESS);
249}
250
251
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700252void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
253{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800254 if (wpa_s->p2p_mgmt)
255 return;
256
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700257 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
258}
259
260
261void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
262 struct wpa_ssid *ssid)
263{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800264 if (wpa_s->p2p_mgmt)
265 return;
266
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700267 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
268}
269
270
271void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
272 struct wpa_ssid *ssid)
273{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800274 if (wpa_s->p2p_mgmt)
275 return;
276
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700277 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
278}
279
280
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800281void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
282 struct wpa_ssid *ssid,
283 enum wpa_ctrl_req_type rtype,
284 const char *default_txt)
285{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800286 if (wpa_s->p2p_mgmt)
287 return;
288
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800289 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700290
Gabriel Biren57ededa2021-09-03 16:08:50 +0000291 wpas_aidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800292}
293
294
Steven Liu850c2e02022-11-28 17:26:39 +0000295void wpas_notify_permanent_id_req_denied(struct wpa_supplicant *wpa_s)
296{
297 wpas_aidl_notify_permanent_id_req_denied(wpa_s);
298}
299
300
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700301void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
302{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800303 if (wpa_s->p2p_mgmt)
304 return;
305
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700306 /* notify the new DBus API */
307 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
308}
309
310
311void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
312{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800313 if (wpa_s->p2p_mgmt)
314 return;
315
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700316 wpas_dbus_signal_scan_done(wpa_s, success);
317}
318
319
320void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
321{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800322 if (wpa_s->p2p_mgmt)
323 return;
324
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700325 wpas_wps_notify_scan_results(wpa_s);
326}
327
328
329void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
330 const struct wps_credential *cred)
331{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800332 if (wpa_s->p2p_mgmt)
333 return;
334
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700335#ifdef CONFIG_WPS
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700336 /* notify the new DBus API */
337 wpas_dbus_signal_wps_cred(wpa_s, cred);
338#endif /* CONFIG_WPS */
339}
340
341
342void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
343 struct wps_event_m2d *m2d)
344{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800345 if (wpa_s->p2p_mgmt)
346 return;
347
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700348#ifdef CONFIG_WPS
349 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
350#endif /* CONFIG_WPS */
351}
352
353
354void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
355 struct wps_event_fail *fail)
356{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800357 if (wpa_s->p2p_mgmt)
358 return;
359
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700360#ifdef CONFIG_WPS
361 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800362
Gabriel Biren57ededa2021-09-03 16:08:50 +0000363 wpas_aidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
Roshan Pius14932752017-01-11 09:48:58 -0800364 fail->config_error,
365 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700366#endif /* CONFIG_WPS */
367}
368
369
370void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
371{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800372 if (wpa_s->p2p_mgmt)
373 return;
374
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700375#ifdef CONFIG_WPS
376 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800377
Gabriel Biren57ededa2021-09-03 16:08:50 +0000378 wpas_aidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700379#endif /* CONFIG_WPS */
380}
381
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700382void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
383{
384 if (wpa_s->p2p_mgmt)
385 return;
386
387#ifdef CONFIG_WPS
388 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800389
Gabriel Biren57ededa2021-09-03 16:08:50 +0000390 wpas_aidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700391#endif /* CONFIG_WPS */
392}
393
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700394
395void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
396 struct wpa_ssid *ssid)
397{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800398 if (wpa_s->p2p_mgmt)
399 return;
400
Jouni Malinen75ecf522011-06-27 15:19:46 -0700401 /*
402 * Networks objects created during any P2P activities should not be
403 * exposed out. They might/will confuse certain non-P2P aware
404 * applications since these network objects won't behave like
405 * regular ones.
406 */
Roshan Piusd3854452016-07-07 16:46:41 -0700407 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700408 wpas_dbus_register_network(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000409 wpas_aidl_register_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800410 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_ADDED "%d",
411 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700412 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700413}
414
415
416void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
417 struct wpa_ssid *ssid)
418{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700419#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700420 wpas_dbus_register_persistent_group(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000421 wpas_aidl_register_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700422#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700423}
424
425
426void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
427 struct wpa_ssid *ssid)
428{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700429#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700430 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000431 wpas_aidl_unregister_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700432#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700433}
434
435
436void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
437 struct wpa_ssid *ssid)
438{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800439 if (wpa_s->next_ssid == ssid)
440 wpa_s->next_ssid = NULL;
Sunil Ravia04bd252022-05-02 22:54:18 -0700441 if (wpa_s->last_ssid == ssid)
442 wpa_s->last_ssid = NULL;
443 if (wpa_s->current_ssid == ssid)
444 wpa_s->current_ssid = NULL;
Sunil Ravi89eba102022-09-13 21:04:37 -0700445#if defined(CONFIG_SME) && defined(CONFIG_SAE)
446 if (wpa_s->sme.ext_auth_wpa_ssid == ssid)
447 wpa_s->sme.ext_auth_wpa_ssid = NULL;
448#endif /* CONFIG_SME && CONFIG_SAE */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800449 if (wpa_s->wpa)
450 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700451 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700452 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700453 wpas_dbus_unregister_network(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000454 wpas_aidl_unregister_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800455 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
456 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700457 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800458 if (network_is_persistent_group(ssid))
459 wpas_notify_persistent_group_removed(wpa_s, ssid);
460
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800461 wpas_p2p_network_removed(wpa_s, ssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700462}
463
464
465void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
466 u8 bssid[], unsigned int id)
467{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800468 if (wpa_s->p2p_mgmt)
469 return;
470
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700471 wpas_dbus_register_bss(wpa_s, bssid, id);
472 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
473 id, MAC2STR(bssid));
474}
475
476
477void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
478 u8 bssid[], unsigned int id)
479{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800480 if (wpa_s->p2p_mgmt)
481 return;
482
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700483 wpas_dbus_unregister_bss(wpa_s, bssid, id);
484 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
485 id, MAC2STR(bssid));
486}
487
488
489void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
490 unsigned int id)
491{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800492 if (wpa_s->p2p_mgmt)
493 return;
494
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700495 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
496}
497
498
499void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
500 unsigned int id)
501{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800502 if (wpa_s->p2p_mgmt)
503 return;
504
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700505 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
506 id);
507}
508
509
510void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
511 unsigned int id)
512{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800513 if (wpa_s->p2p_mgmt)
514 return;
515
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700516 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
517 id);
518}
519
520
521void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
522 unsigned int id)
523{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800524 if (wpa_s->p2p_mgmt)
525 return;
526
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700527 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
528}
529
530
531void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
532 unsigned int id)
533{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800534 if (wpa_s->p2p_mgmt)
535 return;
536
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700537 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
538}
539
540
541void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
542 unsigned int id)
543{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800544 if (wpa_s->p2p_mgmt)
545 return;
546
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700547 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
548}
549
550
551void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
552 unsigned int id)
553{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800554 if (wpa_s->p2p_mgmt)
555 return;
556
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800557#ifdef CONFIG_WPS
558 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
559#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700560}
561
562
563void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
564 unsigned int id)
565{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800566 if (wpa_s->p2p_mgmt)
567 return;
568
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700569 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
570}
571
572
573void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
574 unsigned int id)
575{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800576 if (wpa_s->p2p_mgmt)
577 return;
578
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700579 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
580}
581
582
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700583void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
584{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800585 if (wpa_s->p2p_mgmt)
586 return;
587
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700588 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
589}
590
591
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700592void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
593{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800594 if (wpa_s->p2p_mgmt)
595 return;
596
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700597 wpas_dbus_signal_blob_added(wpa_s, name);
598}
599
600
601void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
602{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800603 if (wpa_s->p2p_mgmt)
604 return;
605
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700606 wpas_dbus_signal_blob_removed(wpa_s, name);
607}
608
609
610void wpas_notify_debug_level_changed(struct wpa_global *global)
611{
612 wpas_dbus_signal_debug_level_changed(global);
613}
614
615
616void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
617{
618 wpas_dbus_signal_debug_timestamp_changed(global);
619}
620
621
622void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
623{
624 wpas_dbus_signal_debug_show_keys_changed(global);
625}
626
627
628void wpas_notify_suspend(struct wpa_global *global)
629{
630 struct wpa_supplicant *wpa_s;
631
632 os_get_time(&global->suspend_time);
633 wpa_printf(MSG_DEBUG, "System suspend notification");
634 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
635 wpa_drv_suspend(wpa_s);
636}
637
638
639void wpas_notify_resume(struct wpa_global *global)
640{
641 struct os_time now;
642 int slept;
643 struct wpa_supplicant *wpa_s;
644
645 if (global->suspend_time.sec == 0)
646 slept = -1;
647 else {
648 os_get_time(&now);
649 slept = now.sec - global->suspend_time.sec;
650 }
651 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
652 slept);
653
654 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
655 wpa_drv_resume(wpa_s);
656 if (wpa_s->wpa_state == WPA_DISCONNECTED)
657 wpa_supplicant_req_scan(wpa_s, 0, 100000);
658 }
659}
660
661
662#ifdef CONFIG_P2P
663
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700664void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
665{
666 /* Notify P2P find has stopped */
667 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800668
Gabriel Biren57ededa2021-09-03 16:08:50 +0000669 wpas_aidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700670}
671
672
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700673void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800674 const u8 *addr, const struct p2p_peer_info *info,
675 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
Jimmy Chen0133fc12021-03-04 13:56:11 +0800676 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800677 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700678{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700679 if (new_device) {
680 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800681 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700682 }
683
684 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800685 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
686
Gabriel Biren57ededa2021-09-03 16:08:50 +0000687 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800688 peer_wfd_device_info,
Jimmy Chen57e19f52021-03-04 14:19:52 +0800689 peer_wfd_device_info_len,
690 peer_wfd_r2_device_info,
691 peer_wfd_r2_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700692}
693
694
695void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
696 const u8 *dev_addr)
697{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700698 wpas_dbus_unregister_peer(wpa_s, dev_addr);
699
700 /* Create signal on interface object*/
701 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800702
Gabriel Biren57ededa2021-09-03 16:08:50 +0000703 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700704}
705
706
707void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
708 const struct wpa_ssid *ssid,
709 const char *role)
710{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700711 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700712
713 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800714
Gabriel Biren57ededa2021-09-03 16:08:50 +0000715 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700716}
717
718
719void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700720 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700721{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700722 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800723
Gabriel Biren57ededa2021-09-03 16:08:50 +0000724 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700725}
726
727
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800728void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
729 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700730{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800731 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800732
Gabriel Biren57ededa2021-09-03 16:08:50 +0000733 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700734}
735
736
737void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
738 int status, const u8 *bssid)
739{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700740 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800741
Gabriel Biren57ededa2021-09-03 16:08:50 +0000742 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700743}
744
745
746void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
747 int freq, const u8 *sa, u8 dialog_token,
748 u16 update_indic, const u8 *tlvs,
749 size_t tlvs_len)
750{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700751 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
752 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700753}
754
755
756void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
757 const u8 *sa, u16 update_indic,
758 const u8 *tlvs, size_t tlvs_len)
759{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700760 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
761 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800762
Gabriel Biren57ededa2021-09-03 16:08:50 +0000763 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800764 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700765}
766
767
768/**
769 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
770 * @dev_addr: Who sent the request or responded to our request.
771 * @request: Will be 1 if request, 0 for response.
772 * @status: Valid only in case of response (0 in case of success)
773 * @config_methods: WPS config methods
774 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
775 *
776 * This can be used to notify:
777 * - Requests or responses
778 * - Various config methods
779 * - Failure condition in case of response
780 */
781void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
782 const u8 *dev_addr, int request,
783 enum p2p_prov_disc_status status,
784 u16 config_methods,
785 unsigned int generated_pin)
786{
787 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
788 status, config_methods,
789 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800790
Gabriel Biren57ededa2021-09-03 16:08:50 +0000791 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800792 status, config_methods,
793 generated_pin);
794
Jouni Malinen75ecf522011-06-27 15:19:46 -0700795}
796
797
798void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700799 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800800 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700801{
802 /* Notify a group has been started */
803 wpas_dbus_register_p2p_group(wpa_s, ssid);
804
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800805 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800806
Sunil Ravi68c25c22023-02-04 06:17:03 +0000807 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client, ip);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700808}
809
810
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800811void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
812 const char *reason)
813{
814 /* Notify a group formation failed */
815 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800816
Gabriel Biren57ededa2021-09-03 16:08:50 +0000817 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800818}
819
820
Jouni Malinen75ecf522011-06-27 15:19:46 -0700821void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
822 struct wps_event_fail *fail)
823{
824 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700825}
826
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800827
828void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
829 const u8 *sa, const u8 *go_dev_addr,
830 const u8 *bssid, int id, int op_freq)
831{
832 /* Notify a P2P Invitation Request */
833 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
834 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800835
Gabriel Biren57ededa2021-09-03 16:08:50 +0000836 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800837 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800838}
839
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700840#endif /* CONFIG_P2P */
841
842
843static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800844 const u8 *sta,
845 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700846{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700847#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800848 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
849
Jouni Malinen75ecf522011-06-27 15:19:46 -0700850 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700851 * Create 'peer-joined' signal on group object -- will also
852 * check P2P itself.
853 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800854 if (p2p_dev_addr)
855 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700856#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700857
Hai Shalom74f70d42019-02-11 14:42:39 -0800858 /* Register the station */
859 wpas_dbus_register_sta(wpa_s, sta);
860
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700861 /* Notify listeners a new station has been authorized */
862 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800863
Gabriel Biren57ededa2021-09-03 16:08:50 +0000864 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700865}
866
867
868static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700869 const u8 *sta,
870 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700871{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700872#ifdef CONFIG_P2P
873 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700874 * Create 'peer-disconnected' signal on group object if this
875 * is a P2P group.
876 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800877 if (p2p_dev_addr)
878 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700879#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700880
881 /* Notify listeners a station has been deauthorized */
882 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800883
Gabriel Biren57ededa2021-09-03 16:08:50 +0000884 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800885 /* Unregister the station */
886 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700887}
888
889
890void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800891 const u8 *mac_addr, int authorized,
892 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700893{
894 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800895 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700896 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700897 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700898}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700899
900
Hai Shalom81f62d82019-07-22 12:10:00 -0700901void wpas_notify_certification(struct wpa_supplicant *wpa_s,
902 struct tls_cert_data *cert,
903 const char *cert_hash)
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700904{
Hai Shalom81f62d82019-07-22 12:10:00 -0700905 int i;
Hai Shalom878cf7b2019-07-15 14:55:18 -0700906
Hai Shalom81f62d82019-07-22 12:10:00 -0700907 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
Hai Shalomc3565922019-10-28 11:58:20 -0700908 "depth=%d subject='%s'%s%s%s%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700909 cert->depth, cert->subject, cert_hash ? " hash=" : "",
910 cert_hash ? cert_hash : "",
Hai Shalomc3565922019-10-28 11:58:20 -0700911 cert->tod == 2 ? " tod=2" : "",
912 cert->tod == 1 ? " tod=1" : "");
Hai Shalom81f62d82019-07-22 12:10:00 -0700913
914 if (cert->cert) {
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700915 char *cert_hex;
Hai Shalom81f62d82019-07-22 12:10:00 -0700916 size_t len = wpabuf_len(cert->cert) * 2 + 1;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700917 cert_hex = os_malloc(len);
918 if (cert_hex) {
Hai Shalom81f62d82019-07-22 12:10:00 -0700919 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
920 wpabuf_len(cert->cert));
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700921 wpa_msg_ctrl(wpa_s, MSG_INFO,
922 WPA_EVENT_EAP_PEER_CERT
923 "depth=%d subject='%s' cert=%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700924 cert->depth, cert->subject, cert_hex);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700925 os_free(cert_hex);
926 }
927 }
928
Hai Shalom81f62d82019-07-22 12:10:00 -0700929 for (i = 0; i < cert->num_altsubject; i++)
930 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
931 "depth=%d %s", cert->depth, cert->altsubject[i]);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800932
Jimmy Chen429daf92021-10-20 13:27:23 +0800933 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
934 cert->altsubject, cert->num_altsubject,
935 cert_hash, cert->cert);
936
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700937 /* notify the new DBus API */
Hai Shalom81f62d82019-07-22 12:10:00 -0700938 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
939 cert->altsubject, cert->num_altsubject,
940 cert_hash, cert->cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700941}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700942
943
944void wpas_notify_preq(struct wpa_supplicant *wpa_s,
945 const u8 *addr, const u8 *dst, const u8 *bssid,
946 const u8 *ie, size_t ie_len, u32 ssi_signal)
947{
948#ifdef CONFIG_AP
949 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
950#endif /* CONFIG_AP */
951}
952
953
954void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
955 const char *parameter)
956{
957 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700958 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
959 "status='%s' parameter='%s'",
960 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700961}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700962
Roshan Pius3a1667e2018-07-03 15:17:14 -0700963
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700964void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
965{
966 wpa_dbg(wpa_s, MSG_ERROR,
967 "EAP Error code = %d", error_code);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000968 wpas_aidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700969}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700970
Roshan Pius3a1667e2018-07-03 15:17:14 -0700971
Sunil Ravi036cec52023-03-29 11:35:17 -0700972void wpas_notify_psk_mismatch(struct wpa_supplicant *wpa_s)
973{
974 wpas_dbus_signal_psk_mismatch(wpa_s);
975}
976
977
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700978void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
979 struct wpa_ssid *ssid)
980{
981 if (wpa_s->current_ssid != ssid)
982 return;
983
984 wpa_dbg(wpa_s, MSG_DEBUG,
985 "Network bssid config changed for the current network - within-ESS roaming %s",
986 ssid->bssid_set ? "disabled" : "enabled");
987
988 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
989 ssid->bssid_set ? ssid->bssid : NULL);
990}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800991
992
993void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
994 struct wpa_ssid *ssid)
995{
996#ifdef CONFIG_P2P
997 if (ssid->disabled == 2) {
998 /* Changed from normal network profile to persistent group */
999 ssid->disabled = 0;
1000 wpas_dbus_unregister_network(wpa_s, ssid->id);
1001 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -07001002 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001003 wpas_dbus_register_persistent_group(wpa_s, ssid);
1004 } else {
1005 /* Changed from persistent group to normal network profile */
1006 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -07001007 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001008 wpas_dbus_register_network(wpa_s, ssid);
1009 }
1010#endif /* CONFIG_P2P */
1011}
Roshan Pius04a9d742016-12-12 12:40:46 -08001012
1013void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1014 const char *result,
1015 const struct wpa_bss_anqp *anqp)
1016{
1017#ifdef CONFIG_INTERWORKING
1018 if (!wpa_s || !bssid || !anqp)
1019 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001020
Gabriel Biren57ededa2021-09-03 16:08:50 +00001021 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -08001022#endif /* CONFIG_INTERWORKING */
1023}
1024
1025void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1026 const char* file_name, const u8* image,
1027 u32 image_length)
1028{
1029#ifdef CONFIG_HS20
1030 if (!wpa_s || !bssid || !file_name || !image)
1031 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001032
Gabriel Biren57ededa2021-09-03 16:08:50 +00001033 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
Roshan Pius9322a342016-12-12 14:45:02 -08001034 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001035#endif /* CONFIG_HS20 */
1036}
1037
1038void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1039 const char* url,
1040 u8 osu_method)
1041{
1042#ifdef CONFIG_HS20
1043 if (!wpa_s || !url)
1044 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001045
Gabriel Biren57ededa2021-09-03 16:08:50 +00001046 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001047#endif /* CONFIG_HS20 */
1048}
1049
1050void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1051 u8 code, u16 reauth_delay,
1052 const char *url)
1053{
1054#ifdef CONFIG_HS20
Hai Shalomb3a7c702020-10-20 12:22:53 -07001055 if (!wpa_s)
Roshan Pius04a9d742016-12-12 12:40:46 -08001056 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001057
Gabriel Biren57ededa2021-09-03 16:08:50 +00001058 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
Hai Shalom04a4ca62020-10-28 19:04:47 -07001059 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001060#endif /* CONFIG_HS20 */
1061}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001062
Hai Shalom04a4ca62020-10-28 19:04:47 -07001063void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
1064 struct wpa_supplicant *wpa_s, const char *url) {
1065#ifdef CONFIG_HS20
1066 if (!wpa_s || !url)
1067 return;
1068
Gabriel Biren57ededa2021-09-03 16:08:50 +00001069 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
Hai Shalom04a4ca62020-10-28 19:04:47 -07001070#endif /* CONFIG_HS20 */
1071}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001072
1073#ifdef CONFIG_MESH
1074
1075void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1076 struct wpa_ssid *ssid)
1077{
1078 if (wpa_s->p2p_mgmt)
1079 return;
1080
1081 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1082}
1083
1084
1085void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1086 const u8 *meshid, u8 meshid_len,
Hai Shalom81f62d82019-07-22 12:10:00 -07001087 u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001088{
1089 if (wpa_s->p2p_mgmt)
1090 return;
1091
1092 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1093 reason_code);
1094}
1095
1096
1097void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1098 const u8 *peer_addr)
1099{
1100 if (wpa_s->p2p_mgmt)
1101 return;
1102
1103 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1104}
1105
1106
1107void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
Hai Shalom81f62d82019-07-22 12:10:00 -07001108 const u8 *peer_addr, u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001109{
1110 if (wpa_s->p2p_mgmt)
1111 return;
1112
1113 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1114}
1115
1116#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001117
1118/*
1119 * DPP Notifications
1120 */
1121
1122/* DPP Success notifications */
1123
Hai Shalom706f99b2019-01-08 16:23:37 -08001124void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Sunil Ravi546a7b52022-08-26 22:06:04 +00001125 struct wpa_ssid *ssid, bool conn_status_requested)
Hai Shalom59532852018-12-07 10:32:58 -08001126{
1127#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001128 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001129 return;
1130
Sunil Ravi546a7b52022-08-26 22:06:04 +00001131 wpas_aidl_notify_dpp_config_received(wpa_s, ssid, conn_status_requested);
Hai Shalom59532852018-12-07 10:32:58 -08001132#endif /* CONFIG_DPP */
1133}
1134
Hai Shalom706f99b2019-01-08 16:23:37 -08001135void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001136{
1137#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001138 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001139 return;
1140
Gabriel Biren57ededa2021-09-03 16:08:50 +00001141 wpas_aidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001142#endif /* CONFIG_DPP */
1143}
1144
Sunil Ravi546a7b52022-08-26 22:06:04 +00001145void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
1146 enum dpp_status_error result)
1147{
1148#ifdef CONFIG_DPP2
1149 if (!wpa_s)
1150 return;
1151
1152 wpas_aidl_notify_dpp_connection_status_sent(wpa_s, result);
1153#endif /* CONFIG_DPP2 */
1154}
1155
Hai Shalom59532852018-12-07 10:32:58 -08001156/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001157void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001158{
1159#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001160 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001161 return;
1162
Gabriel Biren57ededa2021-09-03 16:08:50 +00001163 wpas_aidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001164#endif /* CONFIG_DPP */
1165}
1166
Hai Shalom706f99b2019-01-08 16:23:37 -08001167void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001168{
1169#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001170 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001171 return;
1172
Gabriel Biren57ededa2021-09-03 16:08:50 +00001173 wpas_aidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001174#endif /* CONFIG_DPP */
1175}
1176
1177/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001178void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001179{
1180#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001181 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001182 return;
1183
Gabriel Biren57ededa2021-09-03 16:08:50 +00001184 wpas_aidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001185#endif /* CONFIG_DPP */
1186}
1187
Hai Shalom706f99b2019-01-08 16:23:37 -08001188void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001189{
1190#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001191 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001192 return;
1193
Gabriel Biren57ededa2021-09-03 16:08:50 +00001194 wpas_aidl_notify_dpp_missing_auth(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001195#endif /* CONFIG_DPP */
1196}
1197
Hai Shalom706f99b2019-01-08 16:23:37 -08001198void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001199{
1200#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001201 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001202 return;
1203
Gabriel Biren57ededa2021-09-03 16:08:50 +00001204 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001205#endif /* CONFIG_DPP */
1206}
1207
Hai Shalom706f99b2019-01-08 16:23:37 -08001208void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001209{
1210#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001211 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001212 return;
1213
Gabriel Biren57ededa2021-09-03 16:08:50 +00001214 wpas_aidl_notify_dpp_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001215#endif /* CONFIG_DPP */
1216}
1217
Hai Shalom706f99b2019-01-08 16:23:37 -08001218void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001219{
1220#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001221 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001222 return;
1223
Gabriel Biren57ededa2021-09-03 16:08:50 +00001224 wpas_aidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001225#endif /* CONFIG_DPP */
1226}
1227
Hai Shalom706f99b2019-01-08 16:23:37 -08001228void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001229{
1230#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001231 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001232 return;
1233
Gabriel Biren57ededa2021-09-03 16:08:50 +00001234 wpas_aidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001235#endif /* CONFIG_DPP */
1236}
Jimmy Chen126b1702019-08-28 17:59:33 +08001237
Hai Shalom06768112019-12-04 15:49:43 -08001238void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1239{
1240#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001241 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001242#endif /* CONFIG_DPP2 */
1243}
1244
1245void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1246{
1247#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001248 wpas_aidl_notify_dpp_config_accepted(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001249#endif /* CONFIG_DPP2 */
1250}
1251
1252void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1253 enum dpp_status_error status, const char *ssid,
1254 const char *channel_list, unsigned short band_list[], int size)
1255{
1256#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001257 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
Hai Shalom06768112019-12-04 15:49:43 -08001258#endif /* CONFIG_DPP2 */
1259}
1260
1261void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1262{
1263#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001264 wpas_aidl_notify_dpp_config_rejected(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001265#endif /* CONFIG_DPP2 */
1266}
1267
Jimmy Chen126b1702019-08-28 17:59:33 +08001268void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1269 struct rsn_pmksa_cache_entry *entry)
1270{
1271 if (!wpa_s)
1272 return;
1273
Gabriel Biren57ededa2021-09-03 16:08:50 +00001274 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
Jimmy Chen126b1702019-08-28 17:59:33 +08001275}
Jimmy Chen39deead2020-10-14 23:47:20 +08001276
1277void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1278 struct wpa_ssid *ssid,
1279 u8 bitmap)
1280{
1281 if (!wpa_s)
1282 return;
1283
1284 if (!ssid)
1285 return;
1286
Gabriel Biren57ededa2021-09-03 16:08:50 +00001287 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
Jimmy Chen39deead2020-10-14 23:47:20 +08001288}
Sunil Ravi07c17622021-01-11 12:00:53 -08001289
1290void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1291{
1292 if (!wpa_s)
1293 return;
1294
Gabriel Biren57ededa2021-09-03 16:08:50 +00001295 wpas_aidl_notify_network_not_found(wpa_s);
Sunil Ravi07c17622021-01-11 12:00:53 -08001296}
Hai Shalomc1a21442022-02-04 13:43:00 -08001297
1298#ifdef CONFIG_INTERWORKING
1299
1300void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1301 struct wpa_bss *bss,
1302 struct wpa_cred *cred, int excluded,
1303 const char *type, int bh, int bss_load,
1304 int conn_capab)
1305{
1306 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1307 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1308 MAC2STR(bss->bssid), type,
1309 bh ? " below_min_backhaul=1" : "",
1310 bss_load ? " over_max_bss_load=1" : "",
1311 conn_capab ? " conn_capab_missing=1" : "",
1312 cred->id, cred->priority, cred->sp_priority);
1313
1314 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1315 bh, bss_load, conn_capab);
1316}
1317
1318
1319void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1320{
1321 wpas_dbus_signal_interworking_select_done(wpa_s);
1322}
1323
1324#endif /* CONFIG_INTERWORKING */
1325
Gabriel Biren3a2ec2c2022-03-07 17:59:41 +00001326void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1327 const char* reason_string)
1328{
1329 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1330}
1331
1332void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1333 const char *reason_string)
1334{
1335 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1336}
1337
1338void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1339 const char *reason_string)
1340{
1341 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1342}
Shivani Baranwal84940f82022-02-02 10:21:47 +05301343
1344void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1345{
1346 if (!wpa_s)
1347 return;
1348
1349 wpas_aidl_notify_qos_policy_reset(wpa_s);
1350}
1351
1352void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1353 struct dscp_policy_data *policies, int num_policies)
1354{
1355 if (!wpa_s || !policies)
1356 return;
1357
1358 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1359}
Sunil Ravi65a724b2022-05-24 11:06:09 -07001360
1361void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency)
1362{
1363 if (!wpa_s)
1364 return;
1365
1366 wpas_aidl_notify_frequency_changed(wpa_s, frequency);
1367}
Gabriel Biren93398232022-12-15 19:18:28 +00001368
1369ssize_t wpas_get_certificate(const char *alias, uint8_t** value)
1370{
Gabriel Biren980c48a2023-03-27 21:49:21 +00001371 wpa_printf(MSG_INFO, "wpas_get_certificate");
Gabriel Biren93398232022-12-15 19:18:28 +00001372 return wpas_aidl_get_certificate(alias, value);
1373}
Sunil Ravi77d572f2023-01-17 23:58:31 +00001374
Xinyue Ling1629ad82023-03-24 16:19:51 +08001375ssize_t wpas_list_aliases(const char *prefix, char ***aliases)
1376{
1377 return wpas_aidl_list_aliases(prefix, aliases);
1378}
Sunil Ravi77d572f2023-01-17 23:58:31 +00001379
1380void wpas_notify_signal_change(struct wpa_supplicant *wpa_s)
1381{
1382 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SIGNAL_CHANGE);
1383}
Swarn Singhc450e7b2023-03-28 17:36:22 +05301384
1385void wpas_notify_qos_policy_scs_response(struct wpa_supplicant *wpa_s,
1386 unsigned int num_scs_resp, int **scs_resp)
1387{
1388 if (!wpa_s || !num_scs_resp || !scs_resp)
1389 return;
1390
1391 wpas_aidl_notify_qos_policy_scs_response(wpa_s, num_scs_resp, scs_resp);
1392}