| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * wpa_supplicant - Event notifications | 
 | 3 |  * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi> | 
 | 4 |  * | 
| Dmitry Shmidt | c5ec7f5 | 2012-03-06 16:33:24 -0800 | [diff] [blame] | 5 |  * This software may be distributed under the terms of the BSD license. | 
 | 6 |  * See README for more details. | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 7 |  */ | 
 | 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 Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 17 | #include "dbus/dbus_new.h" | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 18 | #include "rsn_supp/wpa.h" | 
| Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 19 | #include "fst/fst.h" | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 20 | #include "crypto/tls.h" | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 21 | #include "driver_i.h" | 
 | 22 | #include "scan.h" | 
 | 23 | #include "p2p_supplicant.h" | 
 | 24 | #include "sme.h" | 
 | 25 | #include "notify.h" | 
| Roshan Pius | edd820c | 2017-05-16 14:21:49 -0700 | [diff] [blame] | 26 | #include "hidl.h" | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 27 |  | 
 | 28 | int wpas_notify_supplicant_initialized(struct wpa_global *global) | 
 | 29 | { | 
| Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 30 | #ifdef CONFIG_CTRL_IFACE_DBUS_NEW | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 31 | 	if (global->params.dbus_ctrl_interface) { | 
 | 32 | 		global->dbus = wpas_dbus_init(global); | 
 | 33 | 		if (global->dbus == NULL) | 
 | 34 | 			return -1; | 
 | 35 | 	} | 
| Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 36 | #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 37 |  | 
| Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 38 | #ifdef CONFIG_HIDL | 
 | 39 | 	global->hidl = wpas_hidl_init(global); | 
 | 40 | 	if (!global->hidl) | 
| Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 41 | 		return -1; | 
| Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 42 | #endif /* CONFIG_HIDL */ | 
| Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 43 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 44 | 	return 0; | 
 | 45 | } | 
 | 46 |  | 
 | 47 |  | 
 | 48 | void wpas_notify_supplicant_deinitialized(struct wpa_global *global) | 
 | 49 | { | 
| Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 50 | #ifdef CONFIG_CTRL_IFACE_DBUS_NEW | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 51 | 	if (global->dbus) | 
 | 52 | 		wpas_dbus_deinit(global->dbus); | 
| Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 53 | #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ | 
| Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 54 |  | 
| Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 55 | #ifdef CONFIG_HIDL | 
 | 56 | 	if (global->hidl) | 
 | 57 | 		wpas_hidl_deinit(global->hidl); | 
 | 58 | #endif /* CONFIG_HIDL */ | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 59 | } | 
 | 60 |  | 
 | 61 |  | 
 | 62 | int wpas_notify_iface_added(struct wpa_supplicant *wpa_s) | 
 | 63 | { | 
| Hai Shalom | c480995 | 2019-04-30 14:45:55 -0700 | [diff] [blame] | 64 | 	if (!wpa_s->p2p_mgmt) { | 
 | 65 | 		if (wpas_dbus_register_interface(wpa_s)) | 
 | 66 | 			return -1; | 
 | 67 | 	} | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 68 |  | 
| Roshan Pius | d6d8b8d | 2016-11-08 14:45:26 -0800 | [diff] [blame] | 69 | 	/* HIDL interface wants to keep track of the P2P mgmt iface. */ | 
| Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 70 | 	if (wpas_hidl_register_interface(wpa_s)) | 
| Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 71 | 		return -1; | 
 | 72 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 73 | 	return 0; | 
 | 74 | } | 
 | 75 |  | 
 | 76 |  | 
 | 77 | void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s) | 
 | 78 | { | 
| Hai Shalom | c480995 | 2019-04-30 14:45:55 -0700 | [diff] [blame] | 79 | 	if (!wpa_s->p2p_mgmt) { | 
 | 80 | 		/* unregister interface in new DBus ctrl iface */ | 
 | 81 | 		wpas_dbus_unregister_interface(wpa_s); | 
 | 82 | 	} | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 83 |  | 
| Roshan Pius | d6d8b8d | 2016-11-08 14:45:26 -0800 | [diff] [blame] | 84 | 	/* HIDL interface wants to keep track of the P2P mgmt iface. */ | 
| Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 85 | 	wpas_hidl_unregister_interface(wpa_s); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 86 | } | 
 | 87 |  | 
 | 88 |  | 
 | 89 | void wpas_notify_state_changed(struct wpa_supplicant *wpa_s, | 
 | 90 | 			       enum wpa_states new_state, | 
 | 91 | 			       enum wpa_states old_state) | 
 | 92 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 93 | 	if (wpa_s->p2p_mgmt) | 
 | 94 | 		return; | 
 | 95 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 96 | 	/* notify the new DBus API */ | 
 | 97 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE); | 
 | 98 |  | 
| Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 99 | #ifdef CONFIG_FST | 
 | 100 | 	if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) { | 
 | 101 | 		if (new_state == WPA_COMPLETED) | 
 | 102 | 			fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid); | 
 | 103 | 		else if (old_state >= WPA_ASSOCIATED && | 
 | 104 | 			 new_state < WPA_ASSOCIATED) | 
 | 105 | 			fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid); | 
 | 106 | 	} | 
 | 107 | #endif /* CONFIG_FST */ | 
 | 108 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 109 | 	if (new_state == WPA_COMPLETED) | 
 | 110 | 		wpas_p2p_notif_connected(wpa_s); | 
| Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 111 | 	else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED) | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 112 | 		wpas_p2p_notif_disconnected(wpa_s); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 113 |  | 
 | 114 | 	sme_state_changed(wpa_s); | 
 | 115 |  | 
 | 116 | #ifdef ANDROID | 
 | 117 | 	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE | 
| Irfan Sheriff | f20a443 | 2012-04-16 16:48:34 -0700 | [diff] [blame] | 118 | 		     "id=%d state=%d BSSID=" MACSTR " SSID=%s", | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 119 | 		     wpa_s->current_ssid ? wpa_s->current_ssid->id : -1, | 
| Irfan Sheriff | f20a443 | 2012-04-16 16:48:34 -0700 | [diff] [blame] | 120 | 		     new_state, | 
| Irfan Sheriff | e78e767 | 2012-08-01 11:10:15 -0700 | [diff] [blame] | 121 | 		     MAC2STR(wpa_s->bssid), | 
| andy2_kuo | 5b5fb02 | 2012-05-22 11:53:07 -0700 | [diff] [blame] | 122 | 		     wpa_s->current_ssid && wpa_s->current_ssid->ssid ? | 
 | 123 | 		     wpa_ssid_txt(wpa_s->current_ssid->ssid, | 
| Dmitry Shmidt | e0e48dc | 2013-11-18 12:00:06 -0800 | [diff] [blame] | 124 | 				  wpa_s->current_ssid->ssid_len) : ""); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 125 | #endif /* ANDROID */ | 
| Roshan Pius | e8d0d16 | 2016-08-01 13:09:26 -0700 | [diff] [blame] | 126 |  | 
| Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 127 | 	wpas_hidl_notify_state_changed(wpa_s); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 128 | } | 
 | 129 |  | 
 | 130 |  | 
| Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 131 | void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s) | 
 | 132 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 133 | 	if (wpa_s->p2p_mgmt) | 
 | 134 | 		return; | 
 | 135 |  | 
| Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 136 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON); | 
| Roshan Pius | 0974e96 | 2016-12-12 17:05:51 -0800 | [diff] [blame] | 137 |  | 
| Roshan Pius | be15877 | 2017-03-10 17:54:37 -0800 | [diff] [blame] | 138 | 	wpas_hidl_notify_disconnect_reason(wpa_s); | 
| Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 139 | } | 
 | 140 |  | 
 | 141 |  | 
| Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 142 | void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s) | 
 | 143 | { | 
 | 144 | 	if (wpa_s->p2p_mgmt) | 
 | 145 | 		return; | 
 | 146 |  | 
 | 147 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_STATUS_CODE); | 
 | 148 | } | 
 | 149 |  | 
 | 150 |  | 
| Dmitry Shmidt | 31a29cc | 2016-03-09 15:58:17 -0800 | [diff] [blame] | 151 | void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s) | 
 | 152 | { | 
 | 153 | 	if (wpa_s->p2p_mgmt) | 
 | 154 | 		return; | 
 | 155 |  | 
 | 156 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE); | 
| Roshan Pius | 0974e96 | 2016-12-12 17:05:51 -0800 | [diff] [blame] | 157 |  | 
 | 158 | 	wpas_hidl_notify_assoc_reject(wpa_s); | 
| Dmitry Shmidt | 31a29cc | 2016-03-09 15:58:17 -0800 | [diff] [blame] | 159 | } | 
 | 160 |  | 
| Roshan Pius | 38e9676 | 2017-01-23 14:52:00 -0800 | [diff] [blame] | 161 | void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) { | 
 | 162 | 	if (wpa_s->p2p_mgmt) | 
 | 163 | 		return; | 
 | 164 |  | 
 | 165 | 	wpas_hidl_notify_auth_timeout(wpa_s); | 
 | 166 | } | 
| Dmitry Shmidt | 31a29cc | 2016-03-09 15:58:17 -0800 | [diff] [blame] | 167 |  | 
| Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 168 | void wpas_notify_roam_time(struct wpa_supplicant *wpa_s) | 
 | 169 | { | 
 | 170 | 	if (wpa_s->p2p_mgmt) | 
 | 171 | 		return; | 
 | 172 |  | 
 | 173 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME); | 
 | 174 | } | 
 | 175 |  | 
 | 176 |  | 
 | 177 | void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s) | 
 | 178 | { | 
 | 179 | 	if (wpa_s->p2p_mgmt) | 
 | 180 | 		return; | 
 | 181 |  | 
 | 182 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE); | 
 | 183 | } | 
 | 184 |  | 
 | 185 |  | 
 | 186 | void wpas_notify_session_length(struct wpa_supplicant *wpa_s) | 
 | 187 | { | 
 | 188 | 	if (wpa_s->p2p_mgmt) | 
 | 189 | 		return; | 
 | 190 |  | 
 | 191 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH); | 
 | 192 | } | 
 | 193 |  | 
 | 194 |  | 
 | 195 | void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s) | 
 | 196 | { | 
 | 197 | 	if (wpa_s->p2p_mgmt) | 
 | 198 | 		return; | 
 | 199 |  | 
 | 200 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS); | 
| Sunil Ravi | 4018d71 | 2019-12-06 18:01:21 -0800 | [diff] [blame] | 201 |  | 
 | 202 | #ifdef CONFIG_WNM | 
 | 203 | 	wpas_hidl_notify_bss_tm_status(wpa_s); | 
 | 204 | #endif | 
| Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 205 | } | 
 | 206 |  | 
 | 207 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 208 | void wpas_notify_network_changed(struct wpa_supplicant *wpa_s) | 
 | 209 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 210 | 	if (wpa_s->p2p_mgmt) | 
 | 211 | 		return; | 
 | 212 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 213 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK); | 
 | 214 | } | 
 | 215 |  | 
 | 216 |  | 
 | 217 | void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s) | 
 | 218 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 219 | 	if (wpa_s->p2p_mgmt) | 
 | 220 | 		return; | 
 | 221 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 222 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN); | 
 | 223 | } | 
 | 224 |  | 
 | 225 |  | 
 | 226 | void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s) | 
 | 227 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 228 | 	if (wpa_s->p2p_mgmt) | 
 | 229 | 		return; | 
 | 230 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 231 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS); | 
| Roshan Pius | e746d6b | 2017-03-21 08:53:04 -0700 | [diff] [blame] | 232 |  | 
 | 233 | 	wpas_hidl_notify_bssid_changed(wpa_s); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 234 | } | 
 | 235 |  | 
 | 236 |  | 
 | 237 | void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s) | 
 | 238 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 239 | 	if (wpa_s->p2p_mgmt) | 
 | 240 | 		return; | 
 | 241 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 242 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE); | 
 | 243 | } | 
 | 244 |  | 
 | 245 |  | 
 | 246 | void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s, | 
 | 247 | 					 struct wpa_ssid *ssid) | 
 | 248 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 249 | 	if (wpa_s->p2p_mgmt) | 
 | 250 | 		return; | 
 | 251 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 252 | 	wpas_dbus_signal_network_enabled_changed(wpa_s, ssid); | 
 | 253 | } | 
 | 254 |  | 
 | 255 |  | 
 | 256 | void wpas_notify_network_selected(struct wpa_supplicant *wpa_s, | 
 | 257 | 				  struct wpa_ssid *ssid) | 
 | 258 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 259 | 	if (wpa_s->p2p_mgmt) | 
 | 260 | 		return; | 
 | 261 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 262 | 	wpas_dbus_signal_network_selected(wpa_s, ssid->id); | 
 | 263 | } | 
 | 264 |  | 
 | 265 |  | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 266 | void wpas_notify_network_request(struct wpa_supplicant *wpa_s, | 
 | 267 | 				 struct wpa_ssid *ssid, | 
 | 268 | 				 enum wpa_ctrl_req_type rtype, | 
 | 269 | 				 const char *default_txt) | 
 | 270 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 271 | 	if (wpa_s->p2p_mgmt) | 
 | 272 | 		return; | 
 | 273 |  | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 274 | 	wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt); | 
