blob: 4c305186f0970f3ecbe8b40c00885667e5388e1a [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);
Sunil Ravi23087aa2021-12-08 19:01:44 -0800475
476 wpas_aidl_notify_bss_freq_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700477}
478
479
480void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
481 unsigned int id)
482{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800483 if (wpa_s->p2p_mgmt)
484 return;
485
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700486 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
487 id);
488}
489
490
491void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
492 unsigned int id)
493{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800494 if (wpa_s->p2p_mgmt)
495 return;
496
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700497 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
498 id);
499}
500
501
502void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
503 unsigned int id)
504{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800505 if (wpa_s->p2p_mgmt)
506 return;
507
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700508 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
509}
510
511
512void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
513 unsigned int id)
514{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800515 if (wpa_s->p2p_mgmt)
516 return;
517
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700518 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
519}
520
521
522void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
523 unsigned int id)
524{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800525 if (wpa_s->p2p_mgmt)
526 return;
527
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700528 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
529}
530
531
532void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
533 unsigned int id)
534{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800535 if (wpa_s->p2p_mgmt)
536 return;
537
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800538#ifdef CONFIG_WPS
539 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
540#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700541}
542
543
544void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
545 unsigned int id)
546{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800547 if (wpa_s->p2p_mgmt)
548 return;
549
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700550 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
551}
552
553
554void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
555 unsigned int id)
556{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800557 if (wpa_s->p2p_mgmt)
558 return;
559
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700560 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
561}
562
563
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700564void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
565{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800566 if (wpa_s->p2p_mgmt)
567 return;
568
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700569 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
570}
571
572
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700573void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
574{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800575 if (wpa_s->p2p_mgmt)
576 return;
577
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700578 wpas_dbus_signal_blob_added(wpa_s, name);
579}
580
581
582void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
583{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800584 if (wpa_s->p2p_mgmt)
585 return;
586
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700587 wpas_dbus_signal_blob_removed(wpa_s, name);
588}
589
590
591void wpas_notify_debug_level_changed(struct wpa_global *global)
592{
593 wpas_dbus_signal_debug_level_changed(global);
594}
595
596
597void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
598{
599 wpas_dbus_signal_debug_timestamp_changed(global);
600}
601
602
603void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
604{
605 wpas_dbus_signal_debug_show_keys_changed(global);
606}
607
608
609void wpas_notify_suspend(struct wpa_global *global)
610{
611 struct wpa_supplicant *wpa_s;
612
613 os_get_time(&global->suspend_time);
614 wpa_printf(MSG_DEBUG, "System suspend notification");
615 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
616 wpa_drv_suspend(wpa_s);
617}
618
619
620void wpas_notify_resume(struct wpa_global *global)
621{
622 struct os_time now;
623 int slept;
624 struct wpa_supplicant *wpa_s;
625
626 if (global->suspend_time.sec == 0)
627 slept = -1;
628 else {
629 os_get_time(&now);
630 slept = now.sec - global->suspend_time.sec;
631 }
632 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
633 slept);
634
635 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
636 wpa_drv_resume(wpa_s);
637 if (wpa_s->wpa_state == WPA_DISCONNECTED)
638 wpa_supplicant_req_scan(wpa_s, 0, 100000);
639 }
640}
641
642
643#ifdef CONFIG_P2P
644
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700645void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
646{
647 /* Notify P2P find has stopped */
648 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800649
Gabriel Biren57ededa2021-09-03 16:08:50 +0000650 wpas_aidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700651}
652
653
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700654void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800655 const u8 *addr, const struct p2p_peer_info *info,
656 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
Jimmy Chen0133fc12021-03-04 13:56:11 +0800657 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800658 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700659{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700660 if (new_device) {
661 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800662 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700663 }
664
665 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800666 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
667
Gabriel Biren57ededa2021-09-03 16:08:50 +0000668 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800669 peer_wfd_device_info,
Jimmy Chen57e19f52021-03-04 14:19:52 +0800670 peer_wfd_device_info_len,
671 peer_wfd_r2_device_info,
672 peer_wfd_r2_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700673}
674
675
676void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
677 const u8 *dev_addr)
678{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700679 wpas_dbus_unregister_peer(wpa_s, dev_addr);
680
681 /* Create signal on interface object*/
682 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800683
Gabriel Biren57ededa2021-09-03 16:08:50 +0000684 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700685}
686
687
688void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
689 const struct wpa_ssid *ssid,
690 const char *role)
691{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700692 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700693
694 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800695
Gabriel Biren57ededa2021-09-03 16:08:50 +0000696 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700697}
698
699
700void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700701 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700702{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700703 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800704
Gabriel Biren57ededa2021-09-03 16:08:50 +0000705 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700706}
707
708
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800709void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
710 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700711{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800712 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800713
Gabriel Biren57ededa2021-09-03 16:08:50 +0000714 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700715}
716
717
718void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
719 int status, const u8 *bssid)
720{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700721 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800722
Gabriel Biren57ededa2021-09-03 16:08:50 +0000723 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700724}
725
726
727void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
728 int freq, const u8 *sa, u8 dialog_token,
729 u16 update_indic, const u8 *tlvs,
730 size_t tlvs_len)
731{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700732 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
733 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700734}
735
736
737void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
738 const u8 *sa, u16 update_indic,
739 const u8 *tlvs, size_t tlvs_len)
740{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700741 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
742 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800743
Gabriel Biren57ededa2021-09-03 16:08:50 +0000744 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800745 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700746}
747
748
749/**
750 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
751 * @dev_addr: Who sent the request or responded to our request.
752 * @request: Will be 1 if request, 0 for response.
753 * @status: Valid only in case of response (0 in case of success)
754 * @config_methods: WPS config methods
755 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
756 *
757 * This can be used to notify:
758 * - Requests or responses
759 * - Various config methods
760 * - Failure condition in case of response
761 */
762void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
763 const u8 *dev_addr, int request,
764 enum p2p_prov_disc_status status,
765 u16 config_methods,
766 unsigned int generated_pin)
767{
768 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
769 status, config_methods,
770 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800771
Gabriel Biren57ededa2021-09-03 16:08:50 +0000772 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800773 status, config_methods,
774 generated_pin);
775
Jouni Malinen75ecf522011-06-27 15:19:46 -0700776}
777
778
779void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700780 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800781 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700782{
783 /* Notify a group has been started */
784 wpas_dbus_register_p2p_group(wpa_s, ssid);
785
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800786 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800787
Gabriel Biren57ededa2021-09-03 16:08:50 +0000788 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700789}
790
791
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800792void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
793 const char *reason)
794{
795 /* Notify a group formation failed */
796 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800797
Gabriel Biren57ededa2021-09-03 16:08:50 +0000798 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800799}
800
801
Jouni Malinen75ecf522011-06-27 15:19:46 -0700802void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
803 struct wps_event_fail *fail)
804{
805 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700806}
807
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800808
809void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
810 const u8 *sa, const u8 *go_dev_addr,
811 const u8 *bssid, int id, int op_freq)
812{
813 /* Notify a P2P Invitation Request */
814 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
815 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800816
Gabriel Biren57ededa2021-09-03 16:08:50 +0000817 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800818 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800819}
820
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700821#endif /* CONFIG_P2P */
822
823
824static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800825 const u8 *sta,
826 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700827{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700828#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800829 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
830
Jouni Malinen75ecf522011-06-27 15:19:46 -0700831 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700832 * Create 'peer-joined' signal on group object -- will also
833 * check P2P itself.
834 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800835 if (p2p_dev_addr)
836 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700837#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700838
Hai Shalom74f70d42019-02-11 14:42:39 -0800839 /* Register the station */
840 wpas_dbus_register_sta(wpa_s, sta);
841
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700842 /* Notify listeners a new station has been authorized */
843 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800844
Gabriel Biren57ededa2021-09-03 16:08:50 +0000845 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700846}
847
848
849static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700850 const u8 *sta,
851 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700852{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700853#ifdef CONFIG_P2P
854 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700855 * Create 'peer-disconnected' signal on group object if this
856 * is a P2P group.
857 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800858 if (p2p_dev_addr)
859 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700860#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700861
862 /* Notify listeners a station has been deauthorized */
863 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800864
Gabriel Biren57ededa2021-09-03 16:08:50 +0000865 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800866 /* Unregister the station */
867 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700868}
869
870
871void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800872 const u8 *mac_addr, int authorized,
873 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700874{
875 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800876 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700877 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700878 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700879}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700880
881
Hai Shalom81f62d82019-07-22 12:10:00 -0700882void wpas_notify_certification(struct wpa_supplicant *wpa_s,
883 struct tls_cert_data *cert,
884 const char *cert_hash)
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700885{
Hai Shalom81f62d82019-07-22 12:10:00 -0700886 int i;
Hai Shalom878cf7b2019-07-15 14:55:18 -0700887
Hai Shalom81f62d82019-07-22 12:10:00 -0700888 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
Hai Shalomc3565922019-10-28 11:58:20 -0700889 "depth=%d subject='%s'%s%s%s%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700890 cert->depth, cert->subject, cert_hash ? " hash=" : "",
891 cert_hash ? cert_hash : "",
Hai Shalomc3565922019-10-28 11:58:20 -0700892 cert->tod == 2 ? " tod=2" : "",
893 cert->tod == 1 ? " tod=1" : "");
Hai Shalom81f62d82019-07-22 12:10:00 -0700894
895 if (cert->cert) {
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700896 char *cert_hex;
Hai Shalom81f62d82019-07-22 12:10:00 -0700897 size_t len = wpabuf_len(cert->cert) * 2 + 1;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700898 cert_hex = os_malloc(len);
899 if (cert_hex) {
Hai Shalom81f62d82019-07-22 12:10:00 -0700900 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
901 wpabuf_len(cert->cert));
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700902 wpa_msg_ctrl(wpa_s, MSG_INFO,
903 WPA_EVENT_EAP_PEER_CERT
904 "depth=%d subject='%s' cert=%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700905 cert->depth, cert->subject, cert_hex);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700906 os_free(cert_hex);
907 }
908 }
909
Hai Shalom81f62d82019-07-22 12:10:00 -0700910 for (i = 0; i < cert->num_altsubject; i++)
911 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
912 "depth=%d %s", cert->depth, cert->altsubject[i]);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800913
Jimmy Chen429daf92021-10-20 13:27:23 +0800914 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
915 cert->altsubject, cert->num_altsubject,
916 cert_hash, cert->cert);
917
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700918 /* notify the new DBus API */
Hai Shalom81f62d82019-07-22 12:10:00 -0700919 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
920 cert->altsubject, cert->num_altsubject,
921 cert_hash, cert->cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700922}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700923
924
925void wpas_notify_preq(struct wpa_supplicant *wpa_s,
926 const u8 *addr, const u8 *dst, const u8 *bssid,
927 const u8 *ie, size_t ie_len, u32 ssi_signal)
928{
929#ifdef CONFIG_AP
930 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
931#endif /* CONFIG_AP */
932}
933
934
935void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
936 const char *parameter)
937{
938 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700939 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
940 "status='%s' parameter='%s'",
941 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700942}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700943
Roshan Pius3a1667e2018-07-03 15:17:14 -0700944
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700945void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
946{
947 wpa_dbg(wpa_s, MSG_ERROR,
948 "EAP Error code = %d", error_code);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000949 wpas_aidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700950}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700951
Roshan Pius3a1667e2018-07-03 15:17:14 -0700952
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700953void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
954 struct wpa_ssid *ssid)
955{
956 if (wpa_s->current_ssid != ssid)
957 return;
958
959 wpa_dbg(wpa_s, MSG_DEBUG,
960 "Network bssid config changed for the current network - within-ESS roaming %s",
961 ssid->bssid_set ? "disabled" : "enabled");
962
963 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
964 ssid->bssid_set ? ssid->bssid : NULL);
965}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800966
967
968void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
969 struct wpa_ssid *ssid)
970{
971#ifdef CONFIG_P2P
972 if (ssid->disabled == 2) {
973 /* Changed from normal network profile to persistent group */
974 ssid->disabled = 0;
975 wpas_dbus_unregister_network(wpa_s, ssid->id);
976 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700977 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800978 wpas_dbus_register_persistent_group(wpa_s, ssid);
979 } else {
980 /* Changed from persistent group to normal network profile */
981 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700982 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800983 wpas_dbus_register_network(wpa_s, ssid);
984 }
985#endif /* CONFIG_P2P */
986}
Roshan Pius04a9d742016-12-12 12:40:46 -0800987
988void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
989 const char *result,
990 const struct wpa_bss_anqp *anqp)
991{
992#ifdef CONFIG_INTERWORKING
993 if (!wpa_s || !bssid || !anqp)
994 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800995
Gabriel Biren57ededa2021-09-03 16:08:50 +0000996 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -0800997#endif /* CONFIG_INTERWORKING */
998}
999
1000void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1001 const char* file_name, const u8* image,
1002 u32 image_length)
1003{
1004#ifdef CONFIG_HS20
1005 if (!wpa_s || !bssid || !file_name || !image)
1006 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001007
Gabriel Biren57ededa2021-09-03 16:08:50 +00001008 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
Roshan Pius9322a342016-12-12 14:45:02 -08001009 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001010#endif /* CONFIG_HS20 */
1011}
1012
1013void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1014 const char* url,
1015 u8 osu_method)
1016{
1017#ifdef CONFIG_HS20
1018 if (!wpa_s || !url)
1019 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001020
Gabriel Biren57ededa2021-09-03 16:08:50 +00001021 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001022#endif /* CONFIG_HS20 */
1023}
1024
1025void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1026 u8 code, u16 reauth_delay,
1027 const char *url)
1028{
1029#ifdef CONFIG_HS20
Hai Shalomb3a7c702020-10-20 12:22:53 -07001030 if (!wpa_s)
Roshan Pius04a9d742016-12-12 12:40:46 -08001031 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001032
Gabriel Biren57ededa2021-09-03 16:08:50 +00001033 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
Hai Shalom04a4ca62020-10-28 19:04:47 -07001034 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001035#endif /* CONFIG_HS20 */
1036}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001037
Hai Shalom04a4ca62020-10-28 19:04:47 -07001038void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
1039 struct wpa_supplicant *wpa_s, const char *url) {
1040#ifdef CONFIG_HS20
1041 if (!wpa_s || !url)
1042 return;
1043
Gabriel Biren57ededa2021-09-03 16:08:50 +00001044 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
Hai Shalom04a4ca62020-10-28 19:04:47 -07001045#endif /* CONFIG_HS20 */
1046}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001047
1048#ifdef CONFIG_MESH
1049
1050void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1051 struct wpa_ssid *ssid)
1052{
1053 if (wpa_s->p2p_mgmt)
1054 return;
1055
1056 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1057}
1058
1059
1060void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1061 const u8 *meshid, u8 meshid_len,
Hai Shalom81f62d82019-07-22 12:10:00 -07001062 u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001063{
1064 if (wpa_s->p2p_mgmt)
1065 return;
1066
1067 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1068 reason_code);
1069}
1070
1071
1072void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1073 const u8 *peer_addr)
1074{
1075 if (wpa_s->p2p_mgmt)
1076 return;
1077
1078 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1079}
1080
1081
1082void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
Hai Shalom81f62d82019-07-22 12:10:00 -07001083 const u8 *peer_addr, u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001084{
1085 if (wpa_s->p2p_mgmt)
1086 return;
1087
1088 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1089}
1090
1091#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001092
1093/*
1094 * DPP Notifications
1095 */
1096
1097/* DPP Success notifications */
1098
Hai Shalom706f99b2019-01-08 16:23:37 -08001099void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Hai Shalom59532852018-12-07 10:32:58 -08001100 struct wpa_ssid *ssid)
1101{
1102#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001103 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001104 return;
1105
Gabriel Biren57ededa2021-09-03 16:08:50 +00001106 wpas_aidl_notify_dpp_config_received(wpa_s, ssid);
Hai Shalom59532852018-12-07 10:32:58 -08001107#endif /* CONFIG_DPP */
1108}
1109
Hai Shalom706f99b2019-01-08 16:23:37 -08001110void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001111{
1112#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001113 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001114 return;
1115
Gabriel Biren57ededa2021-09-03 16:08:50 +00001116 wpas_aidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001117#endif /* CONFIG_DPP */
1118}
1119
1120/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001121void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001122{
1123#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001124 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001125 return;
1126
Gabriel Biren57ededa2021-09-03 16:08:50 +00001127 wpas_aidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001128#endif /* CONFIG_DPP */
1129}
1130
Hai Shalom706f99b2019-01-08 16:23:37 -08001131void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001132{
1133#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001134 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001135 return;
1136
Gabriel Biren57ededa2021-09-03 16:08:50 +00001137 wpas_aidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001138#endif /* CONFIG_DPP */
1139}
1140
1141/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001142void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001143{
1144#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001145 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001146 return;
1147
Gabriel Biren57ededa2021-09-03 16:08:50 +00001148 wpas_aidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001149#endif /* CONFIG_DPP */
1150}
1151
Hai Shalom706f99b2019-01-08 16:23:37 -08001152void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001153{
1154#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001155 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001156 return;
1157
Gabriel Biren57ededa2021-09-03 16:08:50 +00001158 wpas_aidl_notify_dpp_missing_auth(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001159#endif /* CONFIG_DPP */
1160}
1161
Hai Shalom706f99b2019-01-08 16:23:37 -08001162void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001163{
1164#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001165 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001166 return;
1167
Gabriel Biren57ededa2021-09-03 16:08:50 +00001168 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001169#endif /* CONFIG_DPP */
1170}
1171
Hai Shalom706f99b2019-01-08 16:23:37 -08001172void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001173{
1174#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001175 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001176 return;
1177
Gabriel Biren57ededa2021-09-03 16:08:50 +00001178 wpas_aidl_notify_dpp_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001179#endif /* CONFIG_DPP */
1180}
1181
Hai Shalom706f99b2019-01-08 16:23:37 -08001182void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001183{
1184#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001185 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001186 return;
1187
Gabriel Biren57ededa2021-09-03 16:08:50 +00001188 wpas_aidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001189#endif /* CONFIG_DPP */
1190}
1191
Hai Shalom706f99b2019-01-08 16:23:37 -08001192void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001193{
1194#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001195 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001196 return;
1197
Gabriel Biren57ededa2021-09-03 16:08:50 +00001198 wpas_aidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001199#endif /* CONFIG_DPP */
1200}
Jimmy Chen126b1702019-08-28 17:59:33 +08001201
Hai Shalom06768112019-12-04 15:49:43 -08001202void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1203{
1204#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001205 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001206#endif /* CONFIG_DPP2 */
1207}
1208
1209void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1210{
1211#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001212 wpas_aidl_notify_dpp_config_accepted(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001213#endif /* CONFIG_DPP2 */
1214}
1215
1216void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1217 enum dpp_status_error status, const char *ssid,
1218 const char *channel_list, unsigned short band_list[], int size)
1219{
1220#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001221 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
Hai Shalom06768112019-12-04 15:49:43 -08001222#endif /* CONFIG_DPP2 */
1223}
1224
1225void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1226{
1227#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001228 wpas_aidl_notify_dpp_config_rejected(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001229#endif /* CONFIG_DPP2 */
1230}
1231
Jimmy Chen126b1702019-08-28 17:59:33 +08001232void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1233 struct rsn_pmksa_cache_entry *entry)
1234{
1235 if (!wpa_s)
1236 return;
1237
Gabriel Biren57ededa2021-09-03 16:08:50 +00001238 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
Jimmy Chen126b1702019-08-28 17:59:33 +08001239}
Jimmy Chen39deead2020-10-14 23:47:20 +08001240
1241void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1242 struct wpa_ssid *ssid,
1243 u8 bitmap)
1244{
1245 if (!wpa_s)
1246 return;
1247
1248 if (!ssid)
1249 return;
1250
Gabriel Biren57ededa2021-09-03 16:08:50 +00001251 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
Jimmy Chen39deead2020-10-14 23:47:20 +08001252}
Sunil Ravi07c17622021-01-11 12:00:53 -08001253
1254void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1255{
1256 if (!wpa_s)
1257 return;
1258
Gabriel Biren57ededa2021-09-03 16:08:50 +00001259 wpas_aidl_notify_network_not_found(wpa_s);
Sunil Ravi07c17622021-01-11 12:00:53 -08001260}
Hai Shalomc1a21442022-02-04 13:43:00 -08001261
1262#ifdef CONFIG_INTERWORKING
1263
1264void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1265 struct wpa_bss *bss,
1266 struct wpa_cred *cred, int excluded,
1267 const char *type, int bh, int bss_load,
1268 int conn_capab)
1269{
1270 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1271 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1272 MAC2STR(bss->bssid), type,
1273 bh ? " below_min_backhaul=1" : "",
1274 bss_load ? " over_max_bss_load=1" : "",
1275 conn_capab ? " conn_capab_missing=1" : "",
1276 cred->id, cred->priority, cred->sp_priority);
1277
1278 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1279 bh, bss_load, conn_capab);
1280}
1281
1282
1283void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1284{
1285 wpas_dbus_signal_interworking_select_done(wpa_s);
1286}
1287
1288#endif /* CONFIG_INTERWORKING */
1289
Gabriel Biren3a2ec2c2022-03-07 17:59:41 +00001290void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1291 const char* reason_string)
1292{
1293 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1294}
1295
1296void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1297 const char *reason_string)
1298{
1299 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1300}
1301
1302void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1303 const char *reason_string)
1304{
1305 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1306}
Shivani Baranwal84940f82022-02-02 10:21:47 +05301307
1308void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1309{
1310 if (!wpa_s)
1311 return;
1312
1313 wpas_aidl_notify_qos_policy_reset(wpa_s);
1314}
1315
1316void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1317 struct dscp_policy_data *policies, int num_policies)
1318{
1319 if (!wpa_s || !policies)
1320 return;
1321
1322 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1323}