blob: 4df1343a693e48a1ddc46030080c6744f02ffbf5 [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"
17#include "dbus/dbus_old.h"
18#include "dbus/dbus_new.h"
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080019#include "rsn_supp/wpa.h"
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080020#include "fst/fst.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070021#include "driver_i.h"
22#include "scan.h"
23#include "p2p_supplicant.h"
24#include "sme.h"
25#include "notify.h"
Roshan Piusedd820c2017-05-16 14:21:49 -070026#include "hidl.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070027
28int wpas_notify_supplicant_initialized(struct wpa_global *global)
29{
30#ifdef CONFIG_DBUS
31 if (global->params.dbus_ctrl_interface) {
32 global->dbus = wpas_dbus_init(global);
33 if (global->dbus == NULL)
34 return -1;
35 }
36#endif /* CONFIG_DBUS */
37
Roshan Pius57ffbcf2016-09-27 09:12:46 -070038#ifdef CONFIG_HIDL
39 global->hidl = wpas_hidl_init(global);
40 if (!global->hidl)
Dmitry Shmidte4663042016-04-04 10:07:49 -070041 return -1;
Roshan Pius57ffbcf2016-09-27 09:12:46 -070042#endif /* CONFIG_HIDL */
Dmitry Shmidte4663042016-04-04 10:07:49 -070043
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070044 return 0;
45}
46
47
48void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
49{
50#ifdef CONFIG_DBUS
51 if (global->dbus)
52 wpas_dbus_deinit(global->dbus);
53#endif /* CONFIG_DBUS */
Dmitry Shmidte4663042016-04-04 10:07:49 -070054
Roshan Pius57ffbcf2016-09-27 09:12:46 -070055#ifdef CONFIG_HIDL
56 if (global->hidl)
57 wpas_hidl_deinit(global->hidl);
58#endif /* CONFIG_HIDL */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070059}
60
61
62int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
63{
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080064 if (!wpa_s->p2p_mgmt) {
65 if (wpas_dbus_register_iface(wpa_s))
66 return -1;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080067
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080068 if (wpas_dbus_register_interface(wpa_s))
69 return -1;
70 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070071
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080072 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Roshan Pius57ffbcf2016-09-27 09:12:46 -070073 if (wpas_hidl_register_interface(wpa_s))
Roshan Pius54e763a2016-07-06 15:41:53 -070074 return -1;
75
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070076 return 0;
77}
78
79
80void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
81{
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080082 if (!wpa_s->p2p_mgmt) {
83 /* unregister interface in old DBus ctrl iface */
84 wpas_dbus_unregister_iface(wpa_s);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080085
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080086 /* unregister interface in new DBus ctrl iface */
87 wpas_dbus_unregister_interface(wpa_s);
88 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070089
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080090 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Roshan Pius57ffbcf2016-09-27 09:12:46 -070091 wpas_hidl_unregister_interface(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070092}
93
94
95void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
96 enum wpa_states new_state,
97 enum wpa_states old_state)
98{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080099 if (wpa_s->p2p_mgmt)
100 return;
101
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700102 /* notify the old DBus API */
103 wpa_supplicant_dbus_notify_state_change(wpa_s, new_state,
104 old_state);
105
106 /* notify the new DBus API */
107 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
108
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800109#ifdef CONFIG_FST
110 if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
111 if (new_state == WPA_COMPLETED)
112 fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid);
113 else if (old_state >= WPA_ASSOCIATED &&
114 new_state < WPA_ASSOCIATED)
115 fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
116 }
117#endif /* CONFIG_FST */
118
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700119 if (new_state == WPA_COMPLETED)
120 wpas_p2p_notif_connected(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700121 else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700122 wpas_p2p_notif_disconnected(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700123
124 sme_state_changed(wpa_s);
125
126#ifdef ANDROID
127 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
Irfan Sherifff20a4432012-04-16 16:48:34 -0700128 "id=%d state=%d BSSID=" MACSTR " SSID=%s",
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700129 wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
Irfan Sherifff20a4432012-04-16 16:48:34 -0700130 new_state,
Irfan Sheriffe78e7672012-08-01 11:10:15 -0700131 MAC2STR(wpa_s->bssid),
andy2_kuo5b5fb022012-05-22 11:53:07 -0700132 wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
133 wpa_ssid_txt(wpa_s->current_ssid->ssid,
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800134 wpa_s->current_ssid->ssid_len) : "");
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700135#endif /* ANDROID */
Roshan Piuse8d0d162016-08-01 13:09:26 -0700136
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700137 wpas_hidl_notify_state_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700138}
139
140
Dmitry Shmidt04949592012-07-19 12:16:46 -0700141void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
142{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800143 if (wpa_s->p2p_mgmt)
144 return;
145
Dmitry Shmidt04949592012-07-19 12:16:46 -0700146 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
Roshan Pius0974e962016-12-12 17:05:51 -0800147
Roshan Piusbe158772017-03-10 17:54:37 -0800148 wpas_hidl_notify_disconnect_reason(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700149}
150
151
Hai Shalom74f70d42019-02-11 14:42:39 -0800152void wpas_notify_auth_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_AUTH_STATUS_CODE);
158}
159
160
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800161void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s)
162{
163 if (wpa_s->p2p_mgmt)
164 return;
165
166 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
Roshan Pius0974e962016-12-12 17:05:51 -0800167
168 wpas_hidl_notify_assoc_reject(wpa_s);
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800169}
170
Roshan Pius38e96762017-01-23 14:52:00 -0800171void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
172 if (wpa_s->p2p_mgmt)
173 return;
174
175 wpas_hidl_notify_auth_timeout(wpa_s);
176}
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800177
Hai Shalom74f70d42019-02-11 14:42:39 -0800178void wpas_notify_roam_time(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_TIME);
184}
185
186
187void wpas_notify_roam_complete(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_ROAM_COMPLETE);
193}
194
195
196void wpas_notify_session_length(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_SESSION_LENGTH);
202}
203
204
205void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
206{
207 if (wpa_s->p2p_mgmt)
208 return;
209
210 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
211}
212
213
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700214void wpas_notify_network_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_CURRENT_NETWORK);
220}
221
222
223void wpas_notify_ap_scan_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_AP_SCAN);
229}
230
231
232void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
233{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800234 if (wpa_s->p2p_mgmt)
235 return;
236
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700237 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
Roshan Piuse746d6b2017-03-21 08:53:04 -0700238
239 wpas_hidl_notify_bssid_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700240}
241
242
243void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
244{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800245 if (wpa_s->p2p_mgmt)
246 return;
247
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700248 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
249}
250
251
252void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
253 struct wpa_ssid *ssid)
254{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800255 if (wpa_s->p2p_mgmt)
256 return;
257
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700258 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
259}
260
261
262void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
263 struct wpa_ssid *ssid)
264{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800265 if (wpa_s->p2p_mgmt)
266 return;
267
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700268 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
269}
270
271
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800272void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
273 struct wpa_ssid *ssid,
274 enum wpa_ctrl_req_type rtype,
275 const char *default_txt)
276{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800277 if (wpa_s->p2p_mgmt)
278 return;
279
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800280 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700281
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700282 wpas_hidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800283}
284
285
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700286void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
287{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800288 if (wpa_s->p2p_mgmt)
289 return;
290
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700291 /* notify the old DBus API */
292 wpa_supplicant_dbus_notify_scanning(wpa_s);
293
294 /* notify the new DBus API */
295 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
296}
297
298
299void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
300{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800301 if (wpa_s->p2p_mgmt)
302 return;
303
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700304 wpas_dbus_signal_scan_done(wpa_s, success);
305}
306
307
308void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
309{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800310 if (wpa_s->p2p_mgmt)
311 return;
312
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700313 /* notify the old DBus API */
314 wpa_supplicant_dbus_notify_scan_results(wpa_s);
315
316 wpas_wps_notify_scan_results(wpa_s);
317}
318
319
320void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
321 const struct wps_credential *cred)
322{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800323 if (wpa_s->p2p_mgmt)
324 return;
325
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700326#ifdef CONFIG_WPS
327 /* notify the old DBus API */
328 wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
329 /* notify the new DBus API */
330 wpas_dbus_signal_wps_cred(wpa_s, cred);
331#endif /* CONFIG_WPS */
332}
333
334
335void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
336 struct wps_event_m2d *m2d)
337{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800338 if (wpa_s->p2p_mgmt)
339 return;
340
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700341#ifdef CONFIG_WPS
342 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
343#endif /* CONFIG_WPS */
344}
345
346
347void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
348 struct wps_event_fail *fail)
349{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800350 if (wpa_s->p2p_mgmt)
351 return;
352
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700353#ifdef CONFIG_WPS
354 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800355
356 wpas_hidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
357 fail->config_error,
358 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700359#endif /* CONFIG_WPS */
360}
361
362
363void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
364{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800365 if (wpa_s->p2p_mgmt)
366 return;
367
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700368#ifdef CONFIG_WPS
369 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800370
371 wpas_hidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700372#endif /* CONFIG_WPS */
373}
374
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700375void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
376{
377 if (wpa_s->p2p_mgmt)
378 return;
379
380#ifdef CONFIG_WPS
381 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800382
383 wpas_hidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700384#endif /* CONFIG_WPS */
385}
386
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700387
388void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
389 struct wpa_ssid *ssid)
390{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800391 if (wpa_s->p2p_mgmt)
392 return;
393
Jouni Malinen75ecf522011-06-27 15:19:46 -0700394 /*
395 * Networks objects created during any P2P activities should not be
396 * exposed out. They might/will confuse certain non-P2P aware
397 * applications since these network objects won't behave like
398 * regular ones.
399 */
Roshan Piusd3854452016-07-07 16:46:41 -0700400 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700401 wpas_dbus_register_network(wpa_s, ssid);
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700402 wpas_hidl_register_network(wpa_s, ssid);
Roshan Piusd3854452016-07-07 16:46:41 -0700403 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700404}
405
406
407void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
408 struct wpa_ssid *ssid)
409{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700410#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700411 wpas_dbus_register_persistent_group(wpa_s, ssid);
Glen Kuhne30990d62017-04-19 14:16:48 -0700412 wpas_hidl_register_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700413#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700414}
415
416
417void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
418 struct wpa_ssid *ssid)
419{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700420#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700421 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Glen Kuhne30990d62017-04-19 14:16:48 -0700422 wpas_hidl_unregister_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700423#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700424}
425
426
427void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
428 struct wpa_ssid *ssid)
429{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800430 if (wpa_s->next_ssid == ssid)
431 wpa_s->next_ssid = NULL;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800432 if (wpa_s->wpa)
433 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700434 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700435 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700436 wpas_dbus_unregister_network(wpa_s, ssid->id);
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700437 wpas_hidl_unregister_network(wpa_s, ssid);
Roshan Piusd3854452016-07-07 16:46:41 -0700438 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800439 if (network_is_persistent_group(ssid))
440 wpas_notify_persistent_group_removed(wpa_s, ssid);
441
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800442 wpas_p2p_network_removed(wpa_s, ssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700443}
444
445
446void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
447 u8 bssid[], unsigned int id)
448{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800449 if (wpa_s->p2p_mgmt)
450 return;
451
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700452 wpas_dbus_register_bss(wpa_s, bssid, id);
453 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
454 id, MAC2STR(bssid));
455}
456
457
458void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
459 u8 bssid[], unsigned int id)
460{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800461 if (wpa_s->p2p_mgmt)
462 return;
463
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700464 wpas_dbus_unregister_bss(wpa_s, bssid, id);
465 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
466 id, MAC2STR(bssid));
467}
468
469
470void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
471 unsigned int id)
472{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800473 if (wpa_s->p2p_mgmt)
474 return;
475
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700476 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
477}
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
650 wpas_hidl_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,
657 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700658{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700659 if (new_device) {
660 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800661 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700662 }
663
664 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800665 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
666
667 wpas_hidl_notify_p2p_device_found(wpa_s, addr, info,
668 peer_wfd_device_info,
669 peer_wfd_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700670}
671
672
673void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
674 const u8 *dev_addr)
675{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700676 wpas_dbus_unregister_peer(wpa_s, dev_addr);
677
678 /* Create signal on interface object*/
679 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800680
681 wpas_hidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700682}
683
684
685void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
686 const struct wpa_ssid *ssid,
687 const char *role)
688{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700689 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700690
691 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800692
693 wpas_hidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700694}
695
696
697void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700698 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700699{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700700 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800701
702 wpas_hidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700703}
704
705
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800706void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
707 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700708{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800709 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800710
711 wpas_hidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700712}
713
714
715void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
716 int status, const u8 *bssid)
717{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700718 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800719
720 wpas_hidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700721}
722
723
724void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
725 int freq, const u8 *sa, u8 dialog_token,
726 u16 update_indic, const u8 *tlvs,
727 size_t tlvs_len)
728{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700729 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
730 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700731}
732
733
734void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
735 const u8 *sa, u16 update_indic,
736 const u8 *tlvs, size_t tlvs_len)
737{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700738 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
739 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800740
741 wpas_hidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
742 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700743}
744
745
746/**
747 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
748 * @dev_addr: Who sent the request or responded to our request.
749 * @request: Will be 1 if request, 0 for response.
750 * @status: Valid only in case of response (0 in case of success)
751 * @config_methods: WPS config methods
752 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
753 *
754 * This can be used to notify:
755 * - Requests or responses
756 * - Various config methods
757 * - Failure condition in case of response
758 */
759void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
760 const u8 *dev_addr, int request,
761 enum p2p_prov_disc_status status,
762 u16 config_methods,
763 unsigned int generated_pin)
764{
765 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
766 status, config_methods,
767 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800768
769 wpas_hidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
770 status, config_methods,
771 generated_pin);
772
Jouni Malinen75ecf522011-06-27 15:19:46 -0700773}
774
775
776void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700777 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800778 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700779{
780 /* Notify a group has been started */
781 wpas_dbus_register_p2p_group(wpa_s, ssid);
782
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800783 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800784
Roshan Pius7a1c8482017-04-12 17:05:10 -0700785 wpas_hidl_notify_p2p_group_started(wpa_s, ssid, persistent, client);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700786}
787
788
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800789void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
790 const char *reason)
791{
792 /* Notify a group formation failed */
793 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800794
795 wpas_hidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800796}
797
798
Jouni Malinen75ecf522011-06-27 15:19:46 -0700799void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
800 struct wps_event_fail *fail)
801{
802 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700803}
804
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800805
806void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
807 const u8 *sa, const u8 *go_dev_addr,
808 const u8 *bssid, int id, int op_freq)
809{
810 /* Notify a P2P Invitation Request */
811 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
812 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800813
814 wpas_hidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
815 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800816}
817
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700818#endif /* CONFIG_P2P */
819
820
821static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800822 const u8 *sta,
823 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700824{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700825#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800826 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
827
Jouni Malinen75ecf522011-06-27 15:19:46 -0700828 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700829 * Create 'peer-joined' signal on group object -- will also
830 * check P2P itself.
831 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800832 if (p2p_dev_addr)
833 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700834#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700835
Hai Shalom74f70d42019-02-11 14:42:39 -0800836 /* Register the station */
837 wpas_dbus_register_sta(wpa_s, sta);
838
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700839 /* Notify listeners a new station has been authorized */
840 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800841
842 wpas_hidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700843}
844
845
846static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700847 const u8 *sta,
848 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700849{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700850#ifdef CONFIG_P2P
851 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700852 * Create 'peer-disconnected' signal on group object if this
853 * is a P2P group.
854 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800855 if (p2p_dev_addr)
856 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700857#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700858
859 /* Notify listeners a station has been deauthorized */
860 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800861
lesl4b7058c2019-02-27 18:45:19 +0800862 wpas_hidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800863 /* Unregister the station */
864 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700865}
866
867
868void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800869 const u8 *mac_addr, int authorized,
870 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700871{
872 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800873 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700874 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700875 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700876}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700877
878
879void wpas_notify_certification(struct wpa_supplicant *wpa_s, int depth,
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800880 const char *subject, const char *altsubject[],
881 int num_altsubject, const char *cert_hash,
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700882 const struct wpabuf *cert)
883{
884 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
885 "depth=%d subject='%s'%s%s",
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800886 depth, subject, cert_hash ? " hash=" : "",
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700887 cert_hash ? cert_hash : "");
888
889 if (cert) {
890 char *cert_hex;
891 size_t len = wpabuf_len(cert) * 2 + 1;
892 cert_hex = os_malloc(len);
893 if (cert_hex) {
894 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert),
895 wpabuf_len(cert));
896 wpa_msg_ctrl(wpa_s, MSG_INFO,
897 WPA_EVENT_EAP_PEER_CERT
898 "depth=%d subject='%s' cert=%s",
899 depth, subject, cert_hex);
900 os_free(cert_hex);
901 }
902 }
903
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800904 if (altsubject) {
905 int i;
906
907 for (i = 0; i < num_altsubject; i++)
908 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
909 "depth=%d %s", depth, altsubject[i]);
910 }
911
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700912 /* notify the old DBus API */
913 wpa_supplicant_dbus_notify_certification(wpa_s, depth, subject,
914 cert_hash, cert);
915 /* notify the new DBus API */
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800916 wpas_dbus_signal_certification(wpa_s, depth, subject, altsubject,
917 num_altsubject, cert_hash, cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700918}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700919
920
921void wpas_notify_preq(struct wpa_supplicant *wpa_s,
922 const u8 *addr, const u8 *dst, const u8 *bssid,
923 const u8 *ie, size_t ie_len, u32 ssi_signal)
924{
925#ifdef CONFIG_AP
926 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
927#endif /* CONFIG_AP */
928}
929
930
931void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
932 const char *parameter)
933{
934 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700935 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
936 "status='%s' parameter='%s'",
937 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700938}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700939
Roshan Pius3a1667e2018-07-03 15:17:14 -0700940
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700941void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
942{
943 wpa_dbg(wpa_s, MSG_ERROR,
944 "EAP Error code = %d", error_code);
Ahmed ElArabawy30eab622018-03-19 18:36:48 -0700945 wpas_hidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700946}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700947
Roshan Pius3a1667e2018-07-03 15:17:14 -0700948
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700949void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
950 struct wpa_ssid *ssid)
951{
952 if (wpa_s->current_ssid != ssid)
953 return;
954
955 wpa_dbg(wpa_s, MSG_DEBUG,
956 "Network bssid config changed for the current network - within-ESS roaming %s",
957 ssid->bssid_set ? "disabled" : "enabled");
958
959 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
960 ssid->bssid_set ? ssid->bssid : NULL);
961}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800962
963
964void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
965 struct wpa_ssid *ssid)
966{
967#ifdef CONFIG_P2P
968 if (ssid->disabled == 2) {
969 /* Changed from normal network profile to persistent group */
970 ssid->disabled = 0;
971 wpas_dbus_unregister_network(wpa_s, ssid->id);
972 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700973 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800974 wpas_dbus_register_persistent_group(wpa_s, ssid);
975 } else {
976 /* Changed from persistent group to normal network profile */
977 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700978 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800979 wpas_dbus_register_network(wpa_s, ssid);
980 }
981#endif /* CONFIG_P2P */
982}
Roshan Pius04a9d742016-12-12 12:40:46 -0800983
984void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
985 const char *result,
986 const struct wpa_bss_anqp *anqp)
987{
988#ifdef CONFIG_INTERWORKING
989 if (!wpa_s || !bssid || !anqp)
990 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800991
992 wpas_hidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -0800993#endif /* CONFIG_INTERWORKING */
994}
995
996void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
997 const char* file_name, const u8* image,
998 u32 image_length)
999{
1000#ifdef CONFIG_HS20
1001 if (!wpa_s || !bssid || !file_name || !image)
1002 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001003
1004 wpas_hidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
1005 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001006#endif /* CONFIG_HS20 */
1007}
1008
1009void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1010 const char* url,
1011 u8 osu_method)
1012{
1013#ifdef CONFIG_HS20
1014 if (!wpa_s || !url)
1015 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001016
1017 wpas_hidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001018#endif /* CONFIG_HS20 */
1019}
1020
1021void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1022 u8 code, u16 reauth_delay,
1023 const char *url)
1024{
1025#ifdef CONFIG_HS20
1026 if (!wpa_s || !url)
1027 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001028
1029 wpas_hidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
1030 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001031#endif /* CONFIG_HS20 */
1032}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001033
1034
1035#ifdef CONFIG_MESH
1036
1037void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1038 struct wpa_ssid *ssid)
1039{
1040 if (wpa_s->p2p_mgmt)
1041 return;
1042
1043 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1044}
1045
1046
1047void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1048 const u8 *meshid, u8 meshid_len,
1049 int reason_code)
1050{
1051 if (wpa_s->p2p_mgmt)
1052 return;
1053
1054 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1055 reason_code);
1056}
1057
1058
1059void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1060 const u8 *peer_addr)
1061{
1062 if (wpa_s->p2p_mgmt)
1063 return;
1064
1065 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1066}
1067
1068
1069void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
1070 const u8 *peer_addr, int reason_code)
1071{
1072 if (wpa_s->p2p_mgmt)
1073 return;
1074
1075 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1076}
1077
1078#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001079
1080/*
1081 * DPP Notifications
1082 */
1083
1084/* DPP Success notifications */
1085
Hai Shalom706f99b2019-01-08 16:23:37 -08001086void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Hai Shalom59532852018-12-07 10:32:58 -08001087 struct wpa_ssid *ssid)
1088{
1089#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001090 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001091 return;
1092
Hai Shalom706f99b2019-01-08 16:23:37 -08001093 wpas_hidl_notify_dpp_config_received(wpa_s, ssid);
Hai Shalom59532852018-12-07 10:32:58 -08001094#endif /* CONFIG_DPP */
1095}
1096
Hai Shalom706f99b2019-01-08 16:23:37 -08001097void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001098{
1099#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001100 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001101 return;
1102
Hai Shalom706f99b2019-01-08 16:23:37 -08001103 wpas_hidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001104#endif /* CONFIG_DPP */
1105}
1106
1107/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001108void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001109{
1110#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001111 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001112 return;
1113
Hai Shalom706f99b2019-01-08 16:23:37 -08001114 wpas_hidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001115#endif /* CONFIG_DPP */
1116}
1117
Hai Shalom706f99b2019-01-08 16:23:37 -08001118void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001119{
1120#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001121 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001122 return;
1123
Hai Shalom706f99b2019-01-08 16:23:37 -08001124 wpas_hidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001125#endif /* CONFIG_DPP */
1126}
1127
1128/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001129void wpas_notify_dpp_not_compatible(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_not_compatible(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_missing_auth(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_missing_auth(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_configuration_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_configuration_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_timeout(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_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001166#endif /* CONFIG_DPP */
1167}
1168
Hai Shalom706f99b2019-01-08 16:23:37 -08001169void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001170{
1171#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001172 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001173 return;
1174
Hai Shalom706f99b2019-01-08 16:23:37 -08001175 wpas_hidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001176#endif /* CONFIG_DPP */
1177}
1178
Hai Shalom706f99b2019-01-08 16:23:37 -08001179void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001180{
1181#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001182 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001183 return;
1184
Hai Shalom706f99b2019-01-08 16:23:37 -08001185 wpas_hidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001186#endif /* CONFIG_DPP */
1187}