blob: 1123d3f7f4c00556da196a6534016f80b3e8db7e [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
Gabriel Biren57ededa2021-09-03 16:08:50 +000040#ifdef CONFIG_AIDL
41 global->aidl = wpas_aidl_init(global);
42 if (!global->aidl)
Dmitry Shmidte4663042016-04-04 10:07:49 -070043 return -1;
Gabriel Biren57ededa2021-09-03 16:08:50 +000044#endif /* CONFIG_AIDL */
Dmitry Shmidte4663042016-04-04 10:07:49 -070045
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070046 return 0;
47}
48
49
50void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
51{
Hai Shalom021b0b52019-04-10 11:17:58 -070052#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070053 if (global->dbus)
54 wpas_dbus_deinit(global->dbus);
Hai Shalom021b0b52019-04-10 11:17:58 -070055#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidte4663042016-04-04 10:07:49 -070056
Gabriel Biren57ededa2021-09-03 16:08:50 +000057#ifdef CONFIG_AIDL
58 if (global->aidl)
59 wpas_aidl_deinit(global->aidl);
60#endif /* CONFIG_AIDL */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070061}
62
63
64int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
65{
Hai Shalomc4809952019-04-30 14:45:55 -070066 if (!wpa_s->p2p_mgmt) {
67 if (wpas_dbus_register_interface(wpa_s))
68 return -1;
69 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070070
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080071 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000072 if (wpas_aidl_register_interface(wpa_s))
Roshan Pius54e763a2016-07-06 15:41:53 -070073 return -1;
74
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070075 return 0;
76}
77
78
79void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
80{
Hai Shalomc4809952019-04-30 14:45:55 -070081 if (!wpa_s->p2p_mgmt) {
82 /* unregister interface in new DBus ctrl iface */
83 wpas_dbus_unregister_interface(wpa_s);
84 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070085
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080086 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000087 wpas_aidl_unregister_interface(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070088}
89
90
91void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
92 enum wpa_states new_state,
93 enum wpa_states old_state)
94{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080095 if (wpa_s->p2p_mgmt)
96 return;
97
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070098 /* notify the new DBus API */
99 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
100
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800101#ifdef CONFIG_FST
102 if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
103 if (new_state == WPA_COMPLETED)
104 fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid);
105 else if (old_state >= WPA_ASSOCIATED &&
106 new_state < WPA_ASSOCIATED)
107 fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
108 }
109#endif /* CONFIG_FST */
110
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700111 if (new_state == WPA_COMPLETED)
112 wpas_p2p_notif_connected(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700113 else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700114 wpas_p2p_notif_disconnected(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700115
116 sme_state_changed(wpa_s);
117
118#ifdef ANDROID
119 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
Irfan Sherifff20a4432012-04-16 16:48:34 -0700120 "id=%d state=%d BSSID=" MACSTR " SSID=%s",
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700121 wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
Irfan Sherifff20a4432012-04-16 16:48:34 -0700122 new_state,
Irfan Sheriffe78e7672012-08-01 11:10:15 -0700123 MAC2STR(wpa_s->bssid),
andy2_kuo5b5fb022012-05-22 11:53:07 -0700124 wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
125 wpa_ssid_txt(wpa_s->current_ssid->ssid,
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800126 wpa_s->current_ssid->ssid_len) : "");
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700127#endif /* ANDROID */
Roshan Piuse8d0d162016-08-01 13:09:26 -0700128
Gabriel Biren57ededa2021-09-03 16:08:50 +0000129 wpas_aidl_notify_state_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700130}
131
132
Dmitry Shmidt04949592012-07-19 12:16:46 -0700133void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
134{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800135 if (wpa_s->p2p_mgmt)
136 return;
137
Dmitry Shmidt04949592012-07-19 12:16:46 -0700138 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
Roshan Pius0974e962016-12-12 17:05:51 -0800139
Gabriel Biren57ededa2021-09-03 16:08:50 +0000140 wpas_aidl_notify_disconnect_reason(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700141}
142
143
Hai Shalom74f70d42019-02-11 14:42:39 -0800144void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s)
145{
146 if (wpa_s->p2p_mgmt)
147 return;
148
149 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_STATUS_CODE);
150}
151
152
Sunil Ravi972b2042020-08-14 10:50:48 -0700153void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
Sunil Ravie06118e2021-01-03 08:39:46 -0800154 const u8 *bssid, u8 timed_out,
155 const u8 *assoc_resp_ie, size_t assoc_resp_ie_len)
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800156{
157 if (wpa_s->p2p_mgmt)
158 return;
159
160 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
Roshan Pius0974e962016-12-12 17:05:51 -0800161
Gabriel Biren57ededa2021-09-03 16:08:50 +0000162 wpas_aidl_notify_assoc_reject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len);
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800163}
164
Roshan Pius38e96762017-01-23 14:52:00 -0800165void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
166 if (wpa_s->p2p_mgmt)
167 return;
168
Gabriel Biren57ededa2021-09-03 16:08:50 +0000169 wpas_aidl_notify_auth_timeout(wpa_s);
Roshan Pius38e96762017-01-23 14:52:00 -0800170}
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800171
Hai Shalom74f70d42019-02-11 14:42:39 -0800172void wpas_notify_roam_time(struct wpa_supplicant *wpa_s)
173{
174 if (wpa_s->p2p_mgmt)
175 return;
176
177 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME);
178}
179
180
181void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s)
182{
183 if (wpa_s->p2p_mgmt)
184 return;
185
186 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE);
187}
188
189
190void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
191{
192 if (wpa_s->p2p_mgmt)
193 return;
194
195 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH);
196}
197
198
199void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
200{
201 if (wpa_s->p2p_mgmt)
202 return;
203
204 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
Sunil Ravi4018d712019-12-06 18:01:21 -0800205
206#ifdef CONFIG_WNM
Gabriel Biren57ededa2021-09-03 16:08:50 +0000207 wpas_aidl_notify_bss_tm_status(wpa_s);
Sunil Ravi4018d712019-12-06 18:01:21 -0800208#endif
Hai Shalom74f70d42019-02-11 14:42:39 -0800209}
210
211
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700212void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
213{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800214 if (wpa_s->p2p_mgmt)
215 return;
216
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700217 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
218}
219
220
221void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
222{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800223 if (wpa_s->p2p_mgmt)
224 return;
225
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700226 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
227}
228
229
230void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
231{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800232 if (wpa_s->p2p_mgmt)
233 return;
234
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700235 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
Roshan Piuse746d6b2017-03-21 08:53:04 -0700236
Gabriel Biren57ededa2021-09-03 16:08:50 +0000237 wpas_aidl_notify_bssid_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700238}
239
240
Sunil Ravi77d572f2023-01-17 23:58:31 +0000241void wpas_notify_mac_address_changed(struct wpa_supplicant *wpa_s)
242{
243 if (wpa_s->p2p_mgmt)
244 return;
245
246 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_MAC_ADDRESS);
247}
248
249
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700250void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
251{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800252 if (wpa_s->p2p_mgmt)
253 return;
254
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700255 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
256}
257
258
259void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
260 struct wpa_ssid *ssid)
261{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800262 if (wpa_s->p2p_mgmt)
263 return;
264
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700265 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
266}
267
268
269void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
270 struct wpa_ssid *ssid)
271{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800272 if (wpa_s->p2p_mgmt)
273 return;
274
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700275 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
276}
277
278
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800279void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
280 struct wpa_ssid *ssid,
281 enum wpa_ctrl_req_type rtype,
282 const char *default_txt)
283{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800284 if (wpa_s->p2p_mgmt)
285 return;
286
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800287 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700288
Gabriel Biren57ededa2021-09-03 16:08:50 +0000289 wpas_aidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800290}
291
292
Steven Liu850c2e02022-11-28 17:26:39 +0000293void wpas_notify_permanent_id_req_denied(struct wpa_supplicant *wpa_s)
294{
295 wpas_aidl_notify_permanent_id_req_denied(wpa_s);
296}
297
298
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700299void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
300{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800301 if (wpa_s->p2p_mgmt)
302 return;
303
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700304 /* notify the new DBus API */
305 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
306}
307
308
309void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
310{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800311 if (wpa_s->p2p_mgmt)
312 return;
313
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700314 wpas_dbus_signal_scan_done(wpa_s, success);
315}
316
317
318void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
319{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800320 if (wpa_s->p2p_mgmt)
321 return;
322
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700323 wpas_wps_notify_scan_results(wpa_s);
324}
325
326
327void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
328 const struct wps_credential *cred)
329{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800330 if (wpa_s->p2p_mgmt)
331 return;
332
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700333#ifdef CONFIG_WPS
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700334 /* notify the new DBus API */
335 wpas_dbus_signal_wps_cred(wpa_s, cred);
336#endif /* CONFIG_WPS */
337}
338
339
340void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
341 struct wps_event_m2d *m2d)
342{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800343 if (wpa_s->p2p_mgmt)
344 return;
345
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700346#ifdef CONFIG_WPS
347 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
348#endif /* CONFIG_WPS */
349}
350
351
352void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
353 struct wps_event_fail *fail)
354{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800355 if (wpa_s->p2p_mgmt)
356 return;
357
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700358#ifdef CONFIG_WPS
359 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800360
Gabriel Biren57ededa2021-09-03 16:08:50 +0000361 wpas_aidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
Roshan Pius14932752017-01-11 09:48:58 -0800362 fail->config_error,
363 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700364#endif /* CONFIG_WPS */
365}
366
367
368void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
369{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800370 if (wpa_s->p2p_mgmt)
371 return;
372
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700373#ifdef CONFIG_WPS
374 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800375
Gabriel Biren57ededa2021-09-03 16:08:50 +0000376 wpas_aidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700377#endif /* CONFIG_WPS */
378}
379
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700380void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
381{
382 if (wpa_s->p2p_mgmt)
383 return;
384
385#ifdef CONFIG_WPS
386 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800387
Gabriel Biren57ededa2021-09-03 16:08:50 +0000388 wpas_aidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700389#endif /* CONFIG_WPS */
390}
391
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700392
393void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
394 struct wpa_ssid *ssid)
395{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800396 if (wpa_s->p2p_mgmt)
397 return;
398
Jouni Malinen75ecf522011-06-27 15:19:46 -0700399 /*
400 * Networks objects created during any P2P activities should not be
401 * exposed out. They might/will confuse certain non-P2P aware
402 * applications since these network objects won't behave like
403 * regular ones.
404 */
Roshan Piusd3854452016-07-07 16:46:41 -0700405 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700406 wpas_dbus_register_network(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000407 wpas_aidl_register_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800408 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_ADDED "%d",
409 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700410 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700411}
412
413
414void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
415 struct wpa_ssid *ssid)
416{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700417#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700418 wpas_dbus_register_persistent_group(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000419 wpas_aidl_register_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700420#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700421}
422
423
424void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
425 struct wpa_ssid *ssid)
426{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700427#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700428 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000429 wpas_aidl_unregister_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700430#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700431}
432
433
434void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
435 struct wpa_ssid *ssid)
436{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800437 if (wpa_s->next_ssid == ssid)
438 wpa_s->next_ssid = NULL;
Sunil Ravia04bd252022-05-02 22:54:18 -0700439 if (wpa_s->last_ssid == ssid)
440 wpa_s->last_ssid = NULL;
441 if (wpa_s->current_ssid == ssid)
442 wpa_s->current_ssid = NULL;
Sunil Ravi89eba102022-09-13 21:04:37 -0700443#if defined(CONFIG_SME) && defined(CONFIG_SAE)
444 if (wpa_s->sme.ext_auth_wpa_ssid == ssid)
445 wpa_s->sme.ext_auth_wpa_ssid = NULL;
446#endif /* CONFIG_SME && CONFIG_SAE */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800447 if (wpa_s->wpa)
448 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700449 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700450 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700451 wpas_dbus_unregister_network(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000452 wpas_aidl_unregister_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800453 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
454 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700455 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800456 if (network_is_persistent_group(ssid))
457 wpas_notify_persistent_group_removed(wpa_s, ssid);
458
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800459 wpas_p2p_network_removed(wpa_s, ssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700460}
461
462
463void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
464 u8 bssid[], unsigned int id)
465{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800466 if (wpa_s->p2p_mgmt)
467 return;
468
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700469 wpas_dbus_register_bss(wpa_s, bssid, id);
470 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
471 id, MAC2STR(bssid));
472}
473
474
475void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
476 u8 bssid[], unsigned int id)
477{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800478 if (wpa_s->p2p_mgmt)
479 return;
480
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700481 wpas_dbus_unregister_bss(wpa_s, bssid, id);
482 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
483 id, MAC2STR(bssid));
484}
485
486
487void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
488 unsigned int id)
489{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800490 if (wpa_s->p2p_mgmt)
491 return;
492
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700493 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
494}
495
496
497void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
498 unsigned int id)
499{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800500 if (wpa_s->p2p_mgmt)
501 return;
502
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700503 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
504 id);
505}
506
507
508void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
509 unsigned int id)
510{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800511 if (wpa_s->p2p_mgmt)
512 return;
513
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700514 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
515 id);
516}
517
518
519void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
520 unsigned int id)
521{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800522 if (wpa_s->p2p_mgmt)
523 return;
524
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700525 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
526}
527
528
529void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
530 unsigned int id)
531{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800532 if (wpa_s->p2p_mgmt)
533 return;
534
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700535 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
536}
537
538
539void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
540 unsigned int id)
541{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800542 if (wpa_s->p2p_mgmt)
543 return;
544
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700545 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
546}
547
548
549void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
550 unsigned int id)
551{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800552 if (wpa_s->p2p_mgmt)
553 return;
554
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800555#ifdef CONFIG_WPS
556 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
557#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700558}
559
560
561void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
562 unsigned int id)
563{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800564 if (wpa_s->p2p_mgmt)
565 return;
566
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700567 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
568}
569
570
571void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
572 unsigned int id)
573{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800574 if (wpa_s->p2p_mgmt)
575 return;
576
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700577 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
578}
579
580
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700581void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
582{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800583 if (wpa_s->p2p_mgmt)
584 return;
585
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700586 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
587}
588
589
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700590void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
591{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800592 if (wpa_s->p2p_mgmt)
593 return;
594
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700595 wpas_dbus_signal_blob_added(wpa_s, name);
596}
597
598
599void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
600{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800601 if (wpa_s->p2p_mgmt)
602 return;
603
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700604 wpas_dbus_signal_blob_removed(wpa_s, name);
605}
606
607
608void wpas_notify_debug_level_changed(struct wpa_global *global)
609{
610 wpas_dbus_signal_debug_level_changed(global);
611}
612
613
614void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
615{
616 wpas_dbus_signal_debug_timestamp_changed(global);
617}
618
619
620void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
621{
622 wpas_dbus_signal_debug_show_keys_changed(global);
623}
624
625
626void wpas_notify_suspend(struct wpa_global *global)
627{
628 struct wpa_supplicant *wpa_s;
629
630 os_get_time(&global->suspend_time);
631 wpa_printf(MSG_DEBUG, "System suspend notification");
632 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
633 wpa_drv_suspend(wpa_s);
634}
635
636
637void wpas_notify_resume(struct wpa_global *global)
638{
639 struct os_time now;
640 int slept;
641 struct wpa_supplicant *wpa_s;
642
643 if (global->suspend_time.sec == 0)
644 slept = -1;
645 else {
646 os_get_time(&now);
647 slept = now.sec - global->suspend_time.sec;
648 }
649 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
650 slept);
651
652 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
653 wpa_drv_resume(wpa_s);
654 if (wpa_s->wpa_state == WPA_DISCONNECTED)
655 wpa_supplicant_req_scan(wpa_s, 0, 100000);
656 }
657}
658
659
660#ifdef CONFIG_P2P
661
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700662void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
663{
664 /* Notify P2P find has stopped */
665 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800666
Gabriel Biren57ededa2021-09-03 16:08:50 +0000667 wpas_aidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700668}
669
670
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700671void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800672 const u8 *addr, const struct p2p_peer_info *info,
673 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
Jimmy Chen0133fc12021-03-04 13:56:11 +0800674 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800675 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700676{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700677 if (new_device) {
678 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800679 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700680 }
681
682 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800683 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
684
Gabriel Biren57ededa2021-09-03 16:08:50 +0000685 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800686 peer_wfd_device_info,
Jimmy Chen57e19f52021-03-04 14:19:52 +0800687 peer_wfd_device_info_len,
688 peer_wfd_r2_device_info,
689 peer_wfd_r2_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700690}
691
692
693void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
694 const u8 *dev_addr)
695{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700696 wpas_dbus_unregister_peer(wpa_s, dev_addr);
697
698 /* Create signal on interface object*/
699 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800700
Gabriel Biren57ededa2021-09-03 16:08:50 +0000701 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700702}
703
704
705void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
706 const struct wpa_ssid *ssid,
707 const char *role)
708{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700709 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700710
711 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800712
Gabriel Biren57ededa2021-09-03 16:08:50 +0000713 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700714}
715
716
717void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700718 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700719{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700720 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800721
Gabriel Biren57ededa2021-09-03 16:08:50 +0000722 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700723}
724
725
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800726void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
727 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700728{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800729 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800730
Gabriel Biren57ededa2021-09-03 16:08:50 +0000731 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700732}
733
734
735void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
736 int status, const u8 *bssid)
737{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700738 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800739
Gabriel Biren57ededa2021-09-03 16:08:50 +0000740 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700741}
742
743
744void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
745 int freq, const u8 *sa, u8 dialog_token,
746 u16 update_indic, const u8 *tlvs,
747 size_t tlvs_len)
748{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700749 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
750 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700751}
752
753
754void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
755 const u8 *sa, u16 update_indic,
756 const u8 *tlvs, size_t tlvs_len)
757{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700758 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
759 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800760
Gabriel Biren57ededa2021-09-03 16:08:50 +0000761 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800762 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700763}
764
765
766/**
767 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
768 * @dev_addr: Who sent the request or responded to our request.
769 * @request: Will be 1 if request, 0 for response.
770 * @status: Valid only in case of response (0 in case of success)
771 * @config_methods: WPS config methods
772 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
773 *
774 * This can be used to notify:
775 * - Requests or responses
776 * - Various config methods
777 * - Failure condition in case of response
778 */
779void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
780 const u8 *dev_addr, int request,
781 enum p2p_prov_disc_status status,
782 u16 config_methods,
783 unsigned int generated_pin)
784{
785 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
786 status, config_methods,
787 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800788
Gabriel Biren57ededa2021-09-03 16:08:50 +0000789 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800790 status, config_methods,
791 generated_pin);
792
Jouni Malinen75ecf522011-06-27 15:19:46 -0700793}
794
795
796void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700797 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800798 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700799{
800 /* Notify a group has been started */
801 wpas_dbus_register_p2p_group(wpa_s, ssid);
802
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800803 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800804
Sunil Ravi68c25c22023-02-04 06:17:03 +0000805 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client, ip);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700806}
807
808
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800809void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
810 const char *reason)
811{
812 /* Notify a group formation failed */
813 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800814
Gabriel Biren57ededa2021-09-03 16:08:50 +0000815 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800816}
817
818
Jouni Malinen75ecf522011-06-27 15:19:46 -0700819void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
820 struct wps_event_fail *fail)
821{
822 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700823}
824
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800825
826void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
827 const u8 *sa, const u8 *go_dev_addr,
828 const u8 *bssid, int id, int op_freq)
829{
830 /* Notify a P2P Invitation Request */
831 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
832 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800833
Gabriel Biren57ededa2021-09-03 16:08:50 +0000834 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800835 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800836}
837
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700838#endif /* CONFIG_P2P */
839
840
841static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800842 const u8 *sta,
843 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700844{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700845#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800846 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
847
Jouni Malinen75ecf522011-06-27 15:19:46 -0700848 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700849 * Create 'peer-joined' signal on group object -- will also
850 * check P2P itself.
851 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800852 if (p2p_dev_addr)
853 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700854#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700855
Hai Shalom74f70d42019-02-11 14:42:39 -0800856 /* Register the station */
857 wpas_dbus_register_sta(wpa_s, sta);
858
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700859 /* Notify listeners a new station has been authorized */
860 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800861
Gabriel Biren57ededa2021-09-03 16:08:50 +0000862 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700863}
864
865
866static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700867 const u8 *sta,
868 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700869{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700870#ifdef CONFIG_P2P
871 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700872 * Create 'peer-disconnected' signal on group object if this
873 * is a P2P group.
874 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800875 if (p2p_dev_addr)
876 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700877#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700878
879 /* Notify listeners a station has been deauthorized */
880 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800881
Gabriel Biren57ededa2021-09-03 16:08:50 +0000882 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800883 /* Unregister the station */
884 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700885}
886
887
888void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800889 const u8 *mac_addr, int authorized,
890 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700891{
892 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800893 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700894 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700895 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700896}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700897
898
Hai Shalom81f62d82019-07-22 12:10:00 -0700899void wpas_notify_certification(struct wpa_supplicant *wpa_s,
900 struct tls_cert_data *cert,
901 const char *cert_hash)
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700902{
Hai Shalom81f62d82019-07-22 12:10:00 -0700903 int i;
Hai Shalom878cf7b2019-07-15 14:55:18 -0700904
Hai Shalom81f62d82019-07-22 12:10:00 -0700905 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
Hai Shalomc3565922019-10-28 11:58:20 -0700906 "depth=%d subject='%s'%s%s%s%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700907 cert->depth, cert->subject, cert_hash ? " hash=" : "",
908 cert_hash ? cert_hash : "",
Hai Shalomc3565922019-10-28 11:58:20 -0700909 cert->tod == 2 ? " tod=2" : "",
910 cert->tod == 1 ? " tod=1" : "");
Hai Shalom81f62d82019-07-22 12:10:00 -0700911
912 if (cert->cert) {
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700913 char *cert_hex;
Hai Shalom81f62d82019-07-22 12:10:00 -0700914 size_t len = wpabuf_len(cert->cert) * 2 + 1;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700915 cert_hex = os_malloc(len);
916 if (cert_hex) {
Hai Shalom81f62d82019-07-22 12:10:00 -0700917 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
918 wpabuf_len(cert->cert));
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700919 wpa_msg_ctrl(wpa_s, MSG_INFO,
920 WPA_EVENT_EAP_PEER_CERT
921 "depth=%d subject='%s' cert=%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700922 cert->depth, cert->subject, cert_hex);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700923 os_free(cert_hex);
924 }
925 }
926
Hai Shalom81f62d82019-07-22 12:10:00 -0700927 for (i = 0; i < cert->num_altsubject; i++)
928 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
929 "depth=%d %s", cert->depth, cert->altsubject[i]);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800930
Jimmy Chen429daf92021-10-20 13:27:23 +0800931 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
932 cert->altsubject, cert->num_altsubject,
933 cert_hash, cert->cert);
934
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700935 /* notify the new DBus API */
Hai Shalom81f62d82019-07-22 12:10:00 -0700936 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
937 cert->altsubject, cert->num_altsubject,
938 cert_hash, cert->cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700939}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700940
941
942void wpas_notify_preq(struct wpa_supplicant *wpa_s,
943 const u8 *addr, const u8 *dst, const u8 *bssid,
944 const u8 *ie, size_t ie_len, u32 ssi_signal)
945{
946#ifdef CONFIG_AP
947 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
948#endif /* CONFIG_AP */
949}
950
951
952void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
953 const char *parameter)
954{
955 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700956 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
957 "status='%s' parameter='%s'",
958 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700959}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700960
Roshan Pius3a1667e2018-07-03 15:17:14 -0700961
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700962void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
963{
964 wpa_dbg(wpa_s, MSG_ERROR,
965 "EAP Error code = %d", error_code);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000966 wpas_aidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700967}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700968
Roshan Pius3a1667e2018-07-03 15:17:14 -0700969
Sunil Ravi036cec52023-03-29 11:35:17 -0700970void wpas_notify_psk_mismatch(struct wpa_supplicant *wpa_s)
971{
972 wpas_dbus_signal_psk_mismatch(wpa_s);
973}
974
975
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700976void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
977 struct wpa_ssid *ssid)
978{
979 if (wpa_s->current_ssid != ssid)
980 return;
981
982 wpa_dbg(wpa_s, MSG_DEBUG,
983 "Network bssid config changed for the current network - within-ESS roaming %s",
984 ssid->bssid_set ? "disabled" : "enabled");
985
986 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
987 ssid->bssid_set ? ssid->bssid : NULL);
988}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800989
990
991void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
992 struct wpa_ssid *ssid)
993{
994#ifdef CONFIG_P2P
995 if (ssid->disabled == 2) {
996 /* Changed from normal network profile to persistent group */
997 ssid->disabled = 0;
998 wpas_dbus_unregister_network(wpa_s, ssid->id);
999 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -07001000 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001001 wpas_dbus_register_persistent_group(wpa_s, ssid);
1002 } else {
1003 /* Changed from persistent group to normal network profile */
1004 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -07001005 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001006 wpas_dbus_register_network(wpa_s, ssid);
1007 }
1008#endif /* CONFIG_P2P */
1009}
Roshan Pius04a9d742016-12-12 12:40:46 -08001010
1011void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1012 const char *result,
1013 const struct wpa_bss_anqp *anqp)
1014{
1015#ifdef CONFIG_INTERWORKING
1016 if (!wpa_s || !bssid || !anqp)
1017 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001018
Gabriel Biren57ededa2021-09-03 16:08:50 +00001019 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -08001020#endif /* CONFIG_INTERWORKING */
1021}
1022
1023void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1024 const char* file_name, const u8* image,
1025 u32 image_length)
1026{
1027#ifdef CONFIG_HS20
1028 if (!wpa_s || !bssid || !file_name || !image)
1029 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001030
Gabriel Biren57ededa2021-09-03 16:08:50 +00001031 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
Roshan Pius9322a342016-12-12 14:45:02 -08001032 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001033#endif /* CONFIG_HS20 */
1034}
1035
1036void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1037 const char* url,
1038 u8 osu_method)
1039{
1040#ifdef CONFIG_HS20
1041 if (!wpa_s || !url)
1042 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001043
Gabriel Biren57ededa2021-09-03 16:08:50 +00001044 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001045#endif /* CONFIG_HS20 */
1046}
1047
1048void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1049 u8 code, u16 reauth_delay,
1050 const char *url)
1051{
1052#ifdef CONFIG_HS20
Hai Shalomb3a7c702020-10-20 12:22:53 -07001053 if (!wpa_s)
Roshan Pius04a9d742016-12-12 12:40:46 -08001054 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001055
Gabriel Biren57ededa2021-09-03 16:08:50 +00001056 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
Hai Shalom04a4ca62020-10-28 19:04:47 -07001057 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001058#endif /* CONFIG_HS20 */
1059}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001060
Hai Shalom04a4ca62020-10-28 19:04:47 -07001061void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
1062 struct wpa_supplicant *wpa_s, const char *url) {
1063#ifdef CONFIG_HS20
1064 if (!wpa_s || !url)
1065 return;
1066
Gabriel Biren57ededa2021-09-03 16:08:50 +00001067 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
Hai Shalom04a4ca62020-10-28 19:04:47 -07001068#endif /* CONFIG_HS20 */
1069}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001070
1071#ifdef CONFIG_MESH
1072
1073void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1074 struct wpa_ssid *ssid)
1075{
1076 if (wpa_s->p2p_mgmt)
1077 return;
1078
1079 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1080}
1081
1082
1083void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1084 const u8 *meshid, u8 meshid_len,
Hai Shalom81f62d82019-07-22 12:10:00 -07001085 u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001086{
1087 if (wpa_s->p2p_mgmt)
1088 return;
1089
1090 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1091 reason_code);
1092}
1093
1094
1095void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1096 const u8 *peer_addr)
1097{
1098 if (wpa_s->p2p_mgmt)
1099 return;
1100
1101 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1102}
1103
1104
1105void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
Hai Shalom81f62d82019-07-22 12:10:00 -07001106 const u8 *peer_addr, u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001107{
1108 if (wpa_s->p2p_mgmt)
1109 return;
1110
1111 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1112}
1113
1114#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001115
1116/*
1117 * DPP Notifications
1118 */
1119
1120/* DPP Success notifications */
1121
Hai Shalom706f99b2019-01-08 16:23:37 -08001122void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Sunil Ravi546a7b52022-08-26 22:06:04 +00001123 struct wpa_ssid *ssid, bool conn_status_requested)
Hai Shalom59532852018-12-07 10:32:58 -08001124{
1125#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001126 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001127 return;
1128
Sunil Ravi546a7b52022-08-26 22:06:04 +00001129 wpas_aidl_notify_dpp_config_received(wpa_s, ssid, conn_status_requested);
Hai Shalom59532852018-12-07 10:32:58 -08001130#endif /* CONFIG_DPP */
1131}
1132
Hai Shalom706f99b2019-01-08 16:23:37 -08001133void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001134{
1135#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001136 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001137 return;
1138
Gabriel Biren57ededa2021-09-03 16:08:50 +00001139 wpas_aidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001140#endif /* CONFIG_DPP */
1141}
1142
Sunil Ravi546a7b52022-08-26 22:06:04 +00001143void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
1144 enum dpp_status_error result)
1145{
1146#ifdef CONFIG_DPP2
1147 if (!wpa_s)
1148 return;
1149
1150 wpas_aidl_notify_dpp_connection_status_sent(wpa_s, result);
1151#endif /* CONFIG_DPP2 */
1152}
1153
Hai Shalom59532852018-12-07 10:32:58 -08001154/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001155void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001156{
1157#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001158 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001159 return;
1160
Gabriel Biren57ededa2021-09-03 16:08:50 +00001161 wpas_aidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001162#endif /* CONFIG_DPP */
1163}
1164
Hai Shalom706f99b2019-01-08 16:23:37 -08001165void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001166{
1167#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001168 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001169 return;
1170
Gabriel Biren57ededa2021-09-03 16:08:50 +00001171 wpas_aidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001172#endif /* CONFIG_DPP */
1173}
1174
1175/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001176void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001177{
1178#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001179 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001180 return;
1181
Gabriel Biren57ededa2021-09-03 16:08:50 +00001182 wpas_aidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001183#endif /* CONFIG_DPP */
1184}
1185
Hai Shalom706f99b2019-01-08 16:23:37 -08001186void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001187{
1188#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001189 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001190 return;
1191
Gabriel Biren57ededa2021-09-03 16:08:50 +00001192 wpas_aidl_notify_dpp_missing_auth(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001193#endif /* CONFIG_DPP */
1194}
1195
Hai Shalom706f99b2019-01-08 16:23:37 -08001196void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001197{
1198#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001199 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001200 return;
1201
Gabriel Biren57ededa2021-09-03 16:08:50 +00001202 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001203#endif /* CONFIG_DPP */
1204}
1205
Hai Shalom706f99b2019-01-08 16:23:37 -08001206void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001207{
1208#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001209 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001210 return;
1211
Gabriel Biren57ededa2021-09-03 16:08:50 +00001212 wpas_aidl_notify_dpp_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001213#endif /* CONFIG_DPP */
1214}
1215
Hai Shalom706f99b2019-01-08 16:23:37 -08001216void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001217{
1218#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001219 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001220 return;
1221
Gabriel Biren57ededa2021-09-03 16:08:50 +00001222 wpas_aidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001223#endif /* CONFIG_DPP */
1224}
1225
Hai Shalom706f99b2019-01-08 16:23:37 -08001226void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001227{
1228#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001229 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001230 return;
1231
Gabriel Biren57ededa2021-09-03 16:08:50 +00001232 wpas_aidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001233#endif /* CONFIG_DPP */
1234}
Jimmy Chen126b1702019-08-28 17:59:33 +08001235
Hai Shalom06768112019-12-04 15:49:43 -08001236void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1237{
1238#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001239 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001240#endif /* CONFIG_DPP2 */
1241}
1242
1243void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1244{
1245#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001246 wpas_aidl_notify_dpp_config_accepted(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001247#endif /* CONFIG_DPP2 */
1248}
1249
1250void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1251 enum dpp_status_error status, const char *ssid,
1252 const char *channel_list, unsigned short band_list[], int size)
1253{
1254#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001255 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
Hai Shalom06768112019-12-04 15:49:43 -08001256#endif /* CONFIG_DPP2 */
1257}
1258
1259void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1260{
1261#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001262 wpas_aidl_notify_dpp_config_rejected(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001263#endif /* CONFIG_DPP2 */
1264}
1265
Jimmy Chen126b1702019-08-28 17:59:33 +08001266void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1267 struct rsn_pmksa_cache_entry *entry)
1268{
1269 if (!wpa_s)
1270 return;
1271
Gabriel Biren57ededa2021-09-03 16:08:50 +00001272 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
Jimmy Chen126b1702019-08-28 17:59:33 +08001273}
Jimmy Chen39deead2020-10-14 23:47:20 +08001274
1275void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1276 struct wpa_ssid *ssid,
1277 u8 bitmap)
1278{
1279 if (!wpa_s)
1280 return;
1281
1282 if (!ssid)
1283 return;
1284
Gabriel Biren57ededa2021-09-03 16:08:50 +00001285 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
Jimmy Chen39deead2020-10-14 23:47:20 +08001286}
Sunil Ravi07c17622021-01-11 12:00:53 -08001287
1288void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1289{
1290 if (!wpa_s)
1291 return;
1292
Gabriel Biren57ededa2021-09-03 16:08:50 +00001293 wpas_aidl_notify_network_not_found(wpa_s);
Sunil Ravi07c17622021-01-11 12:00:53 -08001294}
Hai Shalomc1a21442022-02-04 13:43:00 -08001295
1296#ifdef CONFIG_INTERWORKING
1297
1298void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1299 struct wpa_bss *bss,
1300 struct wpa_cred *cred, int excluded,
1301 const char *type, int bh, int bss_load,
1302 int conn_capab)
1303{
1304 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1305 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1306 MAC2STR(bss->bssid), type,
1307 bh ? " below_min_backhaul=1" : "",
1308 bss_load ? " over_max_bss_load=1" : "",
1309 conn_capab ? " conn_capab_missing=1" : "",
1310 cred->id, cred->priority, cred->sp_priority);
1311
1312 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1313 bh, bss_load, conn_capab);
1314}
1315
1316
1317void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1318{
1319 wpas_dbus_signal_interworking_select_done(wpa_s);
1320}
1321
1322#endif /* CONFIG_INTERWORKING */
1323
Gabriel Biren3a2ec2c2022-03-07 17:59:41 +00001324void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1325 const char* reason_string)
1326{
1327 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1328}
1329
1330void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1331 const char *reason_string)
1332{
1333 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1334}
1335
1336void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1337 const char *reason_string)
1338{
1339 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1340}
Shivani Baranwal84940f82022-02-02 10:21:47 +05301341
1342void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1343{
1344 if (!wpa_s)
1345 return;
1346
1347 wpas_aidl_notify_qos_policy_reset(wpa_s);
1348}
1349
1350void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1351 struct dscp_policy_data *policies, int num_policies)
1352{
1353 if (!wpa_s || !policies)
1354 return;
1355
1356 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1357}
Sunil Ravi65a724b2022-05-24 11:06:09 -07001358
1359void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency)
1360{
1361 if (!wpa_s)
1362 return;
1363
1364 wpas_aidl_notify_frequency_changed(wpa_s, frequency);
1365}
Gabriel Biren93398232022-12-15 19:18:28 +00001366
1367ssize_t wpas_get_certificate(const char *alias, uint8_t** value)
1368{
Gabriel Biren980c48a2023-03-27 21:49:21 +00001369 wpa_printf(MSG_INFO, "wpas_get_certificate");
Gabriel Biren93398232022-12-15 19:18:28 +00001370 return wpas_aidl_get_certificate(alias, value);
1371}
Sunil Ravi77d572f2023-01-17 23:58:31 +00001372
1373
1374void wpas_notify_signal_change(struct wpa_supplicant *wpa_s)
1375{
1376 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SIGNAL_CHANGE);
1377}