blob: c52e88fdd763505afc3965a6b73de5c5d09153ec [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;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800423 if (wpa_s->wpa)
424 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700425 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700426 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700427 wpas_dbus_unregister_network(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000428 wpas_aidl_unregister_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800429 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
430 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700431 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800432 if (network_is_persistent_group(ssid))
433 wpas_notify_persistent_group_removed(wpa_s, ssid);
434
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800435 wpas_p2p_network_removed(wpa_s, ssid);
Hai Shalom60840252021-02-19 19:02:11 -0800436
437#ifdef CONFIG_PASN
438 if (wpa_s->pasn.ssid == ssid)
439 wpa_s->pasn.ssid = NULL;
440#endif /* CONFIG_PASN */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700441}
442
443
444void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
445 u8 bssid[], unsigned int id)
446{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800447 if (wpa_s->p2p_mgmt)
448 return;
449
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700450 wpas_dbus_register_bss(wpa_s, bssid, id);
451 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
452 id, MAC2STR(bssid));
453}
454
455
456void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
457 u8 bssid[], unsigned int id)
458{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800459 if (wpa_s->p2p_mgmt)
460 return;
461
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700462 wpas_dbus_unregister_bss(wpa_s, bssid, id);
463 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
464 id, MAC2STR(bssid));
465}
466
467
468void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
469 unsigned int id)
470{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800471 if (wpa_s->p2p_mgmt)
472 return;
473
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700474 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
475}
476
477
478void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
479 unsigned int id)
480{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800481 if (wpa_s->p2p_mgmt)
482 return;
483
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700484 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
485 id);
486}
487
488
489void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
490 unsigned int id)
491{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800492 if (wpa_s->p2p_mgmt)
493 return;
494
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700495 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
496 id);
497}
498
499
500void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
501 unsigned int id)
502{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800503 if (wpa_s->p2p_mgmt)
504 return;
505
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700506 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
507}
508
509
510void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
511 unsigned int id)
512{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800513 if (wpa_s->p2p_mgmt)
514 return;
515
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700516 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
517}
518
519
520void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
521 unsigned int id)
522{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800523 if (wpa_s->p2p_mgmt)
524 return;
525
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700526 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
527}
528
529
530void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
531 unsigned int id)
532{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800533 if (wpa_s->p2p_mgmt)
534 return;
535
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800536#ifdef CONFIG_WPS
537 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
538#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700539}
540
541
542void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
543 unsigned int id)
544{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800545 if (wpa_s->p2p_mgmt)
546 return;
547
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700548 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
549}
550
551
552void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
553 unsigned int id)
554{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800555 if (wpa_s->p2p_mgmt)
556 return;
557
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700558 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
559}
560
561
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700562void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
563{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800564 if (wpa_s->p2p_mgmt)
565 return;
566
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700567 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
568}
569
570
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700571void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
572{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800573 if (wpa_s->p2p_mgmt)
574 return;
575
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700576 wpas_dbus_signal_blob_added(wpa_s, name);
577}
578
579
580void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
581{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800582 if (wpa_s->p2p_mgmt)
583 return;
584
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700585 wpas_dbus_signal_blob_removed(wpa_s, name);
586}
587
588
589void wpas_notify_debug_level_changed(struct wpa_global *global)
590{
591 wpas_dbus_signal_debug_level_changed(global);
592}
593
594
595void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
596{
597 wpas_dbus_signal_debug_timestamp_changed(global);
598}
599
600
601void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
602{
603 wpas_dbus_signal_debug_show_keys_changed(global);
604}
605
606
607void wpas_notify_suspend(struct wpa_global *global)
608{
609 struct wpa_supplicant *wpa_s;
610
611 os_get_time(&global->suspend_time);
612 wpa_printf(MSG_DEBUG, "System suspend notification");
613 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
614 wpa_drv_suspend(wpa_s);
615}
616
617
618void wpas_notify_resume(struct wpa_global *global)
619{
620 struct os_time now;
621 int slept;
622 struct wpa_supplicant *wpa_s;
623
624 if (global->suspend_time.sec == 0)
625 slept = -1;
626 else {
627 os_get_time(&now);
628 slept = now.sec - global->suspend_time.sec;
629 }
630 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
631 slept);
632
633 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
634 wpa_drv_resume(wpa_s);
635 if (wpa_s->wpa_state == WPA_DISCONNECTED)
636 wpa_supplicant_req_scan(wpa_s, 0, 100000);
637 }
638}
639
640
641#ifdef CONFIG_P2P
642
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700643void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
644{
645 /* Notify P2P find has stopped */
646 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800647
Gabriel Biren57ededa2021-09-03 16:08:50 +0000648 wpas_aidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700649}
650
651
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700652void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800653 const u8 *addr, const struct p2p_peer_info *info,
654 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
Jimmy Chen0133fc12021-03-04 13:56:11 +0800655 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800656 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700657{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700658 if (new_device) {
659 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800660 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700661 }
662
663 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800664 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
665
Gabriel Biren57ededa2021-09-03 16:08:50 +0000666 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800667 peer_wfd_device_info,
Jimmy Chen57e19f52021-03-04 14:19:52 +0800668 peer_wfd_device_info_len,
669 peer_wfd_r2_device_info,
670 peer_wfd_r2_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700671}
672
673
674void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
675 const u8 *dev_addr)
676{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700677 wpas_dbus_unregister_peer(wpa_s, dev_addr);
678
679 /* Create signal on interface object*/
680 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800681
Gabriel Biren57ededa2021-09-03 16:08:50 +0000682 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700683}
684
685
686void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
687 const struct wpa_ssid *ssid,
688 const char *role)
689{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700690 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700691
692 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800693
Gabriel Biren57ededa2021-09-03 16:08:50 +0000694 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700695}
696
697
698void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700699 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700700{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700701 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800702
Gabriel Biren57ededa2021-09-03 16:08:50 +0000703 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700704}
705
706
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800707void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
708 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700709{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800710 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800711
Gabriel Biren57ededa2021-09-03 16:08:50 +0000712 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700713}
714
715
716void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
717 int status, const u8 *bssid)
718{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700719 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800720
Gabriel Biren57ededa2021-09-03 16:08:50 +0000721 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700722}
723
724
725void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
726 int freq, const u8 *sa, u8 dialog_token,
727 u16 update_indic, const u8 *tlvs,
728 size_t tlvs_len)
729{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700730 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
731 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700732}
733
734
735void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
736 const u8 *sa, u16 update_indic,
737 const u8 *tlvs, size_t tlvs_len)
738{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700739 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
740 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800741
Gabriel Biren57ededa2021-09-03 16:08:50 +0000742 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800743 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700744}
745
746
747/**
748 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
749 * @dev_addr: Who sent the request or responded to our request.
750 * @request: Will be 1 if request, 0 for response.
751 * @status: Valid only in case of response (0 in case of success)
752 * @config_methods: WPS config methods
753 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
754 *
755 * This can be used to notify:
756 * - Requests or responses
757 * - Various config methods
758 * - Failure condition in case of response
759 */
760void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
761 const u8 *dev_addr, int request,
762 enum p2p_prov_disc_status status,
763 u16 config_methods,
764 unsigned int generated_pin)
765{
766 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
767 status, config_methods,
768 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800769
Gabriel Biren57ededa2021-09-03 16:08:50 +0000770 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800771 status, config_methods,
772 generated_pin);
773
Jouni Malinen75ecf522011-06-27 15:19:46 -0700774}
775
776
777void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700778 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800779 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700780{
781 /* Notify a group has been started */
782 wpas_dbus_register_p2p_group(wpa_s, ssid);
783
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800784 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800785
Gabriel Biren57ededa2021-09-03 16:08:50 +0000786 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700787}
788
789
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800790void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
791 const char *reason)
792{
793 /* Notify a group formation failed */
794 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800795
Gabriel Biren57ededa2021-09-03 16:08:50 +0000796 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800797}
798
799
Jouni Malinen75ecf522011-06-27 15:19:46 -0700800void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
801 struct wps_event_fail *fail)
802{
803 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700804}
805
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800806
807void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
808 const u8 *sa, const u8 *go_dev_addr,
809 const u8 *bssid, int id, int op_freq)
810{
811 /* Notify a P2P Invitation Request */
812 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
813 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800814
Gabriel Biren57ededa2021-09-03 16:08:50 +0000815 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800816 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800817}
818
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700819#endif /* CONFIG_P2P */
820
821
822static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800823 const u8 *sta,
824 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700825{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700826#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800827 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
828
Jouni Malinen75ecf522011-06-27 15:19:46 -0700829 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700830 * Create 'peer-joined' signal on group object -- will also
831 * check P2P itself.
832 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800833 if (p2p_dev_addr)
834 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700835#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700836
Hai Shalom74f70d42019-02-11 14:42:39 -0800837 /* Register the station */
838 wpas_dbus_register_sta(wpa_s, sta);
839
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700840 /* Notify listeners a new station has been authorized */
841 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800842
Gabriel Biren57ededa2021-09-03 16:08:50 +0000843 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700844}
845
846
847static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700848 const u8 *sta,
849 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700850{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700851#ifdef CONFIG_P2P
852 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700853 * Create 'peer-disconnected' signal on group object if this
854 * is a P2P group.
855 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800856 if (p2p_dev_addr)
857 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700858#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700859
860 /* Notify listeners a station has been deauthorized */
861 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800862
Gabriel Biren57ededa2021-09-03 16:08:50 +0000863 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800864 /* Unregister the station */
865 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700866}
867
868
869void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800870 const u8 *mac_addr, int authorized,
871 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700872{
873 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800874 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700875 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700876 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700877}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700878
879
Hai Shalom81f62d82019-07-22 12:10:00 -0700880void wpas_notify_certification(struct wpa_supplicant *wpa_s,
881 struct tls_cert_data *cert,
882 const char *cert_hash)
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700883{
Hai Shalom81f62d82019-07-22 12:10:00 -0700884 int i;
Hai Shalom878cf7b2019-07-15 14:55:18 -0700885
Hai Shalom81f62d82019-07-22 12:10:00 -0700886 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
Hai Shalomc3565922019-10-28 11:58:20 -0700887 "depth=%d subject='%s'%s%s%s%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700888 cert->depth, cert->subject, cert_hash ? " hash=" : "",
889 cert_hash ? cert_hash : "",
Hai Shalomc3565922019-10-28 11:58:20 -0700890 cert->tod == 2 ? " tod=2" : "",
891 cert->tod == 1 ? " tod=1" : "");
Hai Shalom81f62d82019-07-22 12:10:00 -0700892
893 if (cert->cert) {
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700894 char *cert_hex;
Hai Shalom81f62d82019-07-22 12:10:00 -0700895 size_t len = wpabuf_len(cert->cert) * 2 + 1;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700896 cert_hex = os_malloc(len);
897 if (cert_hex) {
Hai Shalom81f62d82019-07-22 12:10:00 -0700898 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
899 wpabuf_len(cert->cert));
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700900 wpa_msg_ctrl(wpa_s, MSG_INFO,
901 WPA_EVENT_EAP_PEER_CERT
902 "depth=%d subject='%s' cert=%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700903 cert->depth, cert->subject, cert_hex);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700904 os_free(cert_hex);
905 }
906 }
907
Hai Shalom81f62d82019-07-22 12:10:00 -0700908 for (i = 0; i < cert->num_altsubject; i++)
909 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
910 "depth=%d %s", cert->depth, cert->altsubject[i]);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800911
Jimmy Chen429daf92021-10-20 13:27:23 +0800912 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
913 cert->altsubject, cert->num_altsubject,
914 cert_hash, cert->cert);
915
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700916 /* notify the new DBus API */
Hai Shalom81f62d82019-07-22 12:10:00 -0700917 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
918 cert->altsubject, cert->num_altsubject,
919 cert_hash, cert->cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700920}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700921
922
923void wpas_notify_preq(struct wpa_supplicant *wpa_s,
924 const u8 *addr, const u8 *dst, const u8 *bssid,
925 const u8 *ie, size_t ie_len, u32 ssi_signal)
926{
927#ifdef CONFIG_AP
928 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
929#endif /* CONFIG_AP */
930}
931
932
933void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
934 const char *parameter)
935{
936 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700937 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
938 "status='%s' parameter='%s'",
939 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700940}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700941
Roshan Pius3a1667e2018-07-03 15:17:14 -0700942
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700943void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
944{
945 wpa_dbg(wpa_s, MSG_ERROR,
946 "EAP Error code = %d", error_code);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000947 wpas_aidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700948}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700949
Roshan Pius3a1667e2018-07-03 15:17:14 -0700950
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700951void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
952 struct wpa_ssid *ssid)
953{
954 if (wpa_s->current_ssid != ssid)
955 return;
956
957 wpa_dbg(wpa_s, MSG_DEBUG,
958 "Network bssid config changed for the current network - within-ESS roaming %s",
959 ssid->bssid_set ? "disabled" : "enabled");
960
961 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
962 ssid->bssid_set ? ssid->bssid : NULL);
963}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800964
965
966void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
967 struct wpa_ssid *ssid)
968{
969#ifdef CONFIG_P2P
970 if (ssid->disabled == 2) {
971 /* Changed from normal network profile to persistent group */
972 ssid->disabled = 0;
973 wpas_dbus_unregister_network(wpa_s, ssid->id);
974 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700975 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800976 wpas_dbus_register_persistent_group(wpa_s, ssid);
977 } else {
978 /* Changed from persistent group to normal network profile */
979 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700980 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800981 wpas_dbus_register_network(wpa_s, ssid);
982 }
983#endif /* CONFIG_P2P */
984}
Roshan Pius04a9d742016-12-12 12:40:46 -0800985
986void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
987 const char *result,
988 const struct wpa_bss_anqp *anqp)
989{
990#ifdef CONFIG_INTERWORKING
991 if (!wpa_s || !bssid || !anqp)
992 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800993
Gabriel Biren57ededa2021-09-03 16:08:50 +0000994 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -0800995#endif /* CONFIG_INTERWORKING */
996}
997
998void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
999 const char* file_name, const u8* image,
1000 u32 image_length)
1001{
1002#ifdef CONFIG_HS20
1003 if (!wpa_s || !bssid || !file_name || !image)
1004 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001005
Gabriel Biren57ededa2021-09-03 16:08:50 +00001006 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
Roshan Pius9322a342016-12-12 14:45:02 -08001007 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001008#endif /* CONFIG_HS20 */
1009}
1010
1011void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1012 const char* url,
1013 u8 osu_method)
1014{
1015#ifdef CONFIG_HS20
1016 if (!wpa_s || !url)
1017 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001018
Gabriel Biren57ededa2021-09-03 16:08:50 +00001019 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001020#endif /* CONFIG_HS20 */
1021}
1022
1023void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1024 u8 code, u16 reauth_delay,
1025 const char *url)
1026{
1027#ifdef CONFIG_HS20
Hai Shalomb3a7c702020-10-20 12:22:53 -07001028 if (!wpa_s)
Roshan Pius04a9d742016-12-12 12:40:46 -08001029 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001030
Gabriel Biren57ededa2021-09-03 16:08:50 +00001031 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
Hai Shalom04a4ca62020-10-28 19:04:47 -07001032 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001033#endif /* CONFIG_HS20 */
1034}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001035
Hai Shalom04a4ca62020-10-28 19:04:47 -07001036void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
1037 struct wpa_supplicant *wpa_s, const char *url) {
1038#ifdef CONFIG_HS20
1039 if (!wpa_s || !url)
1040 return;
1041
Gabriel Biren57ededa2021-09-03 16:08:50 +00001042 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
Hai Shalom04a4ca62020-10-28 19:04:47 -07001043#endif /* CONFIG_HS20 */
1044}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001045
1046#ifdef CONFIG_MESH
1047
1048void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1049 struct wpa_ssid *ssid)
1050{
1051 if (wpa_s->p2p_mgmt)
1052 return;
1053
1054 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1055}
1056
1057
1058void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1059 const u8 *meshid, u8 meshid_len,
Hai Shalom81f62d82019-07-22 12:10:00 -07001060 u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001061{
1062 if (wpa_s->p2p_mgmt)
1063 return;
1064
1065 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1066 reason_code);
1067}
1068
1069
1070void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1071 const u8 *peer_addr)
1072{
1073 if (wpa_s->p2p_mgmt)
1074 return;
1075
1076 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1077}
1078
1079
1080void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
Hai Shalom81f62d82019-07-22 12:10:00 -07001081 const u8 *peer_addr, u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001082{
1083 if (wpa_s->p2p_mgmt)
1084 return;
1085
1086 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1087}
1088
1089#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001090
1091/*
1092 * DPP Notifications
1093 */
1094
1095/* DPP Success notifications */
1096
Hai Shalom706f99b2019-01-08 16:23:37 -08001097void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Hai Shalom59532852018-12-07 10:32:58 -08001098 struct wpa_ssid *ssid)
1099{
1100#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001101 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001102 return;
1103
Gabriel Biren57ededa2021-09-03 16:08:50 +00001104 wpas_aidl_notify_dpp_config_received(wpa_s, ssid);
Hai Shalom59532852018-12-07 10:32:58 -08001105#endif /* CONFIG_DPP */
1106}
1107
Hai Shalom706f99b2019-01-08 16:23:37 -08001108void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001109{
1110#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001111 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001112 return;
1113
Gabriel Biren57ededa2021-09-03 16:08:50 +00001114 wpas_aidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001115#endif /* CONFIG_DPP */
1116}
1117
1118/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001119void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001120{
1121#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001122 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001123 return;
1124
Gabriel Biren57ededa2021-09-03 16:08:50 +00001125 wpas_aidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001126#endif /* CONFIG_DPP */
1127}
1128
Hai Shalom706f99b2019-01-08 16:23:37 -08001129void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001130{
1131#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001132 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001133 return;
1134
Gabriel Biren57ededa2021-09-03 16:08:50 +00001135 wpas_aidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001136#endif /* CONFIG_DPP */
1137}
1138
1139/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001140void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001141{
1142#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001143 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001144 return;
1145
Gabriel Biren57ededa2021-09-03 16:08:50 +00001146 wpas_aidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001147#endif /* CONFIG_DPP */
1148}
1149
Hai Shalom706f99b2019-01-08 16:23:37 -08001150void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001151{
1152#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001153 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001154 return;
1155
Gabriel Biren57ededa2021-09-03 16:08:50 +00001156 wpas_aidl_notify_dpp_missing_auth(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001157#endif /* CONFIG_DPP */
1158}
1159
Hai Shalom706f99b2019-01-08 16:23:37 -08001160void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001161{
1162#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001163 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001164 return;
1165
Gabriel Biren57ededa2021-09-03 16:08:50 +00001166 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001167#endif /* CONFIG_DPP */
1168}
1169
Hai Shalom706f99b2019-01-08 16:23:37 -08001170void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001171{
1172#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001173 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001174 return;
1175
Gabriel Biren57ededa2021-09-03 16:08:50 +00001176 wpas_aidl_notify_dpp_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001177#endif /* CONFIG_DPP */
1178}
1179
Hai Shalom706f99b2019-01-08 16:23:37 -08001180void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001181{
1182#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001183 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001184 return;
1185
Gabriel Biren57ededa2021-09-03 16:08:50 +00001186 wpas_aidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001187#endif /* CONFIG_DPP */
1188}
1189
Hai Shalom706f99b2019-01-08 16:23:37 -08001190void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001191{
1192#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001193 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001194 return;
1195
Gabriel Biren57ededa2021-09-03 16:08:50 +00001196 wpas_aidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001197#endif /* CONFIG_DPP */
1198}
Jimmy Chen126b1702019-08-28 17:59:33 +08001199
Hai Shalom06768112019-12-04 15:49:43 -08001200void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1201{
1202#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001203 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001204#endif /* CONFIG_DPP2 */
1205}
1206
1207void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1208{
1209#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001210 wpas_aidl_notify_dpp_config_accepted(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001211#endif /* CONFIG_DPP2 */
1212}
1213
1214void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1215 enum dpp_status_error status, const char *ssid,
1216 const char *channel_list, unsigned short band_list[], int size)
1217{
1218#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001219 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
Hai Shalom06768112019-12-04 15:49:43 -08001220#endif /* CONFIG_DPP2 */
1221}
1222
1223void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1224{
1225#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001226 wpas_aidl_notify_dpp_config_rejected(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001227#endif /* CONFIG_DPP2 */
1228}
1229
Jimmy Chen126b1702019-08-28 17:59:33 +08001230void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1231 struct rsn_pmksa_cache_entry *entry)
1232{
1233 if (!wpa_s)
1234 return;
1235
Gabriel Biren57ededa2021-09-03 16:08:50 +00001236 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
Jimmy Chen126b1702019-08-28 17:59:33 +08001237}
Jimmy Chen39deead2020-10-14 23:47:20 +08001238
1239void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1240 struct wpa_ssid *ssid,
1241 u8 bitmap)
1242{
1243 if (!wpa_s)
1244 return;
1245
1246 if (!ssid)
1247 return;
1248
Gabriel Biren57ededa2021-09-03 16:08:50 +00001249 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
Jimmy Chen39deead2020-10-14 23:47:20 +08001250}
Sunil Ravi07c17622021-01-11 12:00:53 -08001251
1252void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1253{
1254 if (!wpa_s)
1255 return;
1256
Gabriel Biren57ededa2021-09-03 16:08:50 +00001257 wpas_aidl_notify_network_not_found(wpa_s);
Sunil Ravi07c17622021-01-11 12:00:53 -08001258}
Hai Shalomc1a21442022-02-04 13:43:00 -08001259
1260#ifdef CONFIG_INTERWORKING
1261
1262void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1263 struct wpa_bss *bss,
1264 struct wpa_cred *cred, int excluded,
1265 const char *type, int bh, int bss_load,
1266 int conn_capab)
1267{
1268 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1269 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1270 MAC2STR(bss->bssid), type,
1271 bh ? " below_min_backhaul=1" : "",
1272 bss_load ? " over_max_bss_load=1" : "",
1273 conn_capab ? " conn_capab_missing=1" : "",
1274 cred->id, cred->priority, cred->sp_priority);
1275
1276 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1277 bh, bss_load, conn_capab);
1278}
1279
1280
1281void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1282{
1283 wpas_dbus_signal_interworking_select_done(wpa_s);
1284}
1285
1286#endif /* CONFIG_INTERWORKING */
1287
Gabriel Biren3a2ec2c2022-03-07 17:59:41 +00001288void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1289 const char* reason_string)
1290{
1291 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1292}
1293
1294void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1295 const char *reason_string)
1296{
1297 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1298}
1299
1300void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1301 const char *reason_string)
1302{
1303 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1304}
Shivani Baranwal84940f82022-02-02 10:21:47 +05301305
1306void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1307{
1308 if (!wpa_s)
1309 return;
1310
1311 wpas_aidl_notify_qos_policy_reset(wpa_s);
1312}
1313
1314void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1315 struct dscp_policy_data *policies, int num_policies)
1316{
1317 if (!wpa_s || !policies)
1318 return;
1319
1320 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1321}
Sunil Ravi65a724b2022-05-24 11:06:09 -07001322
1323void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency)
1324{
1325 if (!wpa_s)
1326 return;
1327
1328 wpas_aidl_notify_frequency_changed(wpa_s, frequency);
1329}