| Roshan Pius | 65628ce | 2016-08-17 13:10:23 -0700 | [diff] [blame] | 275 |  | 
| Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 276 | 	wpas_hidl_notify_network_request(wpa_s, ssid, rtype, default_txt); | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 277 | } | 
 | 278 |  | 
 | 279 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 280 | void wpas_notify_scanning(struct wpa_supplicant *wpa_s) | 
 | 281 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 282 | 	if (wpa_s->p2p_mgmt) | 
 | 283 | 		return; | 
 | 284 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 285 | 	/* notify the new DBus API */ | 
 | 286 | 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING); | 
 | 287 | } | 
 | 288 |  | 
 | 289 |  | 
 | 290 | void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success) | 
 | 291 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 292 | 	if (wpa_s->p2p_mgmt) | 
 | 293 | 		return; | 
 | 294 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 295 | 	wpas_dbus_signal_scan_done(wpa_s, success); | 
 | 296 | } | 
 | 297 |  | 
 | 298 |  | 
 | 299 | void wpas_notify_scan_results(struct wpa_supplicant *wpa_s) | 
 | 300 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 301 | 	if (wpa_s->p2p_mgmt) | 
 | 302 | 		return; | 
 | 303 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 304 | 	wpas_wps_notify_scan_results(wpa_s); | 
 | 305 | } | 
 | 306 |  | 
 | 307 |  | 
 | 308 | void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s, | 
 | 309 | 				const struct wps_credential *cred) | 
 | 310 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 311 | 	if (wpa_s->p2p_mgmt) | 
 | 312 | 		return; | 
 | 313 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 314 | #ifdef CONFIG_WPS | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 315 | 	/* notify the new DBus API */ | 
 | 316 | 	wpas_dbus_signal_wps_cred(wpa_s, cred); | 
 | 317 | #endif /* CONFIG_WPS */ | 
 | 318 | } | 
 | 319 |  | 
 | 320 |  | 
 | 321 | void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s, | 
 | 322 | 			       struct wps_event_m2d *m2d) | 
 | 323 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 324 | 	if (wpa_s->p2p_mgmt) | 
 | 325 | 		return; | 
 | 326 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 327 | #ifdef CONFIG_WPS | 
 | 328 | 	wpas_dbus_signal_wps_event_m2d(wpa_s, m2d); | 
 | 329 | #endif /* CONFIG_WPS */ | 
 | 330 | } | 
 | 331 |  | 
 | 332 |  | 
 | 333 | void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s, | 
 | 334 | 				struct wps_event_fail *fail) | 
 | 335 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 336 | 	if (wpa_s->p2p_mgmt) | 
 | 337 | 		return; | 
 | 338 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 339 | #ifdef CONFIG_WPS | 
 | 340 | 	wpas_dbus_signal_wps_event_fail(wpa_s, fail); | 
| Roshan Pius | 1493275 | 2017-01-11 09:48:58 -0800 | [diff] [blame] | 341 |  | 
 | 342 | 	wpas_hidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr, | 
 | 343 | 					fail->config_error, | 
 | 344 | 					fail->error_indication); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 345 | #endif /* CONFIG_WPS */ | 
 | 346 | } | 
 | 347 |  | 
 | 348 |  | 
 | 349 | void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s) | 
 | 350 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 351 | 	if (wpa_s->p2p_mgmt) | 
 | 352 | 		return; | 
 | 353 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 354 | #ifdef CONFIG_WPS | 
 | 355 | 	wpas_dbus_signal_wps_event_success(wpa_s); | 
| Roshan Pius | 1493275 | 2017-01-11 09:48:58 -0800 | [diff] [blame] | 356 |  | 
 | 357 | 	wpas_hidl_notify_wps_event_success(wpa_s); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 358 | #endif /* CONFIG_WPS */ | 
 | 359 | } | 
 | 360 |  | 
| Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 361 | void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s) | 
 | 362 | { | 
 | 363 | 	if (wpa_s->p2p_mgmt) | 
 | 364 | 		return; | 
 | 365 |  | 
 | 366 | #ifdef CONFIG_WPS | 
 | 367 | 	wpas_dbus_signal_wps_event_pbc_overlap(wpa_s); | 
| Roshan Pius | 1493275 | 2017-01-11 09:48:58 -0800 | [diff] [blame] | 368 |  | 
 | 369 | 	wpas_hidl_notify_wps_event_pbc_overlap(wpa_s); | 
| Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 370 | #endif /* CONFIG_WPS */ | 
 | 371 | } | 
 | 372 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 373 |  | 
 | 374 | void wpas_notify_network_added(struct wpa_supplicant *wpa_s, | 
 | 375 | 			       struct wpa_ssid *ssid) | 
 | 376 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 377 | 	if (wpa_s->p2p_mgmt) | 
 | 378 | 		return; | 
 | 379 |  | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 380 | 	/* | 
 | 381 | 	 * Networks objects created during any P2P activities should not be | 
 | 382 | 	 * exposed out. They might/will confuse certain non-P2P aware | 
 | 383 | 	 * applications since these network objects won't behave like | 
 | 384 | 	 * regular ones. | 
 | 385 | 	 */ | 
