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