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