blob: bd4b8ae211d8e016f4ba10ba8e731c97a71dc07b [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"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070020#include "driver_i.h"
21#include "scan.h"
22#include "p2p_supplicant.h"
23#include "sme.h"
24#include "notify.h"
Roshan Piusedd820c2017-05-16 14:21:49 -070025#include "hidl.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070026
27int wpas_notify_supplicant_initialized(struct wpa_global *global)
28{
Hai Shalom021b0b52019-04-10 11:17:58 -070029#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070030 if (global->params.dbus_ctrl_interface) {
31 global->dbus = wpas_dbus_init(global);
32 if (global->dbus == NULL)
33 return -1;
34 }
Hai Shalom021b0b52019-04-10 11:17:58 -070035#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070036
Roshan Pius57ffbcf2016-09-27 09:12:46 -070037#ifdef CONFIG_HIDL
38 global->hidl = wpas_hidl_init(global);
39 if (!global->hidl)
Dmitry Shmidte4663042016-04-04 10:07:49 -070040 return -1;
Roshan Pius57ffbcf2016-09-27 09:12:46 -070041#endif /* CONFIG_HIDL */
Dmitry Shmidte4663042016-04-04 10:07:49 -070042
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070043 return 0;
44}
45
46
47void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
48{
Hai Shalom021b0b52019-04-10 11:17:58 -070049#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070050 if (global->dbus)
51 wpas_dbus_deinit(global->dbus);
Hai Shalom021b0b52019-04-10 11:17:58 -070052#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidte4663042016-04-04 10:07:49 -070053
Roshan Pius57ffbcf2016-09-27 09:12:46 -070054#ifdef CONFIG_HIDL
55 if (global->hidl)
56 wpas_hidl_deinit(global->hidl);
57#endif /* CONFIG_HIDL */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070058}
59
60
61int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
62{
Hai Shalom021b0b52019-04-10 11:17:58 -070063 if (wpa_s->p2p_mgmt)
64 return 0;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070065
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080066 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Roshan Pius57ffbcf2016-09-27 09:12:46 -070067 if (wpas_hidl_register_interface(wpa_s))
Roshan Pius54e763a2016-07-06 15:41:53 -070068 return -1;
69
Hai Shalom021b0b52019-04-10 11:17:58 -070070 if (wpas_dbus_register_interface(wpa_s))
71 return -1;
72
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070073 return 0;
74}
75
76
77void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
78{
Hai Shalom021b0b52019-04-10 11:17:58 -070079 if (wpa_s->p2p_mgmt)
80 return;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070081
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080082 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Roshan Pius57ffbcf2016-09-27 09:12:46 -070083 wpas_hidl_unregister_interface(wpa_s);
Hai Shalom021b0b52019-04-10 11:17:58 -070084
85 /* unregister interface in new DBus ctrl iface */
86 wpas_dbus_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
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700128 wpas_hidl_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
Roshan Piusbe158772017-03-10 17:54:37 -0800139 wpas_hidl_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
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800152void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s)
153{
154 if (wpa_s->p2p_mgmt)
155 return;
156
157 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
Roshan Pius0974e962016-12-12 17:05:51 -0800158
159 wpas_hidl_notify_assoc_reject(wpa_s);
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800160}
161
Roshan Pius38e96762017-01-23 14:52:00 -0800162void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
163 if (wpa_s->p2p_mgmt)
164 return;
165
166 wpas_hidl_notify_auth_timeout(wpa_s);
167}
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800168
Hai Shalom74f70d42019-02-11 14:42:39 -0800169void wpas_notify_roam_time(struct wpa_supplicant *wpa_s)
170{
171 if (wpa_s->p2p_mgmt)
172 return;
173
174 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME);
175}
176
177
178void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s)
179{
180 if (wpa_s->p2p_mgmt)
181 return;
182
183 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE);
184}
185
186
187void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
188{
189 if (wpa_s->p2p_mgmt)
190 return;
191
192 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH);
193}
194
195
196void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
197{
198 if (wpa_s->p2p_mgmt)
199 return;
200
201 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
202}
203
204
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700205void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
206{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800207 if (wpa_s->p2p_mgmt)
208 return;
209
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700210 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
211}
212
213
214void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
215{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800216 if (wpa_s->p2p_mgmt)
217 return;
218
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700219 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
220}
221
222
223void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
224{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800225 if (wpa_s->p2p_mgmt)
226 return;
227
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700228 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
Roshan Piuse746d6b2017-03-21 08:53:04 -0700229
230 wpas_hidl_notify_bssid_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700231}
232
233
234void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
235{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800236 if (wpa_s->p2p_mgmt)
237 return;
238
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700239 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
240}
241
242
243void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
244 struct wpa_ssid *ssid)
245{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800246 if (wpa_s->p2p_mgmt)
247 return;
248
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700249 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
250}
251
252
253void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
254 struct wpa_ssid *ssid)
255{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800256 if (wpa_s->p2p_mgmt)
257 return;
258
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700259 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
260}
261
262
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800263void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
264 struct wpa_ssid *ssid,
265 enum wpa_ctrl_req_type rtype,
266 const char *default_txt)
267{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800268 if (wpa_s->p2p_mgmt)
269 return;
270
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800271 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700272
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700273 wpas_hidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800274}
275
276
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700277void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
278{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800279 if (wpa_s->p2p_mgmt)
280 return;
281
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700282 /* notify the new DBus API */
283 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
284}
285
286
287void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
288{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800289 if (wpa_s->p2p_mgmt)
290 return;
291
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700292 wpas_dbus_signal_scan_done(wpa_s, success);
293}
294
295
296void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
297{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800298 if (wpa_s->p2p_mgmt)
299 return;
300
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700301 wpas_wps_notify_scan_results(wpa_s);
302}
303
304
305void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
306 const struct wps_credential *cred)
307{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800308 if (wpa_s->p2p_mgmt)
309 return;
310
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700311#ifdef CONFIG_WPS
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700312 /* notify the new DBus API */
313 wpas_dbus_signal_wps_cred(wpa_s, cred);
314#endif /* CONFIG_WPS */
315}
316
317
318void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
319 struct wps_event_m2d *m2d)
320{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800321 if (wpa_s->p2p_mgmt)
322 return;
323
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700324#ifdef CONFIG_WPS
325 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
326#endif /* CONFIG_WPS */
327}
328
329
330void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
331 struct wps_event_fail *fail)
332{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800333 if (wpa_s->p2p_mgmt)
334 return;
335
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700336#ifdef CONFIG_WPS
337 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800338
339 wpas_hidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
340 fail->config_error,
341 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700342#endif /* CONFIG_WPS */
343}
344
345
346void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
347{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800348 if (wpa_s->p2p_mgmt)
349 return;
350
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700351#ifdef CONFIG_WPS
352 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800353
354 wpas_hidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700355#endif /* CONFIG_WPS */
356}
357
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700358void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
359{
360 if (wpa_s->p2p_mgmt)
361 return;
362
363#ifdef CONFIG_WPS
364 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800365
366 wpas_hidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700367#endif /* CONFIG_WPS */
368}
369
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700370
371void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
372 struct wpa_ssid *ssid)
373{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800374 if (wpa_s->p2p_mgmt)
375 return;
376
Jouni Malinen75ecf522011-06-27 15:19:46 -0700377 /*
378 * Networks objects created during any P2P activities should not be
379 * exposed out. They might/will confuse certain non-P2P aware
380 * applications since these network objects won't behave like
381 * regular ones.
382 */
Roshan Piusd3854452016-07-07 16:46:41 -0700383 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700384 wpas_dbus_register_network(wpa_s, ssid);
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700385 wpas_hidl_register_network(wpa_s, ssid);
Roshan Piusd3854452016-07-07 16:46:41 -0700386 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700387}
388
389
390void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
391 struct wpa_ssid *ssid)
392{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700393#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700394 wpas_dbus_register_persistent_group(wpa_s, ssid);
Glen Kuhne30990d62017-04-19 14:16:48 -0700395 wpas_hidl_register_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700396#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700397}
398
399
400void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
401 struct wpa_ssid *ssid)
402{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700403#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700404 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Glen Kuhne30990d62017-04-19 14:16:48 -0700405 wpas_hidl_unregister_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700406#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700407}
408
409
410void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
411 struct wpa_ssid *ssid)
412{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800413 if (wpa_s->next_ssid == ssid)
414 wpa_s->next_ssid = NULL;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800415 if (wpa_s->wpa)
416 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700417 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700418 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700419 wpas_dbus_unregister_network(wpa_s, ssid->id);
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700420 wpas_hidl_unregister_network(wpa_s, ssid);
Roshan Piusd3854452016-07-07 16:46:41 -0700421 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800422 if (network_is_persistent_group(ssid))
423 wpas_notify_persistent_group_removed(wpa_s, ssid);
424
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800425 wpas_p2p_network_removed(wpa_s, ssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700426}
427
428
429void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
430 u8 bssid[], unsigned int id)
431{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800432 if (wpa_s->p2p_mgmt)
433 return;
434
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700435 wpas_dbus_register_bss(wpa_s, bssid, id);
436 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
437 id, MAC2STR(bssid));
438}
439
440
441void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
442 u8 bssid[], unsigned int id)
443{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800444 if (wpa_s->p2p_mgmt)
445 return;
446
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700447 wpas_dbus_unregister_bss(wpa_s, bssid, id);
448 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
449 id, MAC2STR(bssid));
450}
451
452
453void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
454 unsigned int id)
455{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800456 if (wpa_s->p2p_mgmt)
457 return;
458
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700459 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
460}
461
462
463void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
464 unsigned int id)
465{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800466 if (wpa_s->p2p_mgmt)
467 return;
468
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700469 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
470 id);
471}
472
473
474void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
475 unsigned int id)
476{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800477 if (wpa_s->p2p_mgmt)
478 return;
479
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700480 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
481 id);
482}
483
484
485void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
486 unsigned int id)
487{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800488 if (wpa_s->p2p_mgmt)
489 return;
490
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700491 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
492}
493
494
495void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
496 unsigned int id)
497{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800498 if (wpa_s->p2p_mgmt)
499 return;
500
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700501 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
502}
503
504
505void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
506 unsigned int id)
507{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800508 if (wpa_s->p2p_mgmt)
509 return;
510
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700511 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
512}
513
514
515void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
516 unsigned int id)
517{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800518 if (wpa_s->p2p_mgmt)
519 return;
520
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800521#ifdef CONFIG_WPS
522 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
523#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700524}
525
526
527void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
528 unsigned int id)
529{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800530 if (wpa_s->p2p_mgmt)
531 return;
532
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700533 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
534}
535
536
537void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
538 unsigned int id)
539{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800540 if (wpa_s->p2p_mgmt)
541 return;
542
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700543 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
544}
545
546
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700547void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
548{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800549 if (wpa_s->p2p_mgmt)
550 return;
551
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700552 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
553}
554
555
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700556void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
557{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800558 if (wpa_s->p2p_mgmt)
559 return;
560
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700561 wpas_dbus_signal_blob_added(wpa_s, name);
562}
563
564
565void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
566{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800567 if (wpa_s->p2p_mgmt)
568 return;
569
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700570 wpas_dbus_signal_blob_removed(wpa_s, name);
571}
572
573
574void wpas_notify_debug_level_changed(struct wpa_global *global)
575{
576 wpas_dbus_signal_debug_level_changed(global);
577}
578
579
580void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
581{
582 wpas_dbus_signal_debug_timestamp_changed(global);
583}
584
585
586void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
587{
588 wpas_dbus_signal_debug_show_keys_changed(global);
589}
590
591
592void wpas_notify_suspend(struct wpa_global *global)
593{
594 struct wpa_supplicant *wpa_s;
595
596 os_get_time(&global->suspend_time);
597 wpa_printf(MSG_DEBUG, "System suspend notification");
598 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
599 wpa_drv_suspend(wpa_s);
600}
601
602
603void wpas_notify_resume(struct wpa_global *global)
604{
605 struct os_time now;
606 int slept;
607 struct wpa_supplicant *wpa_s;
608
609 if (global->suspend_time.sec == 0)
610 slept = -1;
611 else {
612 os_get_time(&now);
613 slept = now.sec - global->suspend_time.sec;
614 }
615 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
616 slept);
617
618 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
619 wpa_drv_resume(wpa_s);
620 if (wpa_s->wpa_state == WPA_DISCONNECTED)
621 wpa_supplicant_req_scan(wpa_s, 0, 100000);
622 }
623}
624
625
626#ifdef CONFIG_P2P
627
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700628void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
629{
630 /* Notify P2P find has stopped */
631 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800632
633 wpas_hidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700634}
635
636
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700637void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800638 const u8 *addr, const struct p2p_peer_info *info,
639 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
640 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700641{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700642 if (new_device) {
643 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800644 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700645 }
646
647 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800648 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
649
650 wpas_hidl_notify_p2p_device_found(wpa_s, addr, info,
651 peer_wfd_device_info,
652 peer_wfd_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700653}
654
655
656void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
657 const u8 *dev_addr)
658{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700659 wpas_dbus_unregister_peer(wpa_s, dev_addr);
660
661 /* Create signal on interface object*/
662 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800663
664 wpas_hidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700665}
666
667
668void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
669 const struct wpa_ssid *ssid,
670 const char *role)
671{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700672 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700673
674 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800675
676 wpas_hidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700677}
678
679
680void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700681 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700682{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700683 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800684
685 wpas_hidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700686}
687
688
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800689void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
690 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700691{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800692 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800693
694 wpas_hidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700695}
696
697
698void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
699 int status, const u8 *bssid)
700{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700701 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800702
703 wpas_hidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700704}
705
706
707void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
708 int freq, const u8 *sa, u8 dialog_token,
709 u16 update_indic, const u8 *tlvs,
710 size_t tlvs_len)
711{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700712 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
713 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700714}
715
716
717void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
718 const u8 *sa, u16 update_indic,
719 const u8 *tlvs, size_t tlvs_len)
720{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700721 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
722 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800723
724 wpas_hidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
725 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700726}
727
728
729/**
730 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
731 * @dev_addr: Who sent the request or responded to our request.
732 * @request: Will be 1 if request, 0 for response.
733 * @status: Valid only in case of response (0 in case of success)
734 * @config_methods: WPS config methods
735 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
736 *
737 * This can be used to notify:
738 * - Requests or responses
739 * - Various config methods
740 * - Failure condition in case of response
741 */
742void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
743 const u8 *dev_addr, int request,
744 enum p2p_prov_disc_status status,
745 u16 config_methods,
746 unsigned int generated_pin)
747{
748 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
749 status, config_methods,
750 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800751
752 wpas_hidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
753 status, config_methods,
754 generated_pin);
755
Jouni Malinen75ecf522011-06-27 15:19:46 -0700756}
757
758
759void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700760 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800761 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700762{
763 /* Notify a group has been started */
764 wpas_dbus_register_p2p_group(wpa_s, ssid);
765
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800766 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800767
Roshan Pius7a1c8482017-04-12 17:05:10 -0700768 wpas_hidl_notify_p2p_group_started(wpa_s, ssid, persistent, client);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700769}
770
771
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800772void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
773 const char *reason)
774{
775 /* Notify a group formation failed */
776 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800777
778 wpas_hidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800779}
780
781
Jouni Malinen75ecf522011-06-27 15:19:46 -0700782void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
783 struct wps_event_fail *fail)
784{
785 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700786}
787
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800788
789void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
790 const u8 *sa, const u8 *go_dev_addr,
791 const u8 *bssid, int id, int op_freq)
792{
793 /* Notify a P2P Invitation Request */
794 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
795 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800796
797 wpas_hidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
798 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800799}
800
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700801#endif /* CONFIG_P2P */
802
803
804static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800805 const u8 *sta,
806 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700807{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700808#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800809 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
810
Jouni Malinen75ecf522011-06-27 15:19:46 -0700811 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700812 * Create 'peer-joined' signal on group object -- will also
813 * check P2P itself.
814 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800815 if (p2p_dev_addr)
816 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700817#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700818
Hai Shalom74f70d42019-02-11 14:42:39 -0800819 /* Register the station */
820 wpas_dbus_register_sta(wpa_s, sta);
821
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700822 /* Notify listeners a new station has been authorized */
823 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800824
825 wpas_hidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700826}
827
828
829static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700830 const u8 *sta,
831 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700832{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700833#ifdef CONFIG_P2P
834 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700835 * Create 'peer-disconnected' signal on group object if this
836 * is a P2P group.
837 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800838 if (p2p_dev_addr)
839 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700840#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700841
842 /* Notify listeners a station has been deauthorized */
843 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800844
lesl4b7058c2019-02-27 18:45:19 +0800845 wpas_hidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800846 /* Unregister the station */
847 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700848}
849
850
851void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800852 const u8 *mac_addr, int authorized,
853 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700854{
855 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800856 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700857 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700858 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700859}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700860
861
862void wpas_notify_certification(struct wpa_supplicant *wpa_s, int depth,
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800863 const char *subject, const char *altsubject[],
864 int num_altsubject, const char *cert_hash,
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700865 const struct wpabuf *cert)
866{
867 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
868 "depth=%d subject='%s'%s%s",
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800869 depth, subject, cert_hash ? " hash=" : "",
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700870 cert_hash ? cert_hash : "");
871
872 if (cert) {
873 char *cert_hex;
874 size_t len = wpabuf_len(cert) * 2 + 1;
875 cert_hex = os_malloc(len);
876 if (cert_hex) {
877 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert),
878 wpabuf_len(cert));
879 wpa_msg_ctrl(wpa_s, MSG_INFO,
880 WPA_EVENT_EAP_PEER_CERT
881 "depth=%d subject='%s' cert=%s",
882 depth, subject, cert_hex);
883 os_free(cert_hex);
884 }
885 }
886
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800887 if (altsubject) {
888 int i;
889
890 for (i = 0; i < num_altsubject; i++)
891 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
892 "depth=%d %s", depth, altsubject[i]);
893 }
894
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700895 /* notify the new DBus API */
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800896 wpas_dbus_signal_certification(wpa_s, depth, subject, altsubject,
897 num_altsubject, cert_hash, cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700898}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700899
900
901void wpas_notify_preq(struct wpa_supplicant *wpa_s,
902 const u8 *addr, const u8 *dst, const u8 *bssid,
903 const u8 *ie, size_t ie_len, u32 ssi_signal)
904{
905#ifdef CONFIG_AP
906 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
907#endif /* CONFIG_AP */
908}
909
910
911void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
912 const char *parameter)
913{
914 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700915 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
916 "status='%s' parameter='%s'",
917 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700918}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700919
Roshan Pius3a1667e2018-07-03 15:17:14 -0700920
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700921void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
922{
923 wpa_dbg(wpa_s, MSG_ERROR,
924 "EAP Error code = %d", error_code);
Ahmed ElArabawy30eab622018-03-19 18:36:48 -0700925 wpas_hidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700926}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700927
Roshan Pius3a1667e2018-07-03 15:17:14 -0700928
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700929void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
930 struct wpa_ssid *ssid)
931{
932 if (wpa_s->current_ssid != ssid)
933 return;
934
935 wpa_dbg(wpa_s, MSG_DEBUG,
936 "Network bssid config changed for the current network - within-ESS roaming %s",
937 ssid->bssid_set ? "disabled" : "enabled");
938
939 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
940 ssid->bssid_set ? ssid->bssid : NULL);
941}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800942
943
944void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
945 struct wpa_ssid *ssid)
946{
947#ifdef CONFIG_P2P
948 if (ssid->disabled == 2) {
949 /* Changed from normal network profile to persistent group */
950 ssid->disabled = 0;
951 wpas_dbus_unregister_network(wpa_s, ssid->id);
952 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700953 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800954 wpas_dbus_register_persistent_group(wpa_s, ssid);
955 } else {
956 /* Changed from persistent group to normal network profile */
957 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700958 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800959 wpas_dbus_register_network(wpa_s, ssid);
960 }
961#endif /* CONFIG_P2P */
962}
Roshan Pius04a9d742016-12-12 12:40:46 -0800963
964void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
965 const char *result,
966 const struct wpa_bss_anqp *anqp)
967{
968#ifdef CONFIG_INTERWORKING
969 if (!wpa_s || !bssid || !anqp)
970 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800971
972 wpas_hidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -0800973#endif /* CONFIG_INTERWORKING */
974}
975
976void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
977 const char* file_name, const u8* image,
978 u32 image_length)
979{
980#ifdef CONFIG_HS20
981 if (!wpa_s || !bssid || !file_name || !image)
982 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800983
984 wpas_hidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
985 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -0800986#endif /* CONFIG_HS20 */
987}
988
989void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
990 const char* url,
991 u8 osu_method)
992{
993#ifdef CONFIG_HS20
994 if (!wpa_s || !url)
995 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800996
997 wpas_hidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -0800998#endif /* CONFIG_HS20 */
999}
1000
1001void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1002 u8 code, u16 reauth_delay,
1003 const char *url)
1004{
1005#ifdef CONFIG_HS20
1006 if (!wpa_s || !url)
1007 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001008
1009 wpas_hidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
1010 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001011#endif /* CONFIG_HS20 */
1012}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001013
1014
1015#ifdef CONFIG_MESH
1016
1017void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1018 struct wpa_ssid *ssid)
1019{
1020 if (wpa_s->p2p_mgmt)
1021 return;
1022
1023 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1024}
1025
1026
1027void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1028 const u8 *meshid, u8 meshid_len,
1029 int reason_code)
1030{
1031 if (wpa_s->p2p_mgmt)
1032 return;
1033
1034 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1035 reason_code);
1036}
1037
1038
1039void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1040 const u8 *peer_addr)
1041{
1042 if (wpa_s->p2p_mgmt)
1043 return;
1044
1045 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1046}
1047
1048
1049void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
1050 const u8 *peer_addr, int reason_code)
1051{
1052 if (wpa_s->p2p_mgmt)
1053 return;
1054
1055 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1056}
1057
1058#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001059
1060/*
1061 * DPP Notifications
1062 */
1063
1064/* DPP Success notifications */
1065
Hai Shalom706f99b2019-01-08 16:23:37 -08001066void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Hai Shalom59532852018-12-07 10:32:58 -08001067 struct wpa_ssid *ssid)
1068{
1069#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001070 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001071 return;
1072
Hai Shalom706f99b2019-01-08 16:23:37 -08001073 wpas_hidl_notify_dpp_config_received(wpa_s, ssid);
Hai Shalom59532852018-12-07 10:32:58 -08001074#endif /* CONFIG_DPP */
1075}
1076
Hai Shalom706f99b2019-01-08 16:23:37 -08001077void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001078{
1079#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001080 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001081 return;
1082
Hai Shalom706f99b2019-01-08 16:23:37 -08001083 wpas_hidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001084#endif /* CONFIG_DPP */
1085}
1086
1087/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001088void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001089{
1090#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001091 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001092 return;
1093
Hai Shalom706f99b2019-01-08 16:23:37 -08001094 wpas_hidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001095#endif /* CONFIG_DPP */
1096}
1097
Hai Shalom706f99b2019-01-08 16:23:37 -08001098void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001099{
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
Hai Shalom706f99b2019-01-08 16:23:37 -08001104 wpas_hidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001105#endif /* CONFIG_DPP */
1106}
1107
1108/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001109void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001110{
1111#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001112 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001113 return;
1114
Hai Shalom706f99b2019-01-08 16:23:37 -08001115 wpas_hidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001116#endif /* CONFIG_DPP */
1117}
1118
Hai Shalom706f99b2019-01-08 16:23:37 -08001119void wpas_notify_dpp_missing_auth(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
Hai Shalom706f99b2019-01-08 16:23:37 -08001125 wpas_hidl_notify_dpp_missing_auth(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_configuration_failure(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
Hai Shalom706f99b2019-01-08 16:23:37 -08001135 wpas_hidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001136#endif /* CONFIG_DPP */
1137}
1138
Hai Shalom706f99b2019-01-08 16:23:37 -08001139void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001140{
1141#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001142 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001143 return;
1144
Hai Shalom706f99b2019-01-08 16:23:37 -08001145 wpas_hidl_notify_dpp_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001146#endif /* CONFIG_DPP */
1147}
1148
Hai Shalom706f99b2019-01-08 16:23:37 -08001149void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001150{
1151#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001152 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001153 return;
1154
Hai Shalom706f99b2019-01-08 16:23:37 -08001155 wpas_hidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001156#endif /* CONFIG_DPP */
1157}
1158
Hai Shalom706f99b2019-01-08 16:23:37 -08001159void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001160{
1161#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001162 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001163 return;
1164
Hai Shalom706f99b2019-01-08 16:23:37 -08001165 wpas_hidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001166#endif /* CONFIG_DPP */
1167}