| Roshan Pius | d385445 | 2016-07-07 16:46:41 -0700 | [diff] [blame] | 386 | 	if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) { | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 387 | 		wpas_dbus_register_network(wpa_s, ssid); | 
| Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 388 | 		wpas_hidl_register_network(wpa_s, ssid); | 
| Roshan Pius | d385445 | 2016-07-07 16:46:41 -0700 | [diff] [blame] | 389 | 	} | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 390 | } | 
 | 391 |  | 
 | 392 |  | 
 | 393 | void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s, | 
 | 394 | 					struct wpa_ssid *ssid) | 
 | 395 | { | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 396 | #ifdef CONFIG_P2P | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 397 | 	wpas_dbus_register_persistent_group(wpa_s, ssid); | 
| Glen Kuhne | 30990d6 | 2017-04-19 14:16:48 -0700 | [diff] [blame] | 398 | 	wpas_hidl_register_network(wpa_s, ssid); | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 399 | #endif /* CONFIG_P2P */ | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 400 | } | 
 | 401 |  | 
 | 402 |  | 
 | 403 | void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s, | 
 | 404 | 					  struct wpa_ssid *ssid) | 
 | 405 | { | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 406 | #ifdef CONFIG_P2P | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 407 | 	wpas_dbus_unregister_persistent_group(wpa_s, ssid->id); | 
| Glen Kuhne | 30990d6 | 2017-04-19 14:16:48 -0700 | [diff] [blame] | 408 | 	wpas_hidl_unregister_network(wpa_s, ssid); | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 409 | #endif /* CONFIG_P2P */ | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 410 | } | 
 | 411 |  | 
 | 412 |  | 
 | 413 | void wpas_notify_network_removed(struct wpa_supplicant *wpa_s, | 
 | 414 | 				 struct wpa_ssid *ssid) | 
 | 415 | { | 
| Dmitry Shmidt | f21452a | 2014-02-26 10:55:25 -0800 | [diff] [blame] | 416 | 	if (wpa_s->next_ssid == ssid) | 
 | 417 | 		wpa_s->next_ssid = NULL; | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 418 | 	if (wpa_s->wpa) | 
 | 419 | 		wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid); | 
| Dmitry Shmidt | cc00d5d | 2015-05-04 10:34:12 -0700 | [diff] [blame] | 420 | 	if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s && | 
| Roshan Pius | d385445 | 2016-07-07 16:46:41 -0700 | [diff] [blame] | 421 | 	    !wpa_s->p2p_mgmt) { | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 422 | 		wpas_dbus_unregister_network(wpa_s, ssid->id); | 
| Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 423 | 		wpas_hidl_unregister_network(wpa_s, ssid); | 
| Roshan Pius | d385445 | 2016-07-07 16:46:41 -0700 | [diff] [blame] | 424 | 	} | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 425 | 	if (network_is_persistent_group(ssid)) | 
 | 426 | 		wpas_notify_persistent_group_removed(wpa_s, ssid); | 
 | 427 |  | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 428 | 	wpas_p2p_network_removed(wpa_s, ssid); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 429 | } | 
 | 430 |  | 
 | 431 |  | 
 | 432 | void wpas_notify_bss_added(struct wpa_supplicant *wpa_s, | 
 | 433 | 			   u8 bssid[], unsigned int id) | 
 | 434 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 435 | 	if (wpa_s->p2p_mgmt) | 
 | 436 | 		return; | 
 | 437 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 438 | 	wpas_dbus_register_bss(wpa_s, bssid, id); | 
 | 439 | 	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR, | 
 | 440 | 		     id, MAC2STR(bssid)); | 
 | 441 | } | 
 | 442 |  | 
 | 443 |  | 
 | 444 | void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s, | 
 | 445 | 			     u8 bssid[], unsigned int id) | 
 | 446 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 447 | 	if (wpa_s->p2p_mgmt) | 
 | 448 | 		return; | 
 | 449 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 450 | 	wpas_dbus_unregister_bss(wpa_s, bssid, id); | 
 | 451 | 	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR, | 
 | 452 | 		     id, MAC2STR(bssid)); | 
 | 453 | } | 
 | 454 |  | 
 | 455 |  | 
 | 456 | void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s, | 
 | 457 | 				  unsigned int id) | 
 | 458 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 459 | 	if (wpa_s->p2p_mgmt) | 
 | 460 | 		return; | 
 | 461 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 462 | 	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id); | 
 | 463 | } | 
 | 464 |  | 
 | 465 |  | 
 | 466 | void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s, | 
 | 467 | 				    unsigned int id) | 
 | 468 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 469 | 	if (wpa_s->p2p_mgmt) | 
 | 470 | 		return; | 
 | 471 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 472 | 	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL, | 
 | 473 | 					  id); | 
 | 474 | } | 
 | 475 |  | 
 | 476 |  | 
 | 477 | void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s, | 
 | 478 | 				     unsigned int id) | 
 | 479 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 480 | 	if (wpa_s->p2p_mgmt) | 
 | 481 | 		return; | 
 | 482 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 483 | 	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY, | 
 | 484 | 					  id); | 
 | 485 | } | 
 | 486 |  | 
 | 487 |  | 
 | 488 | void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s, | 
 | 489 | 				  unsigned int id) | 
 | 490 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 491 | 	if (wpa_s->p2p_mgmt) | 
 | 492 | 		return; | 
 | 493 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 494 | 	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id); | 
 | 495 | } | 
 | 496 |  | 
 | 497 |  | 
 | 498 | void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s, | 
 | 499 | 				   unsigned int id) | 
 | 500 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 501 | 	if (wpa_s->p2p_mgmt) | 
 | 502 | 		return; | 
 | 503 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 504 | 	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id); | 
 | 505 | } | 
 | 506 |  | 
 | 507 |  | 
 | 508 | void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s, | 
 | 509 | 				   unsigned int id) | 
 | 510 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 511 | 	if (wpa_s->p2p_mgmt) | 
 | 512 | 		return; | 
 | 513 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 514 | 	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id); | 
 | 515 | } | 
 | 516 |  | 
 | 517 |  | 
 | 518 | void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s, | 
 | 519 | 				 unsigned int id) | 
 | 520 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 521 | 	if (wpa_s->p2p_mgmt) | 
 | 522 | 		return; | 
 | 523 |  | 
| Dmitry Shmidt | d5e4923 | 2012-12-03 15:08:10 -0800 | [diff] [blame] | 524 | #ifdef CONFIG_WPS | 
 | 525 | 	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id); | 
 | 526 | #endif /* CONFIG_WPS */ | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 527 | } | 
 | 528 |  | 
 | 529 |  | 
 | 530 | void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s, | 
 | 531 | 				   unsigned int id) | 
 | 532 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 533 | 	if (wpa_s->p2p_mgmt) | 
 | 534 | 		return; | 
 | 535 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 536 | 	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id); | 
 | 537 | } | 
 | 538 |  | 
 | 539 |  | 
 | 540 | void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s, | 
 | 541 | 				   unsigned int id) | 
 | 542 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 543 | 	if (wpa_s->p2p_mgmt) | 
 | 544 | 		return; | 
 | 545 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 546 | 	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id); | 
 | 547 | } | 
 | 548 |  | 
 | 549 |  | 
| Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 550 | void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id) | 
 | 551 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 552 | 	if (wpa_s->p2p_mgmt) | 
 | 553 | 		return; | 
 | 554 |  | 
| Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 555 | 	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id); | 
 | 556 | } | 
 | 557 |  | 
 | 558 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 559 | void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name) | 
 | 560 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 561 | 	if (wpa_s->p2p_mgmt) | 
 | 562 | 		return; | 
 | 563 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 564 | 	wpas_dbus_signal_blob_added(wpa_s, name); | 
 | 565 | } | 
 | 566 |  | 
 | 567 |  | 
 | 568 | void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name) | 
 | 569 | { | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 570 | 	if (wpa_s->p2p_mgmt) | 
 | 571 | 		return; | 
 | 572 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 573 | 	wpas_dbus_signal_blob_removed(wpa_s, name); | 
 | 574 | } | 
 | 575 |  | 
 | 576 |  | 
 | 577 | void wpas_notify_debug_level_changed(struct wpa_global *global) | 
 | 578 | { | 
 | 579 | 	wpas_dbus_signal_debug_level_changed(global); | 
 | 580 | } | 
 | 581 |  | 
 | 582 |  | 
 | 583 | void wpas_notify_debug_timestamp_changed(struct wpa_global *global) | 
 | 584 | { | 
 | 585 | 	wpas_dbus_signal_debug_timestamp_changed(global); | 
 | 586 | } | 
 | 587 |  | 
 | 588 |  | 
 | 589 | void wpas_notify_debug_show_keys_changed(struct wpa_global *global) | 
 | 590 | { | 
 | 591 | 	wpas_dbus_signal_debug_show_keys_changed(global); | 
 | 592 | } | 
 | 593 |  | 
 | 594 |  | 
 | 595 | void wpas_notify_suspend(struct wpa_global *global) | 
 | 596 | { | 
 | 597 | 	struct wpa_supplicant *wpa_s; | 
 | 598 |  | 
 | 599 | 	os_get_time(&global->suspend_time); | 
 | 600 | 	wpa_printf(MSG_DEBUG, "System suspend notification"); | 
 | 601 | 	for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) | 
 | 602 | 		wpa_drv_suspend(wpa_s); | 
 | 603 | } | 
 | 604 |  | 
 | 605 |  | 
 | 606 | void wpas_notify_resume(struct wpa_global *global) | 
 | 607 | { | 
 | 608 | 	struct os_time now; | 
 | 609 | 	int slept; | 
 | 610 | 	struct wpa_supplicant *wpa_s; | 
 | 611 |  | 
 | 612 | 	if (global->suspend_time.sec == 0) | 
 | 613 | 		slept = -1; | 
 | 614 | 	else { | 
 | 615 | 		os_get_time(&now); | 
 | 616 | 		slept = now.sec - global->suspend_time.sec; | 
 | 617 | 	} | 
 | 618 | 	wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)", | 
 | 619 | 		   slept); | 
 | 620 |  | 
 | 621 | 	for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { | 
 | 622 | 		wpa_drv_resume(wpa_s); | 
 | 623 | 		if (wpa_s->wpa_state == WPA_DISCONNECTED) | 
 | 624 | 			wpa_supplicant_req_scan(wpa_s, 0, 100000); | 
 | 625 | 	} | 
 | 626 | } | 
 | 627 |  | 
 | 628 |  | 
 | 629 | #ifdef CONFIG_P2P | 
 | 630 |  | 
