blob: 1442353b8a5a8f9da2a93e53c7a54980d2715b1a [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"
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080019#include "fst/fst.h"
Hai Shalom81f62d82019-07-22 12:10:00 -070020#include "crypto/tls.h"
Hai Shalomc1a21442022-02-04 13:43:00 -080021#include "bss.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070022#include "driver_i.h"
23#include "scan.h"
24#include "p2p_supplicant.h"
25#include "sme.h"
26#include "notify.h"
Gabriel Biren57ededa2021-09-03 16:08:50 +000027#include "aidl.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070028
29int wpas_notify_supplicant_initialized(struct wpa_global *global)
30{
Hai Shalom021b0b52019-04-10 11:17:58 -070031#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070032 if (global->params.dbus_ctrl_interface) {
33 global->dbus = wpas_dbus_init(global);
34 if (global->dbus == NULL)
35 return -1;
36 }
Hai Shalom021b0b52019-04-10 11:17:58 -070037#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070038
Gabriel Biren57ededa2021-09-03 16:08:50 +000039#ifdef CONFIG_AIDL
40 global->aidl = wpas_aidl_init(global);
41 if (!global->aidl)
Dmitry Shmidte4663042016-04-04 10:07:49 -070042 return -1;
Gabriel Biren57ededa2021-09-03 16:08:50 +000043#endif /* CONFIG_AIDL */
Dmitry Shmidte4663042016-04-04 10:07:49 -070044
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070045 return 0;
46}
47
48
49void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
50{
Hai Shalom021b0b52019-04-10 11:17:58 -070051#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070052 if (global->dbus)
53 wpas_dbus_deinit(global->dbus);
Hai Shalom021b0b52019-04-10 11:17:58 -070054#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidte4663042016-04-04 10:07:49 -070055
Gabriel Biren57ededa2021-09-03 16:08:50 +000056#ifdef CONFIG_AIDL
57 if (global->aidl)
58 wpas_aidl_deinit(global->aidl);
59#endif /* CONFIG_AIDL */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070060}
61
62
63int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
64{
Hai Shalomc4809952019-04-30 14:45:55 -070065 if (!wpa_s->p2p_mgmt) {
66 if (wpas_dbus_register_interface(wpa_s))
67 return -1;
68 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070069
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080070 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000071 if (wpas_aidl_register_interface(wpa_s))
Roshan Pius54e763a2016-07-06 15:41:53 -070072 return -1;
73
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070074 return 0;
75}
76
77
78void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
79{
Hai Shalomc4809952019-04-30 14:45:55 -070080 if (!wpa_s->p2p_mgmt) {
81 /* unregister interface in new DBus ctrl iface */
82 wpas_dbus_unregister_interface(wpa_s);
83 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070084
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080085 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000086 wpas_aidl_unregister_interface(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070087}
88
89
90void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
91 enum wpa_states new_state,
92 enum wpa_states old_state)
93{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080094 if (wpa_s->p2p_mgmt)
95 return;
96
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070097 /* notify the new DBus API */
98 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
99
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800100#ifdef CONFIG_FST
101 if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
102 if (new_state == WPA_COMPLETED)
103 fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid);
104 else if (old_state >= WPA_ASSOCIATED &&
105 new_state < WPA_ASSOCIATED)
106 fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
107 }
108#endif /* CONFIG_FST */
109
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700110 if (new_state == WPA_COMPLETED)
111 wpas_p2p_notif_connected(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700112 else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700113 wpas_p2p_notif_disconnected(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700114
115 sme_state_changed(wpa_s);
116
117#ifdef ANDROID
118 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
Irfan Sherifff20a4432012-04-16 16:48:34 -0700119 "id=%d state=%d BSSID=" MACSTR " SSID=%s",
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700120 wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
Irfan Sherifff20a4432012-04-16 16:48:34 -0700121 new_state,
Irfan Sheriffe78e7672012-08-01 11:10:15 -0700122 MAC2STR(wpa_s->bssid),
andy2_kuo5b5fb022012-05-22 11:53:07 -0700123 wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
124 wpa_ssid_txt(wpa_s->current_ssid->ssid,
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800125 wpa_s->current_ssid->ssid_len) : "");
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700126#endif /* ANDROID */
Roshan Piuse8d0d162016-08-01 13:09:26 -0700127
Gabriel Biren57ededa2021-09-03 16:08:50 +0000128 wpas_aidl_notify_state_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700129}
130
131
Dmitry Shmidt04949592012-07-19 12:16:46 -0700132void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
133{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800134 if (wpa_s->p2p_mgmt)
135 return;
136
Dmitry Shmidt04949592012-07-19 12:16:46 -0700137 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
Roshan Pius0974e962016-12-12 17:05:51 -0800138
Gabriel Biren57ededa2021-09-03 16:08:50 +0000139 wpas_aidl_notify_disconnect_reason(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700140}
141
142
Hai Shalom74f70d42019-02-11 14:42:39 -0800143void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s)
144{
145 if (wpa_s->p2p_mgmt)
146 return;
147
148 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_STATUS_CODE);
149}
150
151
Sunil Ravi972b2042020-08-14 10:50:48 -0700152void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
Sunil Ravie06118e2021-01-03 08:39:46 -0800153 const u8 *bssid, u8 timed_out,
154 const u8 *assoc_resp_ie, size_t assoc_resp_ie_len)
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800155{
156 if (wpa_s->p2p_mgmt)
157 return;
158
159 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
Roshan Pius0974e962016-12-12 17:05:51 -0800160
Gabriel Biren57ededa2021-09-03 16:08:50 +0000161 wpas_aidl_notify_assoc_reject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len);
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800162}
163
Roshan Pius38e96762017-01-23 14:52:00 -0800164void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
165 if (wpa_s->p2p_mgmt)
166 return;
167
Gabriel Biren57ededa2021-09-03 16:08:50 +0000168 wpas_aidl_notify_auth_timeout(wpa_s);
Roshan Pius38e96762017-01-23 14:52:00 -0800169}
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800170
Hai Shalom74f70d42019-02-11 14:42:39 -0800171void wpas_notify_roam_time(struct wpa_supplicant *wpa_s)
172{
173 if (wpa_s->p2p_mgmt)
174 return;
175
176 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME);
177}
178
179
180void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s)
181{
182 if (wpa_s->p2p_mgmt)
183 return;
184
185 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE);
186}
187
188
189void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
190{
191 if (wpa_s->p2p_mgmt)
192 return;
193
194 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH);
195}
196
197
198void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
199{
200 if (wpa_s->p2p_mgmt)
201 return;
202
203 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
Sunil Ravi4018d712019-12-06 18:01:21 -0800204
205#ifdef CONFIG_WNM
Gabriel Biren57ededa2021-09-03 16:08:50 +0000206 wpas_aidl_notify_bss_tm_status(wpa_s);
Sunil Ravi4018d712019-12-06 18:01:21 -0800207#endif
Hai Shalom74f70d42019-02-11 14:42:39 -0800208}
209
210
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700211void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
212{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800213 if (wpa_s->p2p_mgmt)
214 return;
215
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700216 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
217}
218
219
220void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
221{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800222 if (wpa_s->p2p_mgmt)
223 return;
224
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700225 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
226}
227
228
229void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
230{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800231 if (wpa_s->p2p_mgmt)
232 return;
233
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700234 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
Roshan Piuse746d6b2017-03-21 08:53:04 -0700235
Gabriel Biren57ededa2021-09-03 16:08:50 +0000236 wpas_aidl_notify_bssid_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700237}
238
239
240void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
241{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800242 if (wpa_s->p2p_mgmt)
243 return;
244
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700245 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
246}
247
248
249void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
250 struct wpa_ssid *ssid)
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_network_enabled_changed(wpa_s, ssid);
256}
257
258
259void wpas_notify_network_selected(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_selected(wpa_s, ssid->id);
266}
267
268
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800269void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
270 struct wpa_ssid *ssid,
271 enum wpa_ctrl_req_type rtype,
272 const char *default_txt)
273{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800274 if (wpa_s->p2p_mgmt)
275 return;
276
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800277 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700278
Gabriel Biren57ededa2021-09-03 16:08:50 +0000279 wpas_aidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800280}
281
282
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700283void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
284{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800285 if (wpa_s->p2p_mgmt)
286 return;
287
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700288 /* notify the new DBus API */
289 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
290}
291
292
293void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
294{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800295 if (wpa_s->p2p_mgmt)
296 return;
297
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700298 wpas_dbus_signal_scan_done(wpa_s, success);
299}
300
301
302void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
303{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800304 if (wpa_s->p2p_mgmt)
305 return;
306
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700307 wpas_wps_notify_scan_results(wpa_s);
308}
309
310
311void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
312 const struct wps_credential *cred)
313{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800314 if (wpa_s->p2p_mgmt)
315 return;
316
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700317#ifdef CONFIG_WPS
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700318 /* notify the new DBus API */
319 wpas_dbus_signal_wps_cred(wpa_s, cred);
320#endif /* CONFIG_WPS */
321}
322
323
324void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
325 struct wps_event_m2d *m2d)
326{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800327 if (wpa_s->p2p_mgmt)
328 return;
329
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700330#ifdef CONFIG_WPS
331 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
332#endif /* CONFIG_WPS */
333}
334
335
336void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
337 struct wps_event_fail *fail)
338{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800339 if (wpa_s->p2p_mgmt)
340 return;
341
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700342#ifdef CONFIG_WPS
343 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800344
Gabriel Biren57ededa2021-09-03 16:08:50 +0000345 wpas_aidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
Roshan Pius14932752017-01-11 09:48:58 -0800346 fail->config_error,
347 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700348#endif /* CONFIG_WPS */
349}
350
351
352void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
353{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800354 if (wpa_s->p2p_mgmt)
355 return;
356
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700357#ifdef CONFIG_WPS
358 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800359
Gabriel Biren57ededa2021-09-03 16:08:50 +0000360 wpas_aidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700361#endif /* CONFIG_WPS */
362}
363
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700364void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
365{
366 if (wpa_s->p2p_mgmt)
367 return;
368
369#ifdef CONFIG_WPS
370 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800371
Gabriel Biren57ededa2021-09-03 16:08:50 +0000372 wpas_aidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700373#endif /* CONFIG_WPS */
374}
375
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700376
377void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
378 struct wpa_ssid *ssid)
379{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800380 if (wpa_s->p2p_mgmt)
381 return;
382
Jouni Malinen75ecf522011-06-27 15:19:46 -0700383 /*
384 * Networks objects created during any P2P activities should not be
385 * exposed out. They might/will confuse certain non-P2P aware
386 * applications since these network objects won't behave like
387 * regular ones.
388 */
Roshan Piusd3854452016-07-07 16:46:41 -0700389 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700390 wpas_dbus_register_network(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000391 wpas_aidl_register_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800392 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_ADDED "%d",
393 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700394 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700395}
396
397
398void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
399 struct wpa_ssid *ssid)
400{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700401#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700402 wpas_dbus_register_persistent_group(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000403 wpas_aidl_register_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700404#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700405}
406
407
408void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
409 struct wpa_ssid *ssid)
410{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700411#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700412 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000413 wpas_aidl_unregister_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700414#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700415}
416
417
418void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
419 struct wpa_ssid *ssid)
420{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800421 if (wpa_s->next_ssid == ssid)
422 wpa_s->next_ssid = NULL;
Sunil Ravia04bd252022-05-02 22:54:18 -0700423 if (wpa_s->last_ssid == ssid)
424 wpa_s->last_ssid = NULL;
425 if (wpa_s->current_ssid == ssid)
426 wpa_s->current_ssid = NULL;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800427 if (wpa_s->wpa)
428 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700429 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700430 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700431 wpas_dbus_unregister_network(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000432 wpas_aidl_unregister_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800433 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
434 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700435 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800436 if (network_is_persistent_group(ssid))
437 wpas_notify_persistent_group_removed(wpa_s, ssid);
438
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800439 wpas_p2p_network_removed(wpa_s, ssid);
Hai Shalom60840252021-02-19 19:02:11 -0800440
441#ifdef CONFIG_PASN
442 if (wpa_s->pasn.ssid == ssid)
443 wpa_s->pasn.ssid = NULL;
444#endif /* CONFIG_PASN */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700445}
446
447
448void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
449 u8 bssid[], unsigned int id)
450{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800451 if (wpa_s->p2p_mgmt)
452 return;
453
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700454 wpas_dbus_register_bss(wpa_s, bssid, id);
455 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
456 id, MAC2STR(bssid));
457}
458
459
460void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
461 u8 bssid[], unsigned int id)
462{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800463 if (wpa_s->p2p_mgmt)
464 return;
465
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700466 wpas_dbus_unregister_bss(wpa_s, bssid, id);
467 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
468 id, MAC2STR(bssid));
469}
470
471
472void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
473 unsigned int id)
474{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800475 if (wpa_s->p2p_mgmt)
476 return;
477
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700478 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
Sunil Ravi23087aa2021-12-08 19:01:44 -0800479
480 wpas_aidl_notify_bss_freq_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700481}
482
483
484void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
485 unsigned int id)
486{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800487 if (wpa_s->p2p_mgmt)
488 return;
489
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700490 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
491 id);
492}
493
494
495void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
496 unsigned int id)
497{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800498 if (wpa_s->p2p_mgmt)
499 return;
500
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700501 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
502 id);
503}
504
505
506void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
507 unsigned int id)
508{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800509 if (wpa_s->p2p_mgmt)
510 return;
511
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700512 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
513}
514
515
516void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
517 unsigned int id)
518{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800519 if (wpa_s->p2p_mgmt)
520 return;
521
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700522 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
523}
524
525
526void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
527 unsigned int id)
528{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800529 if (wpa_s->p2p_mgmt)
530 return;
531
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700532 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
533}
534
535
536void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
537 unsigned int id)
538{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800539 if (wpa_s->p2p_mgmt)
540 return;
541
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800542#ifdef CONFIG_WPS
543 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
544#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700545}
546
547
548void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
549 unsigned int id)
550{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800551 if (wpa_s->p2p_mgmt)
552 return;
553
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700554 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
555}
556
557
558void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
559 unsigned int id)
560{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800561 if (wpa_s->p2p_mgmt)
562 return;
563
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700564 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
565}
566
567
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700568void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
569{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800570 if (wpa_s->p2p_mgmt)
571 return;
572
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700573 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
574}
575
576
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700577void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
578{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800579 if (wpa_s->p2p_mgmt)
580 return;
581
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700582 wpas_dbus_signal_blob_added(wpa_s, name);
583}
584
585
586void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
587{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800588 if (wpa_s->p2p_mgmt)
589 return;
590
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700591 wpas_dbus_signal_blob_removed(wpa_s, name);
592}
593
594
595void wpas_notify_debug_level_changed(struct wpa_global *global)
596{
597 wpas_dbus_signal_debug_level_changed(global);
598}
599
600
601void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
602{
603 wpas_dbus_signal_debug_timestamp_changed(global);
604}
605
606
607void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
608{
609 wpas_dbus_signal_debug_show_keys_changed(global);
610}
611
612
613void wpas_notify_suspend(struct wpa_global *global)
614{
615 struct wpa_supplicant *wpa_s;
616
617 os_get_time(&global->suspend_time);
618 wpa_printf(MSG_DEBUG, "System suspend notification");
619 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
620 wpa_drv_suspend(wpa_s);
621}
622
623
624void wpas_notify_resume(struct wpa_global *global)
625{
626 struct os_time now;
627 int slept;
628 struct wpa_supplicant *wpa_s;
629
630 if (global->suspend_time.sec == 0)
631 slept = -1;
632 else {
633 os_get_time(&now);
634 slept = now.sec - global->suspend_time.sec;
635 }
636 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
637 slept);
638
639 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
640 wpa_drv_resume(wpa_s);
641 if (wpa_s->wpa_state == WPA_DISCONNECTED)
642 wpa_supplicant_req_scan(wpa_s, 0, 100000);
643 }
644}
645
646
647#ifdef CONFIG_P2P
648
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700649void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
650{
651 /* Notify P2P find has stopped */
652 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800653
Gabriel Biren57ededa2021-09-03 16:08:50 +0000654 wpas_aidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700655}
656
657
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700658void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800659 const u8 *addr, const struct p2p_peer_info *info,
660 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
Jimmy Chen0133fc12021-03-04 13:56:11 +0800661 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800662 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700663{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700664 if (new_device) {
665 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800666 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700667 }
668
669 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800670 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
671
Gabriel Biren57ededa2021-09-03 16:08:50 +0000672 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800673 peer_wfd_device_info,
Jimmy Chen57e19f52021-03-04 14:19:52 +0800674 peer_wfd_device_info_len,
675 peer_wfd_r2_device_info,
676 peer_wfd_r2_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700677}
678
679
680void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
681 const u8 *dev_addr)
682{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700683 wpas_dbus_unregister_peer(wpa_s, dev_addr);
684
685 /* Create signal on interface object*/
686 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800687
Gabriel Biren57ededa2021-09-03 16:08:50 +0000688 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700689}
690
691
692void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
693 const struct wpa_ssid *ssid,
694 const char *role)
695{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700696 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700697
698 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800699
Gabriel Biren57ededa2021-09-03 16:08:50 +0000700 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700701}
702
703
704void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700705 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700706{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700707 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800708
Gabriel Biren57ededa2021-09-03 16:08:50 +0000709 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700710}
711
712
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800713void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
714 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700715{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800716 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800717
Gabriel Biren57ededa2021-09-03 16:08:50 +0000718 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700719}
720
721
722void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
723 int status, const u8 *bssid)
724{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700725 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800726
Gabriel Biren57ededa2021-09-03 16:08:50 +0000727 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700728}
729
730
731void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
732 int freq, const u8 *sa, u8 dialog_token,
733 u16 update_indic, const u8 *tlvs,
734 size_t tlvs_len)
735{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700736 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
737 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700738}
739
740
741void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
742 const u8 *sa, u16 update_indic,
743 const u8 *tlvs, size_t tlvs_len)
744{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700745 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
746 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800747
Gabriel Biren57ededa2021-09-03 16:08:50 +0000748 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800749 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700750}
751
752
753/**
754 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
755 * @dev_addr: Who sent the request or responded to our request.
756 * @request: Will be 1 if request, 0 for response.
757 * @status: Valid only in case of response (0 in case of success)
758 * @config_methods: WPS config methods
759 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
760 *
761 * This can be used to notify:
762 * - Requests or responses
763 * - Various config methods
764 * - Failure condition in case of response
765 */
766void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
767 const u8 *dev_addr, int request,
768 enum p2p_prov_disc_status status,
769 u16 config_methods,
770 unsigned int generated_pin)
771{
772 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
773 status, config_methods,
774 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800775
Gabriel Biren57ededa2021-09-03 16:08:50 +0000776 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800777 status, config_methods,
778 generated_pin);
779
Jouni Malinen75ecf522011-06-27 15:19:46 -0700780}
781
782
783void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700784 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800785 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700786{
787 /* Notify a group has been started */
788 wpas_dbus_register_p2p_group(wpa_s, ssid);
789
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800790 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800791
Gabriel Biren57ededa2021-09-03 16:08:50 +0000792 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700793}
794
795
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800796void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
797 const char *reason)
798{
799 /* Notify a group formation failed */
800 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800801
Gabriel Biren57ededa2021-09-03 16:08:50 +0000802 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800803}
804
805
Jouni Malinen75ecf522011-06-27 15:19:46 -0700806void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
807 struct wps_event_fail *fail)
808{
809 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700810}
811
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800812
813void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
814 const u8 *sa, const u8 *go_dev_addr,
815 const u8 *bssid, int id, int op_freq)
816{
817 /* Notify a P2P Invitation Request */
818 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
819 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800820
Gabriel Biren57ededa2021-09-03 16:08:50 +0000821 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800822 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800823}
824
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700825#endif /* CONFIG_P2P */
826
827
828static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800829 const u8 *sta,
830 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700831{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700832#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800833 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
834
Jouni Malinen75ecf522011-06-27 15:19:46 -0700835 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700836 * Create 'peer-joined' signal on group object -- will also
837 * check P2P itself.
838 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800839 if (p2p_dev_addr)
840 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700841#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700842
Hai Shalom74f70d42019-02-11 14:42:39 -0800843 /* Register the station */
844 wpas_dbus_register_sta(wpa_s, sta);
845
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700846 /* Notify listeners a new station has been authorized */
847 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800848
Gabriel Biren57ededa2021-09-03 16:08:50 +0000849 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700850}
851
852
853static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700854 const u8 *sta,
855 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700856{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700857#ifdef CONFIG_P2P
858 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700859 * Create 'peer-disconnected' signal on group object if this
860 * is a P2P group.
861 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800862 if (p2p_dev_addr)
863 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700864#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700865
866 /* Notify listeners a station has been deauthorized */
867 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800868
Gabriel Biren57ededa2021-09-03 16:08:50 +0000869 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800870 /* Unregister the station */
871 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700872}
873
874
875void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800876 const u8 *mac_addr, int authorized,
877 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700878{
879 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800880 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700881 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700882 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700883}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700884
885
Hai Shalom81f62d82019-07-22 12:10:00 -0700886void wpas_notify_certification(struct wpa_supplicant *wpa_s,
887 struct tls_cert_data *cert,
888 const char *cert_hash)
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700889{
Hai Shalom81f62d82019-07-22 12:10:00 -0700890 int i;
Hai Shalom878cf7b2019-07-15 14:55:18 -0700891
Hai Shalom81f62d82019-07-22 12:10:00 -0700892 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
Hai Shalomc3565922019-10-28 11:58:20 -0700893 "depth=%d subject='%s'%s%s%s%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700894 cert->depth, cert->subject, cert_hash ? " hash=" : "",
895 cert_hash ? cert_hash : "",
Hai Shalomc3565922019-10-28 11:58:20 -0700896 cert->tod == 2 ? " tod=2" : "",
897 cert->tod == 1 ? " tod=1" : "");
Hai Shalom81f62d82019-07-22 12:10:00 -0700898
899 if (cert->cert) {
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700900 char *cert_hex;
Hai Shalom81f62d82019-07-22 12:10:00 -0700901 size_t len = wpabuf_len(cert->cert) * 2 + 1;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700902 cert_hex = os_malloc(len);
903 if (cert_hex) {
Hai Shalom81f62d82019-07-22 12:10:00 -0700904 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
905 wpabuf_len(cert->cert));
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700906 wpa_msg_ctrl(wpa_s, MSG_INFO,
907 WPA_EVENT_EAP_PEER_CERT
908 "depth=%d subject='%s' cert=%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700909 cert->depth, cert->subject, cert_hex);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700910 os_free(cert_hex);
911 }
912 }
913
Hai Shalom81f62d82019-07-22 12:10:00 -0700914 for (i = 0; i < cert->num_altsubject; i++)
915 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
916 "depth=%d %s", cert->depth, cert->altsubject[i]);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800917
Jimmy Chen429daf92021-10-20 13:27:23 +0800918 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
919 cert->altsubject, cert->num_altsubject,
920 cert_hash, cert->cert);
921
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700922 /* notify the new DBus API */
Hai Shalom81f62d82019-07-22 12:10:00 -0700923 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
924 cert->altsubject, cert->num_altsubject,
925 cert_hash, cert->cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700926}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700927
928
929void wpas_notify_preq(struct wpa_supplicant *wpa_s,
930 const u8 *addr, const u8 *dst, const u8 *bssid,
931 const u8 *ie, size_t ie_len, u32 ssi_signal)
932{
933#ifdef CONFIG_AP
934 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
935#endif /* CONFIG_AP */
936}
937
938
939void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
940 const char *parameter)
941{
942 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700943 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
944 "status='%s' parameter='%s'",
945 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700946}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700947
Roshan Pius3a1667e2018-07-03 15:17:14 -0700948
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700949void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
950{
951 wpa_dbg(wpa_s, MSG_ERROR,
952 "EAP Error code = %d", error_code);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000953 wpas_aidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700954}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700955
Roshan Pius3a1667e2018-07-03 15:17:14 -0700956
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700957void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
958 struct wpa_ssid *ssid)
959{
960 if (wpa_s->current_ssid != ssid)
961 return;
962
963 wpa_dbg(wpa_s, MSG_DEBUG,
964 "Network bssid config changed for the current network - within-ESS roaming %s",
965 ssid->bssid_set ? "disabled" : "enabled");
966
967 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
968 ssid->bssid_set ? ssid->bssid : NULL);
969}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800970
971
972void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
973 struct wpa_ssid *ssid)
974{
975#ifdef CONFIG_P2P
976 if (ssid->disabled == 2) {
977 /* Changed from normal network profile to persistent group */
978 ssid->disabled = 0;
979 wpas_dbus_unregister_network(wpa_s, ssid->id);
980 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700981 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800982 wpas_dbus_register_persistent_group(wpa_s, ssid);
983 } else {
984 /* Changed from persistent group to normal network profile */
985 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700986 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800987 wpas_dbus_register_network(wpa_s, ssid);
988 }
989#endif /* CONFIG_P2P */
990}
Roshan Pius04a9d742016-12-12 12:40:46 -0800991
992void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
993 const char *result,
994 const struct wpa_bss_anqp *anqp)
995{
996#ifdef CONFIG_INTERWORKING
997 if (!wpa_s || !bssid || !anqp)
998 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800999
Gabriel Biren57ededa2021-09-03 16:08:50 +00001000 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -08001001#endif /* CONFIG_INTERWORKING */
1002}
1003
1004void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1005 const char* file_name, const u8* image,
1006 u32 image_length)
1007{
1008#ifdef CONFIG_HS20
1009 if (!wpa_s || !bssid || !file_name || !image)
1010 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001011
Gabriel Biren57ededa2021-09-03 16:08:50 +00001012 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
Roshan Pius9322a342016-12-12 14:45:02 -08001013 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001014#endif /* CONFIG_HS20 */
1015}
1016
1017void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1018 const char* url,
1019 u8 osu_method)
1020{
1021#ifdef CONFIG_HS20
1022 if (!wpa_s || !url)
1023 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001024
Gabriel Biren57ededa2021-09-03 16:08:50 +00001025 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001026#endif /* CONFIG_HS20 */
1027}
1028
1029void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1030 u8 code, u16 reauth_delay,
1031 const char *url)
1032{
1033#ifdef CONFIG_HS20
Hai Shalomb3a7c702020-10-20 12:22:53 -07001034 if (!wpa_s)
Roshan Pius04a9d742016-12-12 12:40:46 -08001035 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001036
Gabriel Biren57ededa2021-09-03 16:08:50 +00001037 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
Hai Shalom04a4ca62020-10-28 19:04:47 -07001038 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001039#endif /* CONFIG_HS20 */
1040}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001041
Hai Shalom04a4ca62020-10-28 19:04:47 -07001042void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
1043 struct wpa_supplicant *wpa_s, const char *url) {
1044#ifdef CONFIG_HS20
1045 if (!wpa_s || !url)
1046 return;
1047
Gabriel Biren57ededa2021-09-03 16:08:50 +00001048 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
Hai Shalom04a4ca62020-10-28 19:04:47 -07001049#endif /* CONFIG_HS20 */
1050}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001051
1052#ifdef CONFIG_MESH
1053
1054void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1055 struct wpa_ssid *ssid)
1056{
1057 if (wpa_s->p2p_mgmt)
1058 return;
1059
1060 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1061}
1062
1063
1064void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1065 const u8 *meshid, u8 meshid_len,
Hai Shalom81f62d82019-07-22 12:10:00 -07001066 u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001067{
1068 if (wpa_s->p2p_mgmt)
1069 return;
1070
1071 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1072 reason_code);
1073}
1074
1075
1076void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1077 const u8 *peer_addr)
1078{
1079 if (wpa_s->p2p_mgmt)
1080 return;
1081
1082 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1083}
1084
1085
1086void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
Hai Shalom81f62d82019-07-22 12:10:00 -07001087 const u8 *peer_addr, 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_peer_disconnected(wpa_s, peer_addr, reason_code);
1093}
1094
1095#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001096
1097/*
1098 * DPP Notifications
1099 */
1100
1101/* DPP Success notifications */
1102
Hai Shalom706f99b2019-01-08 16:23:37 -08001103void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Hai Shalom59532852018-12-07 10:32:58 -08001104 struct wpa_ssid *ssid)
1105{
1106#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001107 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001108 return;
1109
Gabriel Biren57ededa2021-09-03 16:08:50 +00001110 wpas_aidl_notify_dpp_config_received(wpa_s, ssid);
Hai Shalom59532852018-12-07 10:32:58 -08001111#endif /* CONFIG_DPP */
1112}
1113
Hai Shalom706f99b2019-01-08 16:23:37 -08001114void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001115{
1116#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001117 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001118 return;
1119
Gabriel Biren57ededa2021-09-03 16:08:50 +00001120 wpas_aidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001121#endif /* CONFIG_DPP */
1122}
1123
1124/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001125void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
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
Gabriel Biren57ededa2021-09-03 16:08:50 +00001131 wpas_aidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001132#endif /* CONFIG_DPP */
1133}
1134
Hai Shalom706f99b2019-01-08 16:23:37 -08001135void wpas_notify_dpp_resp_pending(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_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001142#endif /* CONFIG_DPP */
1143}
1144
1145/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001146void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001147{
1148#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001149 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001150 return;
1151
Gabriel Biren57ededa2021-09-03 16:08:50 +00001152 wpas_aidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001153#endif /* CONFIG_DPP */
1154}
1155
Hai Shalom706f99b2019-01-08 16:23:37 -08001156void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001157{
1158#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001159 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001160 return;
1161
Gabriel Biren57ededa2021-09-03 16:08:50 +00001162 wpas_aidl_notify_dpp_missing_auth(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001163#endif /* CONFIG_DPP */
1164}
1165
Hai Shalom706f99b2019-01-08 16:23:37 -08001166void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001167{
1168#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001169 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001170 return;
1171
Gabriel Biren57ededa2021-09-03 16:08:50 +00001172 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001173#endif /* CONFIG_DPP */
1174}
1175
Hai Shalom706f99b2019-01-08 16:23:37 -08001176void wpas_notify_dpp_timeout(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_timeout(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_auth_failure(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_auth_failure(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_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_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001203#endif /* CONFIG_DPP */
1204}
Jimmy Chen126b1702019-08-28 17:59:33 +08001205
Hai Shalom06768112019-12-04 15:49:43 -08001206void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1207{
1208#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001209 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001210#endif /* CONFIG_DPP2 */
1211}
1212
1213void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1214{
1215#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001216 wpas_aidl_notify_dpp_config_accepted(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001217#endif /* CONFIG_DPP2 */
1218}
1219
1220void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1221 enum dpp_status_error status, const char *ssid,
1222 const char *channel_list, unsigned short band_list[], int size)
1223{
1224#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001225 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
Hai Shalom06768112019-12-04 15:49:43 -08001226#endif /* CONFIG_DPP2 */
1227}
1228
1229void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1230{
1231#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001232 wpas_aidl_notify_dpp_config_rejected(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001233#endif /* CONFIG_DPP2 */
1234}
1235
Jimmy Chen126b1702019-08-28 17:59:33 +08001236void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1237 struct rsn_pmksa_cache_entry *entry)
1238{
1239 if (!wpa_s)
1240 return;
1241
Gabriel Biren57ededa2021-09-03 16:08:50 +00001242 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
Jimmy Chen126b1702019-08-28 17:59:33 +08001243}
Jimmy Chen39deead2020-10-14 23:47:20 +08001244
1245void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1246 struct wpa_ssid *ssid,
1247 u8 bitmap)
1248{
1249 if (!wpa_s)
1250 return;
1251
1252 if (!ssid)
1253 return;
1254
Gabriel Biren57ededa2021-09-03 16:08:50 +00001255 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
Jimmy Chen39deead2020-10-14 23:47:20 +08001256}
Sunil Ravi07c17622021-01-11 12:00:53 -08001257
1258void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1259{
1260 if (!wpa_s)
1261 return;
1262
Gabriel Biren57ededa2021-09-03 16:08:50 +00001263 wpas_aidl_notify_network_not_found(wpa_s);
Sunil Ravi07c17622021-01-11 12:00:53 -08001264}
Hai Shalomc1a21442022-02-04 13:43:00 -08001265
1266#ifdef CONFIG_INTERWORKING
1267
1268void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1269 struct wpa_bss *bss,
1270 struct wpa_cred *cred, int excluded,
1271 const char *type, int bh, int bss_load,
1272 int conn_capab)
1273{
1274 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1275 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1276 MAC2STR(bss->bssid), type,
1277 bh ? " below_min_backhaul=1" : "",
1278 bss_load ? " over_max_bss_load=1" : "",
1279 conn_capab ? " conn_capab_missing=1" : "",
1280 cred->id, cred->priority, cred->sp_priority);
1281
1282 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1283 bh, bss_load, conn_capab);
1284}
1285
1286
1287void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1288{
1289 wpas_dbus_signal_interworking_select_done(wpa_s);
1290}
1291
1292#endif /* CONFIG_INTERWORKING */
1293
Gabriel Biren3a2ec2c2022-03-07 17:59:41 +00001294void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1295 const char* reason_string)
1296{
1297 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1298}
1299
1300void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1301 const char *reason_string)
1302{
1303 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1304}
1305
1306void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1307 const char *reason_string)
1308{
1309 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1310}
Shivani Baranwal84940f82022-02-02 10:21:47 +05301311
1312void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1313{
1314 if (!wpa_s)
1315 return;
1316
1317 wpas_aidl_notify_qos_policy_reset(wpa_s);
1318}
1319
1320void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1321 struct dscp_policy_data *policies, int num_policies)
1322{
1323 if (!wpa_s || !policies)
1324 return;
1325
1326 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1327}