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