| Dmitry Shmidt | 8bd70b7 | 2015-05-26 16:02:19 -0700 | [diff] [blame] | 631 | void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s) | 
 | 632 | { | 
 | 633 | 	/* Notify P2P find has stopped */ | 
 | 634 | 	wpas_dbus_signal_p2p_find_stopped(wpa_s); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 635 |  | 
 | 636 | 	wpas_hidl_notify_p2p_find_stopped(wpa_s); | 
| Dmitry Shmidt | 8bd70b7 | 2015-05-26 16:02:19 -0700 | [diff] [blame] | 637 | } | 
 | 638 |  | 
 | 639 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 640 | void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s, | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 641 | 				  const u8 *addr, const struct p2p_peer_info *info, | 
 | 642 | 				  const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len, | 
 | 643 | 				  int new_device) | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 644 | { | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 645 | 	if (new_device) { | 
 | 646 | 		/* Create the new peer object */ | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 647 | 		wpas_dbus_register_peer(wpa_s, info->p2p_device_addr); | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 648 | 	} | 
 | 649 |  | 
 | 650 | 	/* Notify a new peer has been detected*/ | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 651 | 	wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr); | 
 | 652 |  | 
 | 653 | 	wpas_hidl_notify_p2p_device_found(wpa_s, addr, info, | 
 | 654 | 					  peer_wfd_device_info, | 
 | 655 | 					  peer_wfd_device_info_len); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 656 | } | 
 | 657 |  | 
 | 658 |  | 
 | 659 | void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s, | 
 | 660 | 				 const u8 *dev_addr) | 
 | 661 | { | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 662 | 	wpas_dbus_unregister_peer(wpa_s, dev_addr); | 
 | 663 |  | 
 | 664 | 	/* Create signal on interface object*/ | 
 | 665 | 	wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 666 |  | 
 | 667 | 	wpas_hidl_notify_p2p_device_lost(wpa_s, dev_addr); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 668 | } | 
 | 669 |  | 
 | 670 |  | 
 | 671 | void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s, | 
 | 672 | 				   const struct wpa_ssid *ssid, | 
 | 673 | 				   const char *role) | 
 | 674 | { | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 675 | 	wpas_dbus_signal_p2p_group_removed(wpa_s, role); | 
| Dmitry Shmidt | 0365883 | 2014-08-13 11:03:49 -0700 | [diff] [blame] | 676 |  | 
 | 677 | 	wpas_dbus_unregister_p2p_group(wpa_s, ssid); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 678 |  | 
 | 679 | 	wpas_hidl_notify_p2p_group_removed(wpa_s, ssid, role); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 680 | } | 
 | 681 |  | 
 | 682 |  | 
 | 683 | void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s, | 
| Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 684 | 				const u8 *src, u16 dev_passwd_id, u8 go_intent) | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 685 | { | 
| Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 686 | 	wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 687 |  | 
 | 688 | 	wpas_hidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 689 | } | 
 | 690 |  | 
 | 691 |  | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 692 | void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s, | 
 | 693 | 				      struct p2p_go_neg_results *res) | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 694 | { | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 695 | 	wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 696 |  | 
 | 697 | 	wpas_hidl_notify_p2p_go_neg_completed(wpa_s, res); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 698 | } | 
 | 699 |  | 
 | 700 |  | 
 | 701 | void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s, | 
 | 702 | 				       int status, const u8 *bssid) | 
 | 703 | { | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 704 | 	wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 705 |  | 
 | 706 | 	wpas_hidl_notify_p2p_invitation_result(wpa_s, status, bssid); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 707 | } | 
 | 708 |  | 
 | 709 |  | 
 | 710 | void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s, | 
 | 711 | 				int freq, const u8 *sa, u8 dialog_token, | 
 | 712 | 				u16 update_indic, const u8 *tlvs, | 
 | 713 | 				size_t tlvs_len) | 
 | 714 | { | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 715 | 	wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token, | 
 | 716 | 					update_indic, tlvs, tlvs_len); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 717 | } | 
 | 718 |  | 
 | 719 |  | 
 | 720 | void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s, | 
 | 721 | 				 const u8 *sa, u16 update_indic, | 
 | 722 | 				 const u8 *tlvs, size_t tlvs_len) | 
 | 723 | { | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 724 | 	wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic, | 
 | 725 | 					 tlvs, tlvs_len); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 726 |  | 
 | 727 | 	wpas_hidl_notify_p2p_sd_response(wpa_s, sa, update_indic, | 
 | 728 | 					 tlvs, tlvs_len); | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 729 | } | 
 | 730 |  | 
 | 731 |  | 
 | 732 | /** | 
 | 733 |  * wpas_notify_p2p_provision_discovery - Notification of provision discovery | 
 | 734 |  * @dev_addr: Who sent the request or responded to our request. | 
 | 735 |  * @request: Will be 1 if request, 0 for response. | 
 | 736 |  * @status: Valid only in case of response (0 in case of success) | 
 | 737 |  * @config_methods: WPS config methods | 
 | 738 |  * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method | 
 | 739 |  * | 
 | 740 |  * This can be used to notify: | 
 | 741 |  * - Requests or responses | 
 | 742 |  * - Various config methods | 
 | 743 |  * - Failure condition in case of response | 
 | 744 |  */ | 
 | 745 | void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s, | 
 | 746 | 					 const u8 *dev_addr, int request, | 
 | 747 | 					 enum p2p_prov_disc_status status, | 
 | 748 | 					 u16 config_methods, | 
 | 749 | 					 unsigned int generated_pin) | 
 | 750 | { | 
 | 751 | 	wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request, | 
 | 752 | 						 status, config_methods, | 
 | 753 | 						 generated_pin); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 754 |  | 
 | 755 | 	wpas_hidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request, | 
 | 756 | 						 status, config_methods, | 
 | 757 | 						 generated_pin); | 
 | 758 |  | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 759 | } | 
 | 760 |  | 
 | 761 |  | 
 | 762 | void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s, | 
| Dmitry Shmidt | d5ab1b5 | 2016-06-21 12:38:41 -0700 | [diff] [blame] | 763 | 				   struct wpa_ssid *ssid, int persistent, | 
| Dmitry Shmidt | abb90a3 | 2016-12-05 15:34:39 -0800 | [diff] [blame] | 764 | 				   int client, const u8 *ip) | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 765 | { | 
 | 766 | 	/* Notify a group has been started */ | 
 | 767 | 	wpas_dbus_register_p2p_group(wpa_s, ssid); | 
 | 768 |  | 
| Dmitry Shmidt | abb90a3 | 2016-12-05 15:34:39 -0800 | [diff] [blame] | 769 | 	wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 770 |  | 
| Roshan Pius | 7a1c848 | 2017-04-12 17:05:10 -0700 | [diff] [blame] | 771 | 	wpas_hidl_notify_p2p_group_started(wpa_s, ssid, persistent, client); | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 772 | } | 
 | 773 |  | 
 | 774 |  | 
| Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 775 | void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s, | 
 | 776 | 					     const char *reason) | 
 | 777 | { | 
 | 778 | 	/* Notify a group formation failed */ | 
 | 779 | 	wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 780 |  | 
 | 781 | 	wpas_hidl_notify_p2p_group_formation_failure(wpa_s, reason); | 
| Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 782 | } | 
 | 783 |  | 
 | 784 |  | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 785 | void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s, | 
 | 786 | 				struct wps_event_fail *fail) | 
 | 787 | { | 
 | 788 | 	wpas_dbus_signal_p2p_wps_failed(wpa_s, fail); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 789 | } | 
 | 790 |  | 
| Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 791 |  | 
 | 792 | void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s, | 
 | 793 | 					 const u8 *sa, const u8 *go_dev_addr, | 
 | 794 | 					 const u8 *bssid, int id, int op_freq) | 
 | 795 | { | 
 | 796 | 	/* Notify a P2P Invitation Request */ | 
 | 797 | 	wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid, | 
 | 798 | 						 id, op_freq); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 799 |  | 
 | 800 | 	wpas_hidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid, | 
 | 801 | 						 id, op_freq); | 
| Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 802 | } | 
 | 803 |  | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 804 | #endif /* CONFIG_P2P */ | 
 | 805 |  | 
 | 806 |  | 
 | 807 | static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 808 | 					  const u8 *sta, | 
 | 809 | 					  const u8 *p2p_dev_addr) | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 810 | { | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 811 | #ifdef CONFIG_P2P | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 812 | 	wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr); | 
 | 813 |  | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 814 | 	/* | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 815 | 	 * Create 'peer-joined' signal on group object -- will also | 
 | 816 | 	 * check P2P itself. | 
 | 817 | 	 */ | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 818 | 	if (p2p_dev_addr) | 
 | 819 | 		wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr); | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 820 | #endif /* CONFIG_P2P */ | 
| Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 821 |  | 
| Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 822 | 	/* Register the station */ | 
 | 823 | 	wpas_dbus_register_sta(wpa_s, sta); | 
 | 824 |  | 
| Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 825 | 	/* Notify listeners a new station has been authorized */ | 
 | 826 | 	wpas_dbus_signal_sta_authorized(wpa_s, sta); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 827 |  | 
 | 828 | 	wpas_hidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 829 | } | 
 | 830 |  | 
 | 831 |  | 
 | 832 | static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s, | 
| Dmitry Shmidt | d30ac60 | 2014-06-30 09:54:22 -0700 | [diff] [blame] | 833 | 					    const u8 *sta, | 
 | 834 | 					    const u8 *p2p_dev_addr) | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 835 | { | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 836 | #ifdef CONFIG_P2P | 
 | 837 | 	/* | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 838 | 	 * Create 'peer-disconnected' signal on group object if this | 
 | 839 | 	 * is a P2P group. | 
 | 840 | 	 */ | 
| Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 841 | 	if (p2p_dev_addr) | 
 | 842 | 		wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr); | 
| Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 843 | #endif /* CONFIG_P2P */ | 
| Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 844 |  | 
 | 845 | 	/* Notify listeners a station has been deauthorized */ | 
 | 846 | 	wpas_dbus_signal_sta_deauthorized(wpa_s, sta); | 
| Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 847 |  | 
| lesl | 4b7058c | 2019-02-27 18:45:19 +0800 | [diff] [blame] | 848 |         wpas_hidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr); | 
| Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 849 | 	/* Unregister the station */ | 
 | 850 | 	wpas_dbus_unregister_sta(wpa_s, sta); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 851 | } | 
 | 852 |  | 
 | 853 |  | 
 | 854 | void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s, | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 855 | 				const u8 *mac_addr, int authorized, | 
 | 856 | 				const u8 *p2p_dev_addr) | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 857 | { | 
 | 858 | 	if (authorized) | 
| Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 859 | 		wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 860 | 	else | 
| Dmitry Shmidt | d30ac60 | 2014-06-30 09:54:22 -0700 | [diff] [blame] | 861 | 		wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr); | 
| Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 862 | } | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 863 |  | 
 | 864 |  | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 865 | void wpas_notify_certification(struct wpa_supplicant *wpa_s, | 
 | 866 | 			       struct tls_cert_data *cert, | 
 | 867 | 			       const char *cert_hash) | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 868 | { | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 869 | 	int i; | 
| Hai Shalom | 878cf7b | 2019-07-15 14:55:18 -0700 | [diff] [blame] | 870 |  | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 871 | 	wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT | 
| Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 872 | 		"depth=%d subject='%s'%s%s%s%s", | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 873 | 		cert->depth, cert->subject, cert_hash ? " hash=" : "", | 
 | 874 | 		cert_hash ? cert_hash : "", | 
| Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 875 | 		cert->tod == 2 ? " tod=2" : "", | 
 | 876 | 		cert->tod == 1 ? " tod=1" : ""); | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 877 |  | 
 | 878 | 	if (cert->cert) { | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 879 | 		char *cert_hex; | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 880 | 		size_t len = wpabuf_len(cert->cert) * 2 + 1; | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 881 | 		cert_hex = os_malloc(len); | 
 | 882 | 		if (cert_hex) { | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 883 | 			wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert), | 
 | 884 | 					 wpabuf_len(cert->cert)); | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 885 | 			wpa_msg_ctrl(wpa_s, MSG_INFO, | 
 | 886 | 				     WPA_EVENT_EAP_PEER_CERT | 
 | 887 | 				     "depth=%d subject='%s' cert=%s", | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 888 | 				     cert->depth, cert->subject, cert_hex); | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 889 | 			os_free(cert_hex); | 
 | 890 | 		} | 
 | 891 | 	} | 
 | 892 |  | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 893 | 	for (i = 0; i < cert->num_altsubject; i++) | 
 | 894 | 		wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT | 
 | 895 | 			"depth=%d %s", cert->depth, cert->altsubject[i]); | 
| Dmitry Shmidt | 2f74e36 | 2015-01-21 13:19:05 -0800 | [diff] [blame] | 896 |  | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 897 | 	/* notify the new DBus API */ | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 898 | 	wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject, | 
 | 899 | 				       cert->altsubject, cert->num_altsubject, | 
 | 900 | 				       cert_hash, cert->cert); | 
| Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 901 | } | 
| Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 902 |  | 
 | 903 |  | 
 | 904 | void wpas_notify_preq(struct wpa_supplicant *wpa_s, | 
 | 905 | 		      const u8 *addr, const u8 *dst, const u8 *bssid, | 
 | 906 | 		      const u8 *ie, size_t ie_len, u32 ssi_signal) | 
 | 907 | { | 
 | 908 | #ifdef CONFIG_AP | 
 | 909 | 	wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal); | 
 | 910 | #endif /* CONFIG_AP */ | 
 | 911 | } | 
 | 912 |  | 
 | 913 |  | 
 | 914 | void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status, | 
 | 915 | 			    const char *parameter) | 
 | 916 | { | 
 | 917 | 	wpas_dbus_signal_eap_status(wpa_s, status, parameter); | 
| Dmitry Shmidt | 8da800a | 2013-04-24 12:57:01 -0700 | [diff] [blame] | 918 | 	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS | 
 | 919 | 		     "status='%s' parameter='%s'", | 
 | 920 | 		     status, parameter); | 
| Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 921 | } | 
| Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 922 |  | 
| Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 923 |  | 
| Ahmed ElArabawy | 9c86a7f | 2018-03-15 09:00:10 -0700 | [diff] [blame] | 924 | void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code) | 
 | 925 | { | 
 | 926 | 	wpa_dbg(wpa_s, MSG_ERROR, | 
 | 927 | 		"EAP Error code = %d", error_code); | 
| Ahmed ElArabawy | 30eab62 | 2018-03-19 18:36:48 -0700 | [diff] [blame] | 928 | 	wpas_hidl_notify_eap_error(wpa_s, error_code); | 
| Ahmed ElArabawy | 9c86a7f | 2018-03-15 09:00:10 -0700 | [diff] [blame] | 929 | } | 
| Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 930 |  | 
| Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 931 |  | 
| Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 932 | void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s, | 
 | 933 | 					   struct wpa_ssid *ssid) | 
 | 934 | { | 
 | 935 | 	if (wpa_s->current_ssid != ssid) | 
 | 936 | 		return; | 
 | 937 |  | 
 | 938 | 	wpa_dbg(wpa_s, MSG_DEBUG, | 
 | 939 | 		"Network bssid config changed for the current network - within-ESS roaming %s", | 
 | 940 | 		ssid->bssid_set ? "disabled" : "enabled"); | 
 | 941 |  | 
 | 942 | 	wpa_drv_roaming(wpa_s, !ssid->bssid_set, | 
 | 943 | 			ssid->bssid_set ? ssid->bssid : NULL); | 
 | 944 | } | 
| Dmitry Shmidt | 7f65602 | 2015-02-25 14:36:37 -0800 | [diff] [blame] | 945 |  | 
 | 946 |  | 
 | 947 | void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s, | 
 | 948 | 				      struct wpa_ssid *ssid) | 
 | 949 | { | 
 | 950 | #ifdef CONFIG_P2P | 
 | 951 | 	if (ssid->disabled == 2) { | 
 | 952 | 		/* Changed from normal network profile to persistent group */ | 
 | 953 | 		ssid->disabled = 0; | 
 | 954 | 		wpas_dbus_unregister_network(wpa_s, ssid->id); | 
 | 955 | 		ssid->disabled = 2; | 
| Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 956 | 		ssid->p2p_persistent_group = 1; | 
| Dmitry Shmidt | 7f65602 | 2015-02-25 14:36:37 -0800 | [diff] [blame] | 957 | 		wpas_dbus_register_persistent_group(wpa_s, ssid); | 
 | 958 | 	} else { | 
 | 959 | 		/* Changed from persistent group to normal network profile */ | 
 | 960 | 		wpas_dbus_unregister_persistent_group(wpa_s, ssid->id); | 
| Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 961 | 		ssid->p2p_persistent_group = 0; | 
| Dmitry Shmidt | 7f65602 | 2015-02-25 14:36:37 -0800 | [diff] [blame] | 962 | 		wpas_dbus_register_network(wpa_s, ssid); | 
 | 963 | 	} | 
 | 964 | #endif /* CONFIG_P2P */ | 
 | 965 | } | 
| Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 966 |  | 
 | 967 | void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid, | 
 | 968 | 				 const char *result, | 
 | 969 | 				 const struct wpa_bss_anqp *anqp) | 
 | 970 | { | 
 | 971 | #ifdef CONFIG_INTERWORKING | 
 | 972 | 	if (!wpa_s || !bssid || !anqp) | 
 | 973 | 		return; | 
| Roshan Pius | 9322a34 | 2016-12-12 14:45:02 -0800 | [diff] [blame] | 974 |  | 
 | 975 | 	wpas_hidl_notify_anqp_query_done(wpa_s, bssid, result, anqp); | 
| Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 976 | #endif /* CONFIG_INTERWORKING */ | 
 | 977 | } | 
 | 978 |  | 
 | 979 | void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid, | 
 | 980 | 				      const char* file_name, const u8* image, | 
 | 981 | 				      u32 image_length) | 
 | 982 | { | 
 | 983 | #ifdef CONFIG_HS20 | 
 | 984 | 	if (!wpa_s || !bssid || !file_name || !image) | 
 | 985 | 		return; | 
| Roshan Pius | 9322a34 | 2016-12-12 14:45:02 -0800 | [diff] [blame] | 986 |  | 
 | 987 | 	wpas_hidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image, | 
 | 988 | 					      image_length); | 
| Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 989 | #endif /* CONFIG_HS20 */ | 
 | 990 | } | 
 | 991 |  | 
 | 992 | void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s, | 
 | 993 | 						  const char* url, | 
 | 994 | 						  u8 osu_method) | 
 | 995 | { | 
 | 996 | #ifdef CONFIG_HS20 | 
 | 997 | 	if (!wpa_s || !url) | 
 | 998 | 		return; | 
| Roshan Pius | 9322a34 | 2016-12-12 14:45:02 -0800 | [diff] [blame] | 999 |  | 
 | 1000 | 	wpas_hidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method); | 
| Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 1001 | #endif /* CONFIG_HS20 */ | 
 | 1002 | } | 
 | 1003 |  | 
 | 1004 | void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s, | 
 | 1005 | 						u8 code, u16 reauth_delay, | 
 | 1006 | 						const char *url) | 
 | 1007 | { | 
 | 1008 | #ifdef CONFIG_HS20 | 
 | 1009 | 	if (!wpa_s || !url) | 
 | 1010 | 		return; | 
| Roshan Pius | 9322a34 | 2016-12-12 14:45:02 -0800 | [diff] [blame] | 1011 |  | 
 | 1012 | 	wpas_hidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay, | 
 | 1013 | 							url); | 
| Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 1014 | #endif /* CONFIG_HS20 */ | 
 | 1015 | } | 
| Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 1016 |  | 
 | 1017 |  | 
 | 1018 | #ifdef CONFIG_MESH | 
 | 1019 |  | 
 | 1020 | void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s, | 
 | 1021 | 				    struct wpa_ssid *ssid) | 
 | 1022 | { | 
 | 1023 | 	if (wpa_s->p2p_mgmt) | 
 | 1024 | 		return; | 
 | 1025 |  | 
 | 1026 | 	wpas_dbus_signal_mesh_group_started(wpa_s, ssid); | 
 | 1027 | } | 
 | 1028 |  | 
 | 1029 |  | 
 | 1030 | void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s, | 
 | 1031 | 				    const u8 *meshid, u8 meshid_len, | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1032 | 				    u16 reason_code) | 
| Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 1033 | { | 
 | 1034 | 	if (wpa_s->p2p_mgmt) | 
 | 1035 | 		return; | 
 | 1036 |  | 
 | 1037 | 	wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len, | 
 | 1038 | 					    reason_code); | 
 | 1039 | } | 
 | 1040 |  | 
 | 1041 |  | 
 | 1042 | void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s, | 
 | 1043 | 				     const u8 *peer_addr) | 
 | 1044 | { | 
 | 1045 | 	if (wpa_s->p2p_mgmt) | 
 | 1046 | 		return; | 
 | 1047 |  | 
 | 1048 | 	wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr); | 
 | 1049 | } | 
 | 1050 |  | 
 | 1051 |  | 
 | 1052 | void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s, | 
| Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1053 | 					const u8 *peer_addr, u16 reason_code) | 
| Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 1054 | { | 
 | 1055 | 	if (wpa_s->p2p_mgmt) | 
 | 1056 | 		return; | 
 | 1057 |  | 
 | 1058 | 	wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code); | 
 | 1059 | } | 
 | 1060 |  | 
 | 1061 | #endif /* CONFIG_MESH */ | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1062 |  | 
 | 1063 | /* | 
 | 1064 |  * DPP Notifications | 
 | 1065 |  */ | 
 | 1066 |  | 
 | 1067 | /* DPP Success notifications */ | 
 | 1068 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1069 | void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s, | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1070 | 	    struct wpa_ssid *ssid) | 
 | 1071 | { | 
 | 1072 | #ifdef CONFIG_DPP | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1073 | 	if (!wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1074 | 		return; | 
 | 1075 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1076 | 	wpas_hidl_notify_dpp_config_received(wpa_s, ssid); | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1077 | #endif /* CONFIG_DPP */ | 
 | 1078 | } | 
 | 1079 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1080 | void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1081 | { | 
 | 1082 | #ifdef CONFIG_DPP | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1083 | 	if (!wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1084 | 		return; | 
 | 1085 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1086 | 	wpas_hidl_notify_dpp_config_sent(wpa_s); | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1087 | #endif /* CONFIG_DPP */ | 
 | 1088 | } | 
 | 1089 |  | 
 | 1090 | /* DPP Progress notifications */ | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1091 | void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1092 | { | 
 | 1093 | #ifdef CONFIG_DPP | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1094 | 	if (!wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1095 | 		return; | 
 | 1096 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1097 | 	wpas_hidl_notify_dpp_auth_success(wpa_s); | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1098 | #endif /* CONFIG_DPP */ | 
 | 1099 | } | 
 | 1100 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1101 | void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1102 | { | 
 | 1103 | #ifdef CONFIG_DPP | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1104 | 	if (!wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1105 | 		return; | 
 | 1106 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1107 | 	wpas_hidl_notify_dpp_resp_pending(wpa_s); | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1108 | #endif /* CONFIG_DPP */ | 
 | 1109 | } | 
 | 1110 |  | 
 | 1111 | /* DPP Failure notifications */ | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1112 | void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1113 | { | 
 | 1114 | #ifdef CONFIG_DPP | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1115 | 	if (!wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1116 | 		return; | 
 | 1117 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1118 | 	wpas_hidl_notify_dpp_not_compatible(wpa_s); | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1119 | #endif /* CONFIG_DPP */ | 
 | 1120 | } | 
 | 1121 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1122 | void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1123 | { | 
 | 1124 | #ifdef CONFIG_DPP | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1125 | 	if (!wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1126 | 		return; | 
 | 1127 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1128 | 	wpas_hidl_notify_dpp_missing_auth(wpa_s); | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1129 | #endif /* CONFIG_DPP */ | 
 | 1130 | } | 
 | 1131 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1132 | void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1133 | { | 
 | 1134 | #ifdef CONFIG_DPP | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1135 | 	if (!wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1136 | 		return; | 
 | 1137 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1138 | 	wpas_hidl_notify_dpp_configuration_failure(wpa_s); | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1139 | #endif /* CONFIG_DPP */ | 
 | 1140 | } | 
 | 1141 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1142 | void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1143 | { | 
 | 1144 | #ifdef CONFIG_DPP | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1145 | 	if (!wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1146 | 		return; | 
 | 1147 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1148 | 	wpas_hidl_notify_dpp_timeout(wpa_s); | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1149 | #endif /* CONFIG_DPP */ | 
 | 1150 | } | 
 | 1151 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1152 | void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1153 | { | 
 | 1154 | #ifdef CONFIG_DPP | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1155 | 	if (!wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1156 | 		return; | 
 | 1157 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1158 | 	wpas_hidl_notify_dpp_auth_failure(wpa_s); | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1159 | #endif /* CONFIG_DPP */ | 
 | 1160 | } | 
 | 1161 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1162 | void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1163 | { | 
 | 1164 | #ifdef CONFIG_DPP | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1165 | 	if (!wpa_s) | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1166 | 		return; | 
 | 1167 |  | 
| Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1168 | 	wpas_hidl_notify_dpp_fail(wpa_s); | 
| Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1169 | #endif /* CONFIG_DPP */ | 
 | 1170 | } | 
| Jimmy Chen | 126b170 | 2019-08-28 17:59:33 +0800 | [diff] [blame] | 1171 |  | 
| Hai Shalom | 0676811 | 2019-12-04 15:49:43 -0800 | [diff] [blame] | 1172 | void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s) | 
 | 1173 | { | 
 | 1174 | #ifdef CONFIG_DPP2 | 
 | 1175 | 	wpas_hidl_notify_dpp_config_sent_wait_response(wpa_s); | 
 | 1176 | #endif /* CONFIG_DPP2 */ | 
 | 1177 | } | 
 | 1178 |  | 
 | 1179 | void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s) | 
 | 1180 | { | 
 | 1181 | #ifdef CONFIG_DPP2 | 
 | 1182 | 	wpas_hidl_notify_dpp_config_accepted(wpa_s); | 
 | 1183 | #endif /* CONFIG_DPP2 */ | 
 | 1184 | } | 
 | 1185 |  | 
 | 1186 | void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s, | 
 | 1187 | 		enum dpp_status_error status, const char *ssid, | 
 | 1188 | 		const char *channel_list, unsigned short band_list[], int size) | 
 | 1189 | { | 
 | 1190 | #ifdef CONFIG_DPP2 | 
 | 1191 | 	wpas_hidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size); | 
 | 1192 | #endif /* CONFIG_DPP2 */ | 
 | 1193 | } | 
 | 1194 |  | 
 | 1195 | void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s) | 
 | 1196 | { | 
 | 1197 | #ifdef CONFIG_DPP2 | 
 | 1198 | 	wpas_hidl_notify_dpp_config_rejected(wpa_s); | 
 | 1199 | #endif /* CONFIG_DPP2 */ | 
 | 1200 | } | 
 | 1201 |  | 
| Jimmy Chen | 126b170 | 2019-08-28 17:59:33 +0800 | [diff] [blame] | 1202 | void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s, | 
 | 1203 | 				 struct rsn_pmksa_cache_entry *entry) | 
 | 1204 | { | 
 | 1205 | 	if (!wpa_s) | 
 | 1206 | 		return; | 
 | 1207 |  | 
 | 1208 | 	wpas_hidl_notify_pmk_cache_added(wpa_s, entry); | 
 | 1209 | } |