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" |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 13 | #include "common/nan_de.h" |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 14 | #include "config.h" |
| 15 | #include "wpa_supplicant_i.h" |
| 16 | #include "wps_supplicant.h" |
| 17 | #include "dbus/dbus_common.h" |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 18 | #include "dbus/dbus_new.h" |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 19 | #include "rsn_supp/wpa.h" |
Sunil Ravi | 77d572f | 2023-01-17 23:58:31 +0000 | [diff] [blame] | 20 | #include "rsn_supp/pmksa_cache.h" |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 21 | #include "fst/fst.h" |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 22 | #include "crypto/tls.h" |
Hai Shalom | c1a2144 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 23 | #include "bss.h" |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 24 | #include "driver_i.h" |
| 25 | #include "scan.h" |
| 26 | #include "p2p_supplicant.h" |
| 27 | #include "sme.h" |
| 28 | #include "notify.h" |
Gabriel Biren | 3c401c5 | 2024-10-10 20:11:18 +0000 | [diff] [blame] | 29 | #include "aidl/vendor/aidl.h" |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 30 | |
Gabriel Biren | 8c60fc2 | 2024-10-23 23:33:06 +0000 | [diff] [blame] | 31 | #ifdef MAINLINE_SUPPLICANT |
| 32 | #include "aidl/mainline/service.h" |
| 33 | #endif |
| 34 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 35 | int wpas_notify_supplicant_initialized(struct wpa_global *global) |
| 36 | { |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 37 | #ifdef CONFIG_CTRL_IFACE_DBUS_NEW |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 38 | if (global->params.dbus_ctrl_interface) { |
| 39 | global->dbus = wpas_dbus_init(global); |
| 40 | if (global->dbus == NULL) |
| 41 | return -1; |
| 42 | } |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 43 | #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 44 | |
Gabriel Biren | 7a30e7f | 2023-06-02 20:11:28 +0000 | [diff] [blame] | 45 | #ifdef CONFIG_AIDL |
| 46 | // Initialize AIDL here if daemonize is disabled. |
| 47 | // Otherwise initialize it later. |
| 48 | if (!global->params.daemonize) { |
| 49 | global->aidl = wpas_aidl_init(global); |
| 50 | if (!global->aidl) |
| 51 | return -1; |
| 52 | } |
| 53 | #endif /* CONFIG_AIDL */ |
| 54 | |
Gabriel Biren | 8c60fc2 | 2024-10-23 23:33:06 +0000 | [diff] [blame] | 55 | #ifdef MAINLINE_SUPPLICANT |
| 56 | global->aidl = mainline_aidl_init(global); |
| 57 | if (!global->aidl) |
| 58 | return -1; |
| 59 | #endif /* MAINLINE_SUPPLICANT */ |
| 60 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | |
| 65 | void wpas_notify_supplicant_deinitialized(struct wpa_global *global) |
| 66 | { |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 67 | #ifdef CONFIG_CTRL_IFACE_DBUS_NEW |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 68 | if (global->dbus) |
| 69 | wpas_dbus_deinit(global->dbus); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 70 | #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 71 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 72 | #ifdef CONFIG_AIDL |
| 73 | if (global->aidl) |
| 74 | wpas_aidl_deinit(global->aidl); |
| 75 | #endif /* CONFIG_AIDL */ |
Gabriel Biren | 8c60fc2 | 2024-10-23 23:33:06 +0000 | [diff] [blame] | 76 | |
| 77 | #ifdef MAINLINE_SUPPLICANT |
| 78 | if (global->aidl) |
| 79 | mainline_aidl_deinit(global->aidl); |
| 80 | #endif /* MAINLINE_SUPPLICANT */ |
| 81 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | |
| 85 | int wpas_notify_iface_added(struct wpa_supplicant *wpa_s) |
| 86 | { |
Hai Shalom | c480995 | 2019-04-30 14:45:55 -0700 | [diff] [blame] | 87 | if (!wpa_s->p2p_mgmt) { |
| 88 | if (wpas_dbus_register_interface(wpa_s)) |
| 89 | return -1; |
| 90 | } |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 91 | |
Kiran Kumar Lokere | a9f98eb | 2023-03-17 13:01:12 -0700 | [diff] [blame] | 92 | #ifdef CONFIG_AIDL |
Gabriel Biren | 7a30e7f | 2023-06-02 20:11:28 +0000 | [diff] [blame] | 93 | /* |
| 94 | * AIDL initialization may not be complete here if daemonize is enabled. |
Kiran Kumar Lokere | a9f98eb | 2023-03-17 13:01:12 -0700 | [diff] [blame] | 95 | * Initialization is done after daemonizing in order to avoid |
| 96 | * issues with the file descriptor. |
| 97 | */ |
Gabriel Biren | 7a30e7f | 2023-06-02 20:11:28 +0000 | [diff] [blame] | 98 | if (!wpa_s->global->aidl) |
Kiran Kumar Lokere | a9f98eb | 2023-03-17 13:01:12 -0700 | [diff] [blame] | 99 | return 0; |
Gabriel Biren | 7a30e7f | 2023-06-02 20:11:28 +0000 | [diff] [blame] | 100 | /* AIDL interface wants to keep track of the P2P mgmt iface. */ |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 101 | if (wpas_aidl_register_interface(wpa_s)) |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 102 | return -1; |
Kiran Kumar Lokere | a9f98eb | 2023-03-17 13:01:12 -0700 | [diff] [blame] | 103 | #endif |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 104 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 105 | return 0; |
| 106 | } |
| 107 | |
| 108 | |
| 109 | void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s) |
| 110 | { |
Hai Shalom | c480995 | 2019-04-30 14:45:55 -0700 | [diff] [blame] | 111 | if (!wpa_s->p2p_mgmt) { |
| 112 | /* unregister interface in new DBus ctrl iface */ |
| 113 | wpas_dbus_unregister_interface(wpa_s); |
| 114 | } |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 115 | |
Gabriel Biren | 7a30e7f | 2023-06-02 20:11:28 +0000 | [diff] [blame] | 116 | /* AIDL interface wants to keep track of the P2P mgmt iface. */ |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 117 | wpas_aidl_unregister_interface(wpa_s); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | |
| 121 | void wpas_notify_state_changed(struct wpa_supplicant *wpa_s, |
| 122 | enum wpa_states new_state, |
| 123 | enum wpa_states old_state) |
| 124 | { |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 125 | struct wpa_ssid *ssid = wpa_s->current_ssid; |
| 126 | |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 127 | if (wpa_s->p2p_mgmt) |
| 128 | return; |
| 129 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 130 | /* notify the new DBus API */ |
| 131 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE); |
| 132 | |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 133 | #ifdef CONFIG_FST |
| 134 | if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) { |
| 135 | if (new_state == WPA_COMPLETED) |
| 136 | fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid); |
| 137 | else if (old_state >= WPA_ASSOCIATED && |
| 138 | new_state < WPA_ASSOCIATED) |
| 139 | fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid); |
| 140 | } |
| 141 | #endif /* CONFIG_FST */ |
| 142 | |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 143 | if (new_state == WPA_COMPLETED) { |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 144 | wpas_p2p_notif_connected(wpa_s); |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 145 | if (ssid) |
| 146 | wpa_drv_roaming(wpa_s, !ssid->bssid_set, |
| 147 | ssid->bssid_set ? ssid->bssid : NULL); |
| 148 | } else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED) { |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 149 | wpas_p2p_notif_disconnected(wpa_s); |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 150 | } |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 151 | |
| 152 | sme_state_changed(wpa_s); |
| 153 | |
| 154 | #ifdef ANDROID |
| 155 | wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE |
Irfan Sheriff | f20a443 | 2012-04-16 16:48:34 -0700 | [diff] [blame] | 156 | "id=%d state=%d BSSID=" MACSTR " SSID=%s", |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 157 | wpa_s->current_ssid ? wpa_s->current_ssid->id : -1, |
Irfan Sheriff | f20a443 | 2012-04-16 16:48:34 -0700 | [diff] [blame] | 158 | new_state, |
Irfan Sheriff | e78e767 | 2012-08-01 11:10:15 -0700 | [diff] [blame] | 159 | MAC2STR(wpa_s->bssid), |
andy2_kuo | 5b5fb02 | 2012-05-22 11:53:07 -0700 | [diff] [blame] | 160 | wpa_s->current_ssid && wpa_s->current_ssid->ssid ? |
| 161 | wpa_ssid_txt(wpa_s->current_ssid->ssid, |
Dmitry Shmidt | e0e48dc | 2013-11-18 12:00:06 -0800 | [diff] [blame] | 162 | wpa_s->current_ssid->ssid_len) : ""); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 163 | #endif /* ANDROID */ |
Roshan Pius | e8d0d16 | 2016-08-01 13:09:26 -0700 | [diff] [blame] | 164 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 165 | wpas_aidl_notify_state_changed(wpa_s); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 169 | void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s) |
| 170 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 171 | if (wpa_s->p2p_mgmt) |
| 172 | return; |
| 173 | |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 174 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON); |
Roshan Pius | 0974e96 | 2016-12-12 17:05:51 -0800 | [diff] [blame] | 175 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 176 | wpas_aidl_notify_disconnect_reason(wpa_s); |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | |
Veerendranath Jakkam | bc2fa49 | 2023-05-25 01:26:50 +0530 | [diff] [blame] | 180 | void wpas_notify_mlo_info_change_reason(struct wpa_supplicant *wpa_s, |
| 181 | enum mlo_info_change_reason reason) |
| 182 | { |
| 183 | if (wpa_s->p2p_mgmt) |
| 184 | return; |
| 185 | |
| 186 | wpas_aidl_notify_mlo_info_change_reason(wpa_s, reason); |
| 187 | } |
| 188 | |
| 189 | |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 190 | void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s) |
| 191 | { |
| 192 | if (wpa_s->p2p_mgmt) |
| 193 | return; |
| 194 | |
| 195 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_STATUS_CODE); |
| 196 | } |
| 197 | |
| 198 | |
Sunil Ravi | 972b204 | 2020-08-14 10:50:48 -0700 | [diff] [blame] | 199 | void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s, |
Sunil Ravi | e06118e | 2021-01-03 08:39:46 -0800 | [diff] [blame] | 200 | const u8 *bssid, u8 timed_out, |
| 201 | const u8 *assoc_resp_ie, size_t assoc_resp_ie_len) |
Dmitry Shmidt | 31a29cc | 2016-03-09 15:58:17 -0800 | [diff] [blame] | 202 | { |
| 203 | if (wpa_s->p2p_mgmt) |
| 204 | return; |
| 205 | |
| 206 | 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] | 207 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 208 | wpas_aidl_notify_assoc_reject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len); |
Dmitry Shmidt | 31a29cc | 2016-03-09 15:58:17 -0800 | [diff] [blame] | 209 | } |
| 210 | |
Roshan Pius | 38e9676 | 2017-01-23 14:52:00 -0800 | [diff] [blame] | 211 | void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) { |
| 212 | if (wpa_s->p2p_mgmt) |
| 213 | return; |
| 214 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 215 | wpas_aidl_notify_auth_timeout(wpa_s); |
Roshan Pius | 38e9676 | 2017-01-23 14:52:00 -0800 | [diff] [blame] | 216 | } |
Dmitry Shmidt | 31a29cc | 2016-03-09 15:58:17 -0800 | [diff] [blame] | 217 | |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 218 | void wpas_notify_roam_time(struct wpa_supplicant *wpa_s) |
| 219 | { |
| 220 | if (wpa_s->p2p_mgmt) |
| 221 | return; |
| 222 | |
| 223 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME); |
| 224 | } |
| 225 | |
| 226 | |
| 227 | void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s) |
| 228 | { |
| 229 | if (wpa_s->p2p_mgmt) |
| 230 | return; |
| 231 | |
| 232 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE); |
| 233 | } |
| 234 | |
| 235 | |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 236 | void wpas_notify_scan_in_progress_6ghz(struct wpa_supplicant *wpa_s) |
| 237 | { |
| 238 | if (wpa_s->p2p_mgmt) |
| 239 | return; |
| 240 | |
| 241 | wpas_dbus_signal_prop_changed(wpa_s, |
| 242 | WPAS_DBUS_PROP_SCAN_IN_PROGRESS_6GHZ); |
| 243 | } |
| 244 | |
| 245 | |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 246 | void wpas_notify_session_length(struct wpa_supplicant *wpa_s) |
| 247 | { |
| 248 | if (wpa_s->p2p_mgmt) |
| 249 | return; |
| 250 | |
| 251 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH); |
| 252 | } |
| 253 | |
| 254 | |
| 255 | void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s) |
| 256 | { |
| 257 | if (wpa_s->p2p_mgmt) |
| 258 | return; |
| 259 | |
| 260 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS); |
Sunil Ravi | 4018d71 | 2019-12-06 18:01:21 -0800 | [diff] [blame] | 261 | |
| 262 | #ifdef CONFIG_WNM |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 263 | wpas_aidl_notify_bss_tm_status(wpa_s); |
Sunil Ravi | 4018d71 | 2019-12-06 18:01:21 -0800 | [diff] [blame] | 264 | #endif |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 265 | } |
| 266 | |
| 267 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 268 | void wpas_notify_network_changed(struct wpa_supplicant *wpa_s) |
| 269 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 270 | if (wpa_s->p2p_mgmt) |
| 271 | return; |
| 272 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 273 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK); |
| 274 | } |
| 275 | |
| 276 | |
| 277 | void wpas_notify_ap_scan_changed(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 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN); |
| 283 | } |
| 284 | |
| 285 | |
| 286 | void wpas_notify_bssid_changed(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 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS); |
Roshan Pius | e746d6b | 2017-03-21 08:53:04 -0700 | [diff] [blame] | 292 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 293 | wpas_aidl_notify_bssid_changed(wpa_s); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | |
Sunil Ravi | 77d572f | 2023-01-17 23:58:31 +0000 | [diff] [blame] | 297 | void wpas_notify_mac_address_changed(struct wpa_supplicant *wpa_s) |
| 298 | { |
| 299 | if (wpa_s->p2p_mgmt) |
| 300 | return; |
| 301 | |
| 302 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_MAC_ADDRESS); |
| 303 | } |
| 304 | |
| 305 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 306 | void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s) |
| 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 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE); |
| 312 | } |
| 313 | |
| 314 | |
| 315 | void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s, |
| 316 | struct wpa_ssid *ssid) |
| 317 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 318 | if (wpa_s->p2p_mgmt) |
| 319 | return; |
| 320 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 321 | wpas_dbus_signal_network_enabled_changed(wpa_s, ssid); |
| 322 | } |
| 323 | |
| 324 | |
| 325 | void wpas_notify_network_selected(struct wpa_supplicant *wpa_s, |
| 326 | struct wpa_ssid *ssid) |
| 327 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 328 | if (wpa_s->p2p_mgmt) |
| 329 | return; |
| 330 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 331 | wpas_dbus_signal_network_selected(wpa_s, ssid->id); |
| 332 | } |
| 333 | |
| 334 | |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 335 | void wpas_notify_network_request(struct wpa_supplicant *wpa_s, |
| 336 | struct wpa_ssid *ssid, |
| 337 | enum wpa_ctrl_req_type rtype, |
| 338 | const char *default_txt) |
| 339 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 340 | if (wpa_s->p2p_mgmt) |
| 341 | return; |
| 342 | |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 343 | wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt); |
Roshan Pius | 65628ce | 2016-08-17 13:10:23 -0700 | [diff] [blame] | 344 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 345 | wpas_aidl_notify_network_request(wpa_s, ssid, rtype, default_txt); |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | |
Steven Liu | 850c2e0 | 2022-11-28 17:26:39 +0000 | [diff] [blame] | 349 | void wpas_notify_permanent_id_req_denied(struct wpa_supplicant *wpa_s) |
| 350 | { |
| 351 | wpas_aidl_notify_permanent_id_req_denied(wpa_s); |
| 352 | } |
| 353 | |
| 354 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 355 | void wpas_notify_scanning(struct wpa_supplicant *wpa_s) |
| 356 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 357 | if (wpa_s->p2p_mgmt) |
| 358 | return; |
| 359 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 360 | /* notify the new DBus API */ |
| 361 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING); |
| 362 | } |
| 363 | |
| 364 | |
| 365 | void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success) |
| 366 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 367 | if (wpa_s->p2p_mgmt) |
| 368 | return; |
| 369 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 370 | wpas_dbus_signal_scan_done(wpa_s, success); |
| 371 | } |
| 372 | |
| 373 | |
| 374 | void wpas_notify_scan_results(struct wpa_supplicant *wpa_s) |
| 375 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 376 | if (wpa_s->p2p_mgmt) |
| 377 | return; |
| 378 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 379 | wpas_wps_notify_scan_results(wpa_s); |
| 380 | } |
| 381 | |
| 382 | |
| 383 | void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s, |
| 384 | const struct wps_credential *cred) |
| 385 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 386 | if (wpa_s->p2p_mgmt) |
| 387 | return; |
| 388 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 389 | #ifdef CONFIG_WPS |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 390 | /* notify the new DBus API */ |
| 391 | wpas_dbus_signal_wps_cred(wpa_s, cred); |
| 392 | #endif /* CONFIG_WPS */ |
| 393 | } |
| 394 | |
| 395 | |
| 396 | void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s, |
| 397 | struct wps_event_m2d *m2d) |
| 398 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 399 | if (wpa_s->p2p_mgmt) |
| 400 | return; |
| 401 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 402 | #ifdef CONFIG_WPS |
| 403 | wpas_dbus_signal_wps_event_m2d(wpa_s, m2d); |
| 404 | #endif /* CONFIG_WPS */ |
| 405 | } |
| 406 | |
| 407 | |
| 408 | void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s, |
| 409 | struct wps_event_fail *fail) |
| 410 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 411 | if (wpa_s->p2p_mgmt) |
| 412 | return; |
| 413 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 414 | #ifdef CONFIG_WPS |
| 415 | wpas_dbus_signal_wps_event_fail(wpa_s, fail); |
Roshan Pius | 1493275 | 2017-01-11 09:48:58 -0800 | [diff] [blame] | 416 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 417 | wpas_aidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr, |
Roshan Pius | 1493275 | 2017-01-11 09:48:58 -0800 | [diff] [blame] | 418 | fail->config_error, |
| 419 | fail->error_indication); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 420 | #endif /* CONFIG_WPS */ |
| 421 | } |
| 422 | |
| 423 | |
| 424 | void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s) |
| 425 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 426 | if (wpa_s->p2p_mgmt) |
| 427 | return; |
| 428 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 429 | #ifdef CONFIG_WPS |
| 430 | wpas_dbus_signal_wps_event_success(wpa_s); |
Roshan Pius | 1493275 | 2017-01-11 09:48:58 -0800 | [diff] [blame] | 431 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 432 | wpas_aidl_notify_wps_event_success(wpa_s); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 433 | #endif /* CONFIG_WPS */ |
| 434 | } |
| 435 | |
Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 436 | void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s) |
| 437 | { |
| 438 | if (wpa_s->p2p_mgmt) |
| 439 | return; |
| 440 | |
| 441 | #ifdef CONFIG_WPS |
| 442 | wpas_dbus_signal_wps_event_pbc_overlap(wpa_s); |
Roshan Pius | 1493275 | 2017-01-11 09:48:58 -0800 | [diff] [blame] | 443 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 444 | wpas_aidl_notify_wps_event_pbc_overlap(wpa_s); |
Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 445 | #endif /* CONFIG_WPS */ |
| 446 | } |
| 447 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 448 | |
| 449 | void wpas_notify_network_added(struct wpa_supplicant *wpa_s, |
| 450 | struct wpa_ssid *ssid) |
| 451 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 452 | if (wpa_s->p2p_mgmt) |
| 453 | return; |
| 454 | |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 455 | /* |
| 456 | * Networks objects created during any P2P activities should not be |
| 457 | * exposed out. They might/will confuse certain non-P2P aware |
| 458 | * applications since these network objects won't behave like |
| 459 | * regular ones. |
| 460 | */ |
Roshan Pius | d385445 | 2016-07-07 16:46:41 -0700 | [diff] [blame] | 461 | if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 462 | wpas_dbus_register_network(wpa_s, ssid); |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 463 | wpas_aidl_register_network(wpa_s, ssid); |
Hai Shalom | c1a2144 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 464 | wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_ADDED "%d", |
| 465 | ssid->id); |
Roshan Pius | d385445 | 2016-07-07 16:46:41 -0700 | [diff] [blame] | 466 | } |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 467 | } |
| 468 | |
| 469 | |
| 470 | void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s, |
| 471 | struct wpa_ssid *ssid) |
| 472 | { |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 473 | #ifdef CONFIG_P2P |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 474 | wpas_dbus_register_persistent_group(wpa_s, ssid); |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 475 | wpas_aidl_register_network(wpa_s, ssid); |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 476 | #endif /* CONFIG_P2P */ |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | |
| 480 | void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s, |
| 481 | struct wpa_ssid *ssid) |
| 482 | { |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 483 | #ifdef CONFIG_P2P |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 484 | wpas_dbus_unregister_persistent_group(wpa_s, ssid->id); |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 485 | wpas_aidl_unregister_network(wpa_s, ssid); |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 486 | #endif /* CONFIG_P2P */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 487 | } |
| 488 | |
| 489 | |
| 490 | void wpas_notify_network_removed(struct wpa_supplicant *wpa_s, |
| 491 | struct wpa_ssid *ssid) |
| 492 | { |
Dmitry Shmidt | f21452a | 2014-02-26 10:55:25 -0800 | [diff] [blame] | 493 | if (wpa_s->next_ssid == ssid) |
| 494 | wpa_s->next_ssid = NULL; |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame] | 495 | if (wpa_s->last_ssid == ssid) |
| 496 | wpa_s->last_ssid = NULL; |
| 497 | if (wpa_s->current_ssid == ssid) |
| 498 | wpa_s->current_ssid = NULL; |
Sunil Ravi | 2a14cf1 | 2023-11-21 00:54:38 +0000 | [diff] [blame] | 499 | if (wpa_s->ml_connect_probe_ssid == ssid) { |
| 500 | wpa_s->ml_connect_probe_ssid = NULL; |
| 501 | wpa_s->ml_connect_probe_bss = NULL; |
| 502 | } |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 503 | if (wpa_s->connect_without_scan == ssid) |
| 504 | wpa_s->connect_without_scan = NULL; |
Sunil Ravi | 89eba10 | 2022-09-13 21:04:37 -0700 | [diff] [blame] | 505 | #if defined(CONFIG_SME) && defined(CONFIG_SAE) |
| 506 | if (wpa_s->sme.ext_auth_wpa_ssid == ssid) |
| 507 | wpa_s->sme.ext_auth_wpa_ssid = NULL; |
| 508 | #endif /* CONFIG_SME && CONFIG_SAE */ |
Vinayak Yadawad | 4222acc | 2023-12-15 17:39:27 +0530 | [diff] [blame] | 509 | if (wpa_s->wpa) { |
| 510 | if ((wpa_key_mgmt_sae(ssid->key_mgmt) && |
| 511 | (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_SAE_OFFLOAD_STA)) || |
| 512 | ((ssid->key_mgmt & WPA_KEY_MGMT_OWE) && |
| 513 | (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA))) { |
| 514 | /* For cases when PMK is generated at the driver */ |
| 515 | struct wpa_pmkid_params params; |
| 516 | |
| 517 | os_memset(¶ms, 0, sizeof(params)); |
| 518 | params.ssid = ssid->ssid; |
| 519 | params.ssid_len = ssid->ssid_len; |
| 520 | wpa_drv_remove_pmkid(wpa_s, ¶ms); |
| 521 | } |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 522 | wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid); |
Vinayak Yadawad | 4222acc | 2023-12-15 17:39:27 +0530 | [diff] [blame] | 523 | } |
Dmitry Shmidt | cc00d5d | 2015-05-04 10:34:12 -0700 | [diff] [blame] | 524 | if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s && |
Roshan Pius | d385445 | 2016-07-07 16:46:41 -0700 | [diff] [blame] | 525 | !wpa_s->p2p_mgmt) { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 526 | wpas_dbus_unregister_network(wpa_s, ssid->id); |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 527 | wpas_aidl_unregister_network(wpa_s, ssid); |
Hai Shalom | c1a2144 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 528 | wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d", |
| 529 | ssid->id); |
Roshan Pius | d385445 | 2016-07-07 16:46:41 -0700 | [diff] [blame] | 530 | } |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 531 | if (network_is_persistent_group(ssid)) |
| 532 | wpas_notify_persistent_group_removed(wpa_s, ssid); |
| 533 | |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 534 | wpas_p2p_network_removed(wpa_s, ssid); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 535 | } |
| 536 | |
| 537 | |
| 538 | void wpas_notify_bss_added(struct wpa_supplicant *wpa_s, |
| 539 | u8 bssid[], unsigned int id) |
| 540 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 541 | if (wpa_s->p2p_mgmt) |
| 542 | return; |
| 543 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 544 | wpas_dbus_register_bss(wpa_s, bssid, id); |
| 545 | wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR, |
| 546 | id, MAC2STR(bssid)); |
| 547 | } |
| 548 | |
| 549 | |
| 550 | void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s, |
| 551 | u8 bssid[], unsigned int id) |
| 552 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 553 | if (wpa_s->p2p_mgmt) |
| 554 | return; |
| 555 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 556 | wpas_dbus_unregister_bss(wpa_s, bssid, id); |
| 557 | wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR, |
| 558 | id, MAC2STR(bssid)); |
| 559 | } |
| 560 | |
| 561 | |
| 562 | void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s, |
| 563 | unsigned int id) |
| 564 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 565 | if (wpa_s->p2p_mgmt) |
| 566 | return; |
| 567 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 568 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id); |
| 569 | } |
| 570 | |
| 571 | |
| 572 | void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s, |
| 573 | unsigned int id) |
| 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_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL, |
| 579 | id); |
| 580 | } |
| 581 | |
| 582 | |
| 583 | void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s, |
| 584 | unsigned int id) |
| 585 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 586 | if (wpa_s->p2p_mgmt) |
| 587 | return; |
| 588 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 589 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY, |
| 590 | id); |
| 591 | } |
| 592 | |
| 593 | |
| 594 | void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s, |
| 595 | unsigned int id) |
| 596 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 597 | if (wpa_s->p2p_mgmt) |
| 598 | return; |
| 599 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 600 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id); |
| 601 | } |
| 602 | |
| 603 | |
| 604 | void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s, |
| 605 | unsigned int id) |
| 606 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 607 | if (wpa_s->p2p_mgmt) |
| 608 | return; |
| 609 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 610 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id); |
| 611 | } |
| 612 | |
| 613 | |
| 614 | void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s, |
| 615 | unsigned int id) |
| 616 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 617 | if (wpa_s->p2p_mgmt) |
| 618 | return; |
| 619 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 620 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id); |
| 621 | } |
| 622 | |
| 623 | |
| 624 | void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s, |
| 625 | unsigned int id) |
| 626 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 627 | if (wpa_s->p2p_mgmt) |
| 628 | return; |
| 629 | |
Dmitry Shmidt | d5e4923 | 2012-12-03 15:08:10 -0800 | [diff] [blame] | 630 | #ifdef CONFIG_WPS |
| 631 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id); |
| 632 | #endif /* CONFIG_WPS */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 633 | } |
| 634 | |
| 635 | |
| 636 | void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s, |
| 637 | unsigned int id) |
| 638 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 639 | if (wpa_s->p2p_mgmt) |
| 640 | return; |
| 641 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 642 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id); |
| 643 | } |
| 644 | |
| 645 | |
| 646 | void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s, |
| 647 | unsigned int id) |
| 648 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 649 | if (wpa_s->p2p_mgmt) |
| 650 | return; |
| 651 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 652 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id); |
| 653 | } |
| 654 | |
| 655 | |
Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 656 | void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id) |
| 657 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 658 | if (wpa_s->p2p_mgmt) |
| 659 | return; |
| 660 | |
Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 661 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id); |
| 662 | } |
| 663 | |
| 664 | |
Sunil Ravi | 99c035e | 2024-07-12 01:42:03 +0000 | [diff] [blame] | 665 | void wpas_notify_bss_anqp_changed(struct wpa_supplicant *wpa_s, unsigned int id) |
| 666 | { |
| 667 | if (wpa_s->p2p_mgmt) |
| 668 | return; |
| 669 | |
| 670 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_ANQP, id); |
| 671 | } |
| 672 | |
| 673 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 674 | void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name) |
| 675 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 676 | if (wpa_s->p2p_mgmt) |
| 677 | return; |
| 678 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 679 | wpas_dbus_signal_blob_added(wpa_s, name); |
| 680 | } |
| 681 | |
| 682 | |
| 683 | void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name) |
| 684 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 685 | if (wpa_s->p2p_mgmt) |
| 686 | return; |
| 687 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 688 | wpas_dbus_signal_blob_removed(wpa_s, name); |
| 689 | } |
| 690 | |
| 691 | |
| 692 | void wpas_notify_debug_level_changed(struct wpa_global *global) |
| 693 | { |
| 694 | wpas_dbus_signal_debug_level_changed(global); |
| 695 | } |
| 696 | |
| 697 | |
| 698 | void wpas_notify_debug_timestamp_changed(struct wpa_global *global) |
| 699 | { |
| 700 | wpas_dbus_signal_debug_timestamp_changed(global); |
| 701 | } |
| 702 | |
| 703 | |
| 704 | void wpas_notify_debug_show_keys_changed(struct wpa_global *global) |
| 705 | { |
| 706 | wpas_dbus_signal_debug_show_keys_changed(global); |
| 707 | } |
| 708 | |
| 709 | |
| 710 | void wpas_notify_suspend(struct wpa_global *global) |
| 711 | { |
| 712 | struct wpa_supplicant *wpa_s; |
| 713 | |
| 714 | os_get_time(&global->suspend_time); |
| 715 | wpa_printf(MSG_DEBUG, "System suspend notification"); |
| 716 | for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) |
| 717 | wpa_drv_suspend(wpa_s); |
| 718 | } |
| 719 | |
| 720 | |
| 721 | void wpas_notify_resume(struct wpa_global *global) |
| 722 | { |
| 723 | struct os_time now; |
| 724 | int slept; |
| 725 | struct wpa_supplicant *wpa_s; |
| 726 | |
| 727 | if (global->suspend_time.sec == 0) |
| 728 | slept = -1; |
| 729 | else { |
| 730 | os_get_time(&now); |
| 731 | slept = now.sec - global->suspend_time.sec; |
| 732 | } |
| 733 | wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)", |
| 734 | slept); |
| 735 | |
| 736 | for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { |
| 737 | wpa_drv_resume(wpa_s); |
| 738 | if (wpa_s->wpa_state == WPA_DISCONNECTED) |
| 739 | wpa_supplicant_req_scan(wpa_s, 0, 100000); |
| 740 | } |
| 741 | } |
| 742 | |
| 743 | |
| 744 | #ifdef CONFIG_P2P |
| 745 | |
Dmitry Shmidt | 8bd70b7 | 2015-05-26 16:02:19 -0700 | [diff] [blame] | 746 | void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s) |
| 747 | { |
| 748 | /* Notify P2P find has stopped */ |
| 749 | wpas_dbus_signal_p2p_find_stopped(wpa_s); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 750 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 751 | wpas_aidl_notify_p2p_find_stopped(wpa_s); |
Dmitry Shmidt | 8bd70b7 | 2015-05-26 16:02:19 -0700 | [diff] [blame] | 752 | } |
| 753 | |
| 754 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 755 | void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s, |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 756 | const u8 *addr, const struct p2p_peer_info *info, |
| 757 | const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len, |
Jimmy Chen | 0133fc1 | 2021-03-04 13:56:11 +0800 | [diff] [blame] | 758 | const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len, |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 759 | int new_device) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 760 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 761 | if (new_device) { |
| 762 | /* Create the new peer object */ |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 763 | wpas_dbus_register_peer(wpa_s, info->p2p_device_addr); |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 764 | } |
| 765 | |
| 766 | /* Notify a new peer has been detected*/ |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 767 | wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr); |
| 768 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 769 | wpas_aidl_notify_p2p_device_found(wpa_s, addr, info, |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 770 | peer_wfd_device_info, |
Jimmy Chen | 57e19f5 | 2021-03-04 14:19:52 +0800 | [diff] [blame] | 771 | peer_wfd_device_info_len, |
| 772 | peer_wfd_r2_device_info, |
| 773 | peer_wfd_r2_device_info_len); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 774 | } |
| 775 | |
| 776 | |
| 777 | void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s, |
| 778 | const u8 *dev_addr) |
| 779 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 780 | wpas_dbus_unregister_peer(wpa_s, dev_addr); |
| 781 | |
| 782 | /* Create signal on interface object*/ |
| 783 | wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 784 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 785 | wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 786 | } |
| 787 | |
| 788 | |
| 789 | void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s, |
| 790 | const struct wpa_ssid *ssid, |
| 791 | const char *role) |
| 792 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 793 | wpas_dbus_signal_p2p_group_removed(wpa_s, role); |
Dmitry Shmidt | 0365883 | 2014-08-13 11:03:49 -0700 | [diff] [blame] | 794 | |
| 795 | wpas_dbus_unregister_p2p_group(wpa_s, ssid); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 796 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 797 | wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 798 | } |
| 799 | |
| 800 | |
| 801 | void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s, |
Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 802 | const u8 *src, u16 dev_passwd_id, u8 go_intent) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 803 | { |
Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 804 | 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] | 805 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 806 | wpas_aidl_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] | 807 | } |
| 808 | |
| 809 | |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 810 | void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s, |
| 811 | struct p2p_go_neg_results *res) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 812 | { |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 813 | wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 814 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 815 | wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 816 | } |
| 817 | |
| 818 | |
| 819 | void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s, |
| 820 | int status, const u8 *bssid) |
| 821 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 822 | wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 823 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 824 | wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 825 | } |
| 826 | |
| 827 | |
| 828 | void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s, |
| 829 | int freq, const u8 *sa, u8 dialog_token, |
| 830 | u16 update_indic, const u8 *tlvs, |
| 831 | size_t tlvs_len) |
| 832 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 833 | wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token, |
| 834 | update_indic, tlvs, tlvs_len); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 835 | } |
| 836 | |
| 837 | |
| 838 | void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s, |
| 839 | const u8 *sa, u16 update_indic, |
| 840 | const u8 *tlvs, size_t tlvs_len) |
| 841 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 842 | wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic, |
| 843 | tlvs, tlvs_len); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 844 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 845 | wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic, |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 846 | tlvs, tlvs_len); |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 847 | } |
| 848 | |
| 849 | |
| 850 | /** |
| 851 | * wpas_notify_p2p_provision_discovery - Notification of provision discovery |
| 852 | * @dev_addr: Who sent the request or responded to our request. |
| 853 | * @request: Will be 1 if request, 0 for response. |
| 854 | * @status: Valid only in case of response (0 in case of success) |
| 855 | * @config_methods: WPS config methods |
| 856 | * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method |
Sunil Ravi | 8bae425 | 2023-11-16 03:05:19 +0000 | [diff] [blame] | 857 | * @group_ifname: Group interface name of the group owner in case the provision |
| 858 | * discovery request is received with P2P Group ID attribute. |
| 859 | * i.e., valid only when the peer device is joining an |
| 860 | * operating P2P group. |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 861 | * |
| 862 | * This can be used to notify: |
| 863 | * - Requests or responses |
| 864 | * - Various config methods |
| 865 | * - Failure condition in case of response |
| 866 | */ |
| 867 | void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s, |
| 868 | const u8 *dev_addr, int request, |
| 869 | enum p2p_prov_disc_status status, |
| 870 | u16 config_methods, |
Sunil Ravi | 8bae425 | 2023-11-16 03:05:19 +0000 | [diff] [blame] | 871 | unsigned int generated_pin, |
| 872 | const char *group_ifname) |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 873 | { |
| 874 | wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request, |
| 875 | status, config_methods, |
| 876 | generated_pin); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 877 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 878 | wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request, |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 879 | status, config_methods, |
Sunil Ravi | 8bae425 | 2023-11-16 03:05:19 +0000 | [diff] [blame] | 880 | generated_pin, group_ifname); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 881 | |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 882 | } |
| 883 | |
| 884 | |
| 885 | void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s, |
Dmitry Shmidt | d5ab1b5 | 2016-06-21 12:38:41 -0700 | [diff] [blame] | 886 | struct wpa_ssid *ssid, int persistent, |
Dmitry Shmidt | abb90a3 | 2016-12-05 15:34:39 -0800 | [diff] [blame] | 887 | int client, const u8 *ip) |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 888 | { |
| 889 | /* Notify a group has been started */ |
| 890 | wpas_dbus_register_p2p_group(wpa_s, ssid); |
| 891 | |
Dmitry Shmidt | abb90a3 | 2016-12-05 15:34:39 -0800 | [diff] [blame] | 892 | wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 893 | |
Sunil Ravi | 68c25c2 | 2023-02-04 06:17:03 +0000 | [diff] [blame] | 894 | wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client, ip); |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 895 | } |
| 896 | |
| 897 | |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 898 | void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s, |
| 899 | const char *reason) |
| 900 | { |
| 901 | /* Notify a group formation failed */ |
| 902 | wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 903 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 904 | wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason); |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 905 | } |
| 906 | |
| 907 | |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 908 | void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s, |
| 909 | struct wps_event_fail *fail) |
| 910 | { |
| 911 | wpas_dbus_signal_p2p_wps_failed(wpa_s, fail); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 912 | } |
| 913 | |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 914 | |
| 915 | void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s, |
| 916 | const u8 *sa, const u8 *go_dev_addr, |
| 917 | const u8 *bssid, int id, int op_freq) |
| 918 | { |
| 919 | /* Notify a P2P Invitation Request */ |
| 920 | wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid, |
| 921 | id, op_freq); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 922 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 923 | wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid, |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 924 | id, op_freq); |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 925 | } |
| 926 | |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 927 | void wpas_notify_p2p_bootstrap_req(struct wpa_supplicant *wpa_s, |
| 928 | const u8 *src, u16 bootstrap_method) |
| 929 | { |
| 930 | wpas_dbus_signal_p2p_bootstrap_req(wpa_s, src, bootstrap_method); |
| 931 | } |
| 932 | |
| 933 | void wpas_notify_p2p_bootstrap_completed(struct wpa_supplicant *wpa_s, |
| 934 | const u8 *src, int status) |
| 935 | { |
| 936 | wpas_dbus_signal_p2p_bootstrap_completed(wpa_s, src, status); |
| 937 | } |
| 938 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 939 | #endif /* CONFIG_P2P */ |
| 940 | |
| 941 | |
| 942 | static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 943 | const u8 *sta, |
Sunil Ravi | d8128a2 | 2023-11-06 23:53:58 +0000 | [diff] [blame] | 944 | const u8 *p2p_dev_addr, const u8 *ip) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 945 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 946 | #ifdef CONFIG_P2P |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 947 | wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr); |
| 948 | |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 949 | /* |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 950 | * Create 'peer-joined' signal on group object -- will also |
| 951 | * check P2P itself. |
| 952 | */ |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 953 | if (p2p_dev_addr) |
| 954 | wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr); |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 955 | #endif /* CONFIG_P2P */ |
Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 956 | |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 957 | /* Register the station */ |
| 958 | wpas_dbus_register_sta(wpa_s, sta); |
| 959 | |
Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 960 | /* Notify listeners a new station has been authorized */ |
| 961 | wpas_dbus_signal_sta_authorized(wpa_s, sta); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 962 | |
Sunil Ravi | d8128a2 | 2023-11-06 23:53:58 +0000 | [diff] [blame] | 963 | wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr, ip); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 964 | } |
| 965 | |
| 966 | |
| 967 | static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s, |
Dmitry Shmidt | d30ac60 | 2014-06-30 09:54:22 -0700 | [diff] [blame] | 968 | const u8 *sta, |
| 969 | const u8 *p2p_dev_addr) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 970 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 971 | #ifdef CONFIG_P2P |
| 972 | /* |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 973 | * Create 'peer-disconnected' signal on group object if this |
| 974 | * is a P2P group. |
| 975 | */ |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 976 | if (p2p_dev_addr) |
| 977 | wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr); |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 978 | #endif /* CONFIG_P2P */ |
Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 979 | |
| 980 | /* Notify listeners a station has been deauthorized */ |
| 981 | wpas_dbus_signal_sta_deauthorized(wpa_s, sta); |
Roshan Pius | fd2fd66 | 2017-01-23 13:41:57 -0800 | [diff] [blame] | 982 | |
Sunil Ravi | d8128a2 | 2023-11-06 23:53:58 +0000 | [diff] [blame] | 983 | wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr); |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 984 | /* Unregister the station */ |
| 985 | wpas_dbus_unregister_sta(wpa_s, sta); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 986 | } |
| 987 | |
| 988 | |
| 989 | void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s, |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 990 | const u8 *mac_addr, int authorized, |
Sunil Ravi | d8128a2 | 2023-11-06 23:53:58 +0000 | [diff] [blame] | 991 | const u8 *p2p_dev_addr, const u8 *ip) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 992 | { |
| 993 | if (authorized) |
Sunil Ravi | 99c035e | 2024-07-12 01:42:03 +0000 | [diff] [blame] | 994 | wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr, |
| 995 | ip); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 996 | else |
Dmitry Shmidt | d30ac60 | 2014-06-30 09:54:22 -0700 | [diff] [blame] | 997 | wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 998 | } |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 999 | |
| 1000 | |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1001 | void wpas_notify_certification(struct wpa_supplicant *wpa_s, |
| 1002 | struct tls_cert_data *cert, |
| 1003 | const char *cert_hash) |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 1004 | { |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1005 | int i; |
Hai Shalom | 878cf7b | 2019-07-15 14:55:18 -0700 | [diff] [blame] | 1006 | |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1007 | wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 1008 | "depth=%d subject='%s'%s%s%s%s", |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1009 | cert->depth, cert->subject, cert_hash ? " hash=" : "", |
| 1010 | cert_hash ? cert_hash : "", |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 1011 | cert->tod == 2 ? " tod=2" : "", |
| 1012 | cert->tod == 1 ? " tod=1" : ""); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1013 | |
| 1014 | if (cert->cert) { |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 1015 | char *cert_hex; |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1016 | size_t len = wpabuf_len(cert->cert) * 2 + 1; |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 1017 | cert_hex = os_malloc(len); |
| 1018 | if (cert_hex) { |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1019 | wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert), |
| 1020 | wpabuf_len(cert->cert)); |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 1021 | wpa_msg_ctrl(wpa_s, MSG_INFO, |
| 1022 | WPA_EVENT_EAP_PEER_CERT |
| 1023 | "depth=%d subject='%s' cert=%s", |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1024 | cert->depth, cert->subject, cert_hex); |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 1025 | os_free(cert_hex); |
| 1026 | } |
| 1027 | } |
| 1028 | |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1029 | for (i = 0; i < cert->num_altsubject; i++) |
| 1030 | wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT |
| 1031 | "depth=%d %s", cert->depth, cert->altsubject[i]); |
Dmitry Shmidt | 2f74e36 | 2015-01-21 13:19:05 -0800 | [diff] [blame] | 1032 | |
Jimmy Chen | 429daf9 | 2021-10-20 13:27:23 +0800 | [diff] [blame] | 1033 | wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject, |
| 1034 | cert->altsubject, cert->num_altsubject, |
| 1035 | cert_hash, cert->cert); |
| 1036 | |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 1037 | /* notify the new DBus API */ |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1038 | wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject, |
| 1039 | cert->altsubject, cert->num_altsubject, |
| 1040 | cert_hash, cert->cert); |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 1041 | } |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 1042 | |
| 1043 | |
| 1044 | void wpas_notify_preq(struct wpa_supplicant *wpa_s, |
| 1045 | const u8 *addr, const u8 *dst, const u8 *bssid, |
| 1046 | const u8 *ie, size_t ie_len, u32 ssi_signal) |
| 1047 | { |
| 1048 | #ifdef CONFIG_AP |
| 1049 | wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal); |
| 1050 | #endif /* CONFIG_AP */ |
| 1051 | } |
| 1052 | |
| 1053 | |
| 1054 | void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status, |
| 1055 | const char *parameter) |
| 1056 | { |
| 1057 | wpas_dbus_signal_eap_status(wpa_s, status, parameter); |
Dmitry Shmidt | 8da800a | 2013-04-24 12:57:01 -0700 | [diff] [blame] | 1058 | wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS |
| 1059 | "status='%s' parameter='%s'", |
| 1060 | status, parameter); |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 1061 | } |
Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 1062 | |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 1063 | |
Ahmed ElArabawy | 9c86a7f | 2018-03-15 09:00:10 -0700 | [diff] [blame] | 1064 | void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code) |
| 1065 | { |
| 1066 | wpa_dbg(wpa_s, MSG_ERROR, |
| 1067 | "EAP Error code = %d", error_code); |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1068 | wpas_aidl_notify_eap_error(wpa_s, error_code); |
Ahmed ElArabawy | 9c86a7f | 2018-03-15 09:00:10 -0700 | [diff] [blame] | 1069 | } |
Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 1070 | |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 1071 | |
Sunil Ravi | 036cec5 | 2023-03-29 11:35:17 -0700 | [diff] [blame] | 1072 | void wpas_notify_psk_mismatch(struct wpa_supplicant *wpa_s) |
| 1073 | { |
| 1074 | wpas_dbus_signal_psk_mismatch(wpa_s); |
| 1075 | } |
| 1076 | |
| 1077 | |
Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 1078 | void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s, |
| 1079 | struct wpa_ssid *ssid) |
| 1080 | { |
| 1081 | if (wpa_s->current_ssid != ssid) |
| 1082 | return; |
| 1083 | |
| 1084 | wpa_dbg(wpa_s, MSG_DEBUG, |
| 1085 | "Network bssid config changed for the current network - within-ESS roaming %s", |
| 1086 | ssid->bssid_set ? "disabled" : "enabled"); |
| 1087 | |
| 1088 | wpa_drv_roaming(wpa_s, !ssid->bssid_set, |
| 1089 | ssid->bssid_set ? ssid->bssid : NULL); |
| 1090 | } |
Dmitry Shmidt | 7f65602 | 2015-02-25 14:36:37 -0800 | [diff] [blame] | 1091 | |
| 1092 | |
| 1093 | void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s, |
| 1094 | struct wpa_ssid *ssid) |
| 1095 | { |
| 1096 | #ifdef CONFIG_P2P |
| 1097 | if (ssid->disabled == 2) { |
| 1098 | /* Changed from normal network profile to persistent group */ |
| 1099 | ssid->disabled = 0; |
| 1100 | wpas_dbus_unregister_network(wpa_s, ssid->id); |
| 1101 | ssid->disabled = 2; |
Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 1102 | ssid->p2p_persistent_group = 1; |
Dmitry Shmidt | 7f65602 | 2015-02-25 14:36:37 -0800 | [diff] [blame] | 1103 | wpas_dbus_register_persistent_group(wpa_s, ssid); |
| 1104 | } else { |
| 1105 | /* Changed from persistent group to normal network profile */ |
| 1106 | wpas_dbus_unregister_persistent_group(wpa_s, ssid->id); |
Dmitry Shmidt | 7a53dbb | 2015-06-11 13:13:53 -0700 | [diff] [blame] | 1107 | ssid->p2p_persistent_group = 0; |
Dmitry Shmidt | 7f65602 | 2015-02-25 14:36:37 -0800 | [diff] [blame] | 1108 | wpas_dbus_register_network(wpa_s, ssid); |
| 1109 | } |
| 1110 | #endif /* CONFIG_P2P */ |
| 1111 | } |
Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 1112 | |
| 1113 | void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid, |
| 1114 | const char *result, |
| 1115 | const struct wpa_bss_anqp *anqp) |
| 1116 | { |
Sunil Ravi | 99c035e | 2024-07-12 01:42:03 +0000 | [diff] [blame] | 1117 | wpa_msg(wpa_s, MSG_INFO, ANQP_QUERY_DONE "addr=" MACSTR " result=%s", |
| 1118 | MAC2STR(bssid), result); |
Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 1119 | #ifdef CONFIG_INTERWORKING |
| 1120 | if (!wpa_s || !bssid || !anqp) |
| 1121 | return; |
Roshan Pius | 9322a34 | 2016-12-12 14:45:02 -0800 | [diff] [blame] | 1122 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1123 | wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp); |
Sunil Ravi | 99c035e | 2024-07-12 01:42:03 +0000 | [diff] [blame] | 1124 | wpas_dbus_signal_anqp_query_done(wpa_s, bssid, result); |
Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 1125 | #endif /* CONFIG_INTERWORKING */ |
| 1126 | } |
| 1127 | |
| 1128 | void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid, |
| 1129 | const char* file_name, const u8* image, |
| 1130 | u32 image_length) |
| 1131 | { |
| 1132 | #ifdef CONFIG_HS20 |
| 1133 | if (!wpa_s || !bssid || !file_name || !image) |
| 1134 | return; |
Roshan Pius | 9322a34 | 2016-12-12 14:45:02 -0800 | [diff] [blame] | 1135 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1136 | wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image, |
Roshan Pius | 9322a34 | 2016-12-12 14:45:02 -0800 | [diff] [blame] | 1137 | image_length); |
Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 1138 | #endif /* CONFIG_HS20 */ |
| 1139 | } |
| 1140 | |
| 1141 | void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s, |
| 1142 | const char* url, |
| 1143 | u8 osu_method) |
| 1144 | { |
| 1145 | #ifdef CONFIG_HS20 |
| 1146 | if (!wpa_s || !url) |
| 1147 | return; |
Roshan Pius | 9322a34 | 2016-12-12 14:45:02 -0800 | [diff] [blame] | 1148 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1149 | wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method); |
Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 1150 | #endif /* CONFIG_HS20 */ |
| 1151 | } |
| 1152 | |
| 1153 | void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s, |
| 1154 | u8 code, u16 reauth_delay, |
| 1155 | const char *url) |
| 1156 | { |
| 1157 | #ifdef CONFIG_HS20 |
Hai Shalom | b3a7c70 | 2020-10-20 12:22:53 -0700 | [diff] [blame] | 1158 | if (!wpa_s) |
Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 1159 | return; |
Roshan Pius | 9322a34 | 2016-12-12 14:45:02 -0800 | [diff] [blame] | 1160 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1161 | wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay, |
Hai Shalom | 04a4ca6 | 2020-10-28 19:04:47 -0700 | [diff] [blame] | 1162 | url); |
Roshan Pius | 04a9d74 | 2016-12-12 12:40:46 -0800 | [diff] [blame] | 1163 | #endif /* CONFIG_HS20 */ |
| 1164 | } |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 1165 | |
| 1166 | |
| 1167 | #ifdef CONFIG_MESH |
| 1168 | |
| 1169 | void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s, |
| 1170 | struct wpa_ssid *ssid) |
| 1171 | { |
| 1172 | if (wpa_s->p2p_mgmt) |
| 1173 | return; |
| 1174 | |
| 1175 | wpas_dbus_signal_mesh_group_started(wpa_s, ssid); |
| 1176 | } |
| 1177 | |
| 1178 | |
| 1179 | void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s, |
| 1180 | const u8 *meshid, u8 meshid_len, |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1181 | u16 reason_code) |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 1182 | { |
| 1183 | if (wpa_s->p2p_mgmt) |
| 1184 | return; |
| 1185 | |
| 1186 | wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len, |
| 1187 | reason_code); |
| 1188 | } |
| 1189 | |
| 1190 | |
| 1191 | void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s, |
| 1192 | const u8 *peer_addr) |
| 1193 | { |
| 1194 | if (wpa_s->p2p_mgmt) |
| 1195 | return; |
| 1196 | |
Sunil Ravi | 2a14cf1 | 2023-11-21 00:54:38 +0000 | [diff] [blame] | 1197 | wpa_msg(wpa_s, MSG_INFO, MESH_PEER_CONNECTED MACSTR, |
| 1198 | MAC2STR(peer_addr)); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 1199 | wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr); |
| 1200 | } |
| 1201 | |
| 1202 | |
| 1203 | void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s, |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 1204 | const u8 *peer_addr, u16 reason_code) |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 1205 | { |
| 1206 | if (wpa_s->p2p_mgmt) |
| 1207 | return; |
| 1208 | |
Sunil Ravi | 2a14cf1 | 2023-11-21 00:54:38 +0000 | [diff] [blame] | 1209 | wpa_msg(wpa_s, MSG_INFO, MESH_PEER_DISCONNECTED MACSTR, |
| 1210 | MAC2STR(peer_addr)); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 1211 | wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code); |
| 1212 | } |
| 1213 | |
| 1214 | #endif /* CONFIG_MESH */ |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1215 | |
| 1216 | /* |
| 1217 | * DPP Notifications |
| 1218 | */ |
| 1219 | |
| 1220 | /* DPP Success notifications */ |
| 1221 | |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1222 | void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s, |
Sunil Ravi | 546a7b5 | 2022-08-26 22:06:04 +0000 | [diff] [blame] | 1223 | struct wpa_ssid *ssid, bool conn_status_requested) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1224 | { |
| 1225 | #ifdef CONFIG_DPP |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1226 | if (!wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1227 | return; |
| 1228 | |
Sunil Ravi | 546a7b5 | 2022-08-26 22:06:04 +0000 | [diff] [blame] | 1229 | wpas_aidl_notify_dpp_config_received(wpa_s, ssid, conn_status_requested); |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1230 | #endif /* CONFIG_DPP */ |
| 1231 | } |
| 1232 | |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1233 | void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1234 | { |
| 1235 | #ifdef CONFIG_DPP |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1236 | if (!wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1237 | return; |
| 1238 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1239 | wpas_aidl_notify_dpp_config_sent(wpa_s); |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1240 | #endif /* CONFIG_DPP */ |
| 1241 | } |
| 1242 | |
Matthew Wang | 53c6632 | 2024-12-02 13:59:53 +0000 | [diff] [blame] | 1243 | #ifdef CONFIG_DPP |
Sunil Ravi | 546a7b5 | 2022-08-26 22:06:04 +0000 | [diff] [blame] | 1244 | void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s, |
| 1245 | enum dpp_status_error result) |
| 1246 | { |
| 1247 | #ifdef CONFIG_DPP2 |
| 1248 | if (!wpa_s) |
| 1249 | return; |
| 1250 | |
| 1251 | wpas_aidl_notify_dpp_connection_status_sent(wpa_s, result); |
| 1252 | #endif /* CONFIG_DPP2 */ |
| 1253 | } |
Matthew Wang | 53c6632 | 2024-12-02 13:59:53 +0000 | [diff] [blame] | 1254 | #endif /* CONFIG_DPP */ |
Sunil Ravi | 546a7b5 | 2022-08-26 22:06:04 +0000 | [diff] [blame] | 1255 | |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1256 | /* DPP Progress notifications */ |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1257 | void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1258 | { |
| 1259 | #ifdef CONFIG_DPP |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1260 | if (!wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1261 | return; |
| 1262 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1263 | wpas_aidl_notify_dpp_auth_success(wpa_s); |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1264 | #endif /* CONFIG_DPP */ |
| 1265 | } |
| 1266 | |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1267 | void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1268 | { |
| 1269 | #ifdef CONFIG_DPP |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1270 | if (!wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1271 | return; |
| 1272 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1273 | wpas_aidl_notify_dpp_resp_pending(wpa_s); |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1274 | #endif /* CONFIG_DPP */ |
| 1275 | } |
| 1276 | |
| 1277 | /* DPP Failure notifications */ |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1278 | void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1279 | { |
| 1280 | #ifdef CONFIG_DPP |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1281 | if (!wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1282 | return; |
| 1283 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1284 | wpas_aidl_notify_dpp_not_compatible(wpa_s); |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1285 | #endif /* CONFIG_DPP */ |
| 1286 | } |
| 1287 | |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1288 | void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1289 | { |
| 1290 | #ifdef CONFIG_DPP |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1291 | if (!wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1292 | return; |
| 1293 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1294 | wpas_aidl_notify_dpp_missing_auth(wpa_s); |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1295 | #endif /* CONFIG_DPP */ |
| 1296 | } |
| 1297 | |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1298 | void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1299 | { |
| 1300 | #ifdef CONFIG_DPP |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1301 | if (!wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1302 | return; |
| 1303 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1304 | wpas_aidl_notify_dpp_configuration_failure(wpa_s); |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1305 | #endif /* CONFIG_DPP */ |
| 1306 | } |
| 1307 | |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1308 | void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1309 | { |
| 1310 | #ifdef CONFIG_DPP |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1311 | if (!wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1312 | return; |
| 1313 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1314 | wpas_aidl_notify_dpp_timeout(wpa_s); |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1315 | #endif /* CONFIG_DPP */ |
| 1316 | } |
| 1317 | |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1318 | void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1319 | { |
| 1320 | #ifdef CONFIG_DPP |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1321 | if (!wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1322 | return; |
| 1323 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1324 | wpas_aidl_notify_dpp_auth_failure(wpa_s); |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1325 | #endif /* CONFIG_DPP */ |
| 1326 | } |
| 1327 | |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1328 | void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1329 | { |
| 1330 | #ifdef CONFIG_DPP |
Hai Shalom | 706f99b | 2019-01-08 16:23:37 -0800 | [diff] [blame] | 1331 | if (!wpa_s) |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1332 | return; |
| 1333 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1334 | wpas_aidl_notify_dpp_fail(wpa_s); |
Hai Shalom | 5953285 | 2018-12-07 10:32:58 -0800 | [diff] [blame] | 1335 | #endif /* CONFIG_DPP */ |
| 1336 | } |
Jimmy Chen | 126b170 | 2019-08-28 17:59:33 +0800 | [diff] [blame] | 1337 | |
Hai Shalom | 0676811 | 2019-12-04 15:49:43 -0800 | [diff] [blame] | 1338 | void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s) |
| 1339 | { |
| 1340 | #ifdef CONFIG_DPP2 |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1341 | wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s); |
Hai Shalom | 0676811 | 2019-12-04 15:49:43 -0800 | [diff] [blame] | 1342 | #endif /* CONFIG_DPP2 */ |
| 1343 | } |
| 1344 | |
| 1345 | void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s) |
| 1346 | { |
| 1347 | #ifdef CONFIG_DPP2 |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1348 | wpas_aidl_notify_dpp_config_accepted(wpa_s); |
Hai Shalom | 0676811 | 2019-12-04 15:49:43 -0800 | [diff] [blame] | 1349 | #endif /* CONFIG_DPP2 */ |
| 1350 | } |
| 1351 | |
Matthew Wang | 53c6632 | 2024-12-02 13:59:53 +0000 | [diff] [blame] | 1352 | #ifdef CONFIG_DPP |
Hai Shalom | 0676811 | 2019-12-04 15:49:43 -0800 | [diff] [blame] | 1353 | void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s, |
| 1354 | enum dpp_status_error status, const char *ssid, |
| 1355 | const char *channel_list, unsigned short band_list[], int size) |
| 1356 | { |
| 1357 | #ifdef CONFIG_DPP2 |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1358 | wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size); |
Hai Shalom | 0676811 | 2019-12-04 15:49:43 -0800 | [diff] [blame] | 1359 | #endif /* CONFIG_DPP2 */ |
| 1360 | } |
Matthew Wang | 53c6632 | 2024-12-02 13:59:53 +0000 | [diff] [blame] | 1361 | #endif /* CONFIG_DPP */ |
Hai Shalom | 0676811 | 2019-12-04 15:49:43 -0800 | [diff] [blame] | 1362 | |
| 1363 | void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s) |
| 1364 | { |
| 1365 | #ifdef CONFIG_DPP2 |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1366 | wpas_aidl_notify_dpp_config_rejected(wpa_s); |
Hai Shalom | 0676811 | 2019-12-04 15:49:43 -0800 | [diff] [blame] | 1367 | #endif /* CONFIG_DPP2 */ |
| 1368 | } |
| 1369 | |
Jimmy Chen | 126b170 | 2019-08-28 17:59:33 +0800 | [diff] [blame] | 1370 | void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s, |
| 1371 | struct rsn_pmksa_cache_entry *entry) |
| 1372 | { |
| 1373 | if (!wpa_s) |
| 1374 | return; |
| 1375 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1376 | wpas_aidl_notify_pmk_cache_added(wpa_s, entry); |
Jimmy Chen | 126b170 | 2019-08-28 17:59:33 +0800 | [diff] [blame] | 1377 | } |
Jimmy Chen | 39deead | 2020-10-14 23:47:20 +0800 | [diff] [blame] | 1378 | |
| 1379 | void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s, |
| 1380 | struct wpa_ssid *ssid, |
| 1381 | u8 bitmap) |
| 1382 | { |
| 1383 | if (!wpa_s) |
| 1384 | return; |
| 1385 | |
| 1386 | if (!ssid) |
| 1387 | return; |
| 1388 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1389 | wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap); |
Jimmy Chen | 39deead | 2020-10-14 23:47:20 +0800 | [diff] [blame] | 1390 | } |
Sunil Ravi | 07c1762 | 2021-01-11 12:00:53 -0800 | [diff] [blame] | 1391 | |
| 1392 | void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s) |
| 1393 | { |
| 1394 | if (!wpa_s) |
| 1395 | return; |
| 1396 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1397 | wpas_aidl_notify_network_not_found(wpa_s); |
Sunil Ravi | 07c1762 | 2021-01-11 12:00:53 -0800 | [diff] [blame] | 1398 | } |
Hai Shalom | c1a2144 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 1399 | |
| 1400 | #ifdef CONFIG_INTERWORKING |
| 1401 | |
| 1402 | void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s, |
| 1403 | struct wpa_bss *bss, |
| 1404 | struct wpa_cred *cred, int excluded, |
| 1405 | const char *type, int bh, int bss_load, |
| 1406 | int conn_capab) |
| 1407 | { |
| 1408 | wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d", |
| 1409 | excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP, |
| 1410 | MAC2STR(bss->bssid), type, |
| 1411 | bh ? " below_min_backhaul=1" : "", |
| 1412 | bss_load ? " over_max_bss_load=1" : "", |
| 1413 | conn_capab ? " conn_capab_missing=1" : "", |
| 1414 | cred->id, cred->priority, cred->sp_priority); |
| 1415 | |
| 1416 | wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded, |
| 1417 | bh, bss_load, conn_capab); |
| 1418 | } |
| 1419 | |
| 1420 | |
| 1421 | void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s) |
| 1422 | { |
| 1423 | wpas_dbus_signal_interworking_select_done(wpa_s); |
| 1424 | } |
| 1425 | |
Sunil Ravi | 99c035e | 2024-07-12 01:42:03 +0000 | [diff] [blame] | 1426 | |
Hai Shalom | c1a2144 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 1427 | #endif /* CONFIG_INTERWORKING */ |
| 1428 | |
Gabriel Biren | 3a2ec2c | 2022-03-07 17:59:41 +0000 | [diff] [blame] | 1429 | void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s, |
| 1430 | const char* reason_string) |
| 1431 | { |
| 1432 | wpas_aidl_notify_eap_method_selected(wpa_s, reason_string); |
| 1433 | } |
| 1434 | |
| 1435 | void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s, |
| 1436 | const char *reason_string) |
| 1437 | { |
| 1438 | wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string); |
| 1439 | } |
| 1440 | |
| 1441 | void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s, |
| 1442 | const char *reason_string) |
| 1443 | { |
| 1444 | wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string); |
| 1445 | } |
Shivani Baranwal | 84940f8 | 2022-02-02 10:21:47 +0530 | [diff] [blame] | 1446 | |
| 1447 | void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s) |
| 1448 | { |
| 1449 | if (!wpa_s) |
| 1450 | return; |
| 1451 | |
| 1452 | wpas_aidl_notify_qos_policy_reset(wpa_s); |
| 1453 | } |
| 1454 | |
| 1455 | void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s, |
| 1456 | struct dscp_policy_data *policies, int num_policies) |
| 1457 | { |
| 1458 | if (!wpa_s || !policies) |
| 1459 | return; |
| 1460 | |
| 1461 | wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies); |
| 1462 | } |
Sunil Ravi | 65a724b | 2022-05-24 11:06:09 -0700 | [diff] [blame] | 1463 | |
| 1464 | void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency) |
| 1465 | { |
| 1466 | if (!wpa_s) |
| 1467 | return; |
| 1468 | |
| 1469 | wpas_aidl_notify_frequency_changed(wpa_s, frequency); |
| 1470 | } |
Gabriel Biren | 9339823 | 2022-12-15 19:18:28 +0000 | [diff] [blame] | 1471 | |
| 1472 | ssize_t wpas_get_certificate(const char *alias, uint8_t** value) |
| 1473 | { |
Gabriel Biren | 980c48a | 2023-03-27 21:49:21 +0000 | [diff] [blame] | 1474 | wpa_printf(MSG_INFO, "wpas_get_certificate"); |
Gabriel Biren | 9339823 | 2022-12-15 19:18:28 +0000 | [diff] [blame] | 1475 | return wpas_aidl_get_certificate(alias, value); |
| 1476 | } |
Sunil Ravi | 77d572f | 2023-01-17 23:58:31 +0000 | [diff] [blame] | 1477 | |
Xinyue Ling | 1629ad8 | 2023-03-24 16:19:51 +0800 | [diff] [blame] | 1478 | ssize_t wpas_list_aliases(const char *prefix, char ***aliases) |
| 1479 | { |
| 1480 | return wpas_aidl_list_aliases(prefix, aliases); |
| 1481 | } |
Sunil Ravi | 77d572f | 2023-01-17 23:58:31 +0000 | [diff] [blame] | 1482 | |
| 1483 | void wpas_notify_signal_change(struct wpa_supplicant *wpa_s) |
| 1484 | { |
| 1485 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SIGNAL_CHANGE); |
| 1486 | } |
Swarn Singh | c450e7b | 2023-03-28 17:36:22 +0530 | [diff] [blame] | 1487 | |
| 1488 | void wpas_notify_qos_policy_scs_response(struct wpa_supplicant *wpa_s, |
| 1489 | unsigned int num_scs_resp, int **scs_resp) |
| 1490 | { |
| 1491 | if (!wpa_s || !num_scs_resp || !scs_resp) |
| 1492 | return; |
| 1493 | |
| 1494 | wpas_aidl_notify_qos_policy_scs_response(wpa_s, num_scs_resp, scs_resp); |
| 1495 | } |
Sunil Ravi | b0ac25f | 2024-07-12 01:42:03 +0000 | [diff] [blame] | 1496 | |
| 1497 | void wpas_notify_hs20_t_c_acceptance(struct wpa_supplicant *wpa_s, |
| 1498 | const char *url) |
| 1499 | { |
| 1500 | #ifdef CONFIG_HS20 |
| 1501 | if (!wpa_s || !url) |
| 1502 | return; |
| 1503 | |
| 1504 | wpa_msg(wpa_s, MSG_INFO, HS20_T_C_ACCEPTANCE "%s", url); |
| 1505 | wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url); |
| 1506 | wpas_dbus_signal_hs20_t_c_acceptance(wpa_s, url); |
| 1507 | #endif /* CONFIG_HS20 */ |
| 1508 | } |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 1509 | |
| 1510 | #ifdef CONFIG_NAN_USD |
| 1511 | |
| 1512 | void wpas_notify_nan_discovery_result(struct wpa_supplicant *wpa_s, |
| 1513 | enum nan_service_protocol_type |
| 1514 | srv_proto_type, |
| 1515 | int subscribe_id, int peer_publish_id, |
| 1516 | const u8 *peer_addr, |
| 1517 | bool fsd, bool fsd_gas, |
| 1518 | const u8 *ssi, size_t ssi_len) |
| 1519 | { |
| 1520 | char *ssi_hex; |
| 1521 | |
| 1522 | ssi_hex = os_zalloc(2 * ssi_len + 1); |
| 1523 | if (!ssi_hex) |
| 1524 | return; |
| 1525 | if (ssi) |
| 1526 | wpa_snprintf_hex(ssi_hex, 2 * ssi_len + 1, ssi, ssi_len); |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 1527 | wpa_msg_global(wpa_s, MSG_INFO, NAN_DISCOVERY_RESULT |
| 1528 | "subscribe_id=%d publish_id=%d address=" MACSTR |
| 1529 | " fsd=%d fsd_gas=%d srv_proto_type=%u ssi=%s", |
| 1530 | subscribe_id, peer_publish_id, MAC2STR(peer_addr), |
| 1531 | fsd, fsd_gas, srv_proto_type, ssi_hex); |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 1532 | os_free(ssi_hex); |
Gabriel Biren | 073f12b | 2024-12-12 01:05:58 +0000 | [diff] [blame] | 1533 | |
| 1534 | wpas_aidl_notify_usd_service_discovered(wpa_s, srv_proto_type, |
| 1535 | subscribe_id, peer_publish_id, peer_addr, fsd, ssi, ssi_len); |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 1536 | |
| 1537 | wpas_dbus_signal_nan_discovery_result(wpa_s, srv_proto_type, |
| 1538 | subscribe_id, peer_publish_id, |
| 1539 | peer_addr, fsd, fsd_gas, |
| 1540 | ssi, ssi_len); |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 1541 | } |
| 1542 | |
| 1543 | |
| 1544 | void wpas_notify_nan_replied(struct wpa_supplicant *wpa_s, |
| 1545 | enum nan_service_protocol_type srv_proto_type, |
| 1546 | int publish_id, int peer_subscribe_id, |
| 1547 | const u8 *peer_addr, |
| 1548 | const u8 *ssi, size_t ssi_len) |
| 1549 | { |
| 1550 | char *ssi_hex; |
| 1551 | |
| 1552 | ssi_hex = os_zalloc(2 * ssi_len + 1); |
| 1553 | if (!ssi_hex) |
| 1554 | return; |
| 1555 | if (ssi) |
| 1556 | wpa_snprintf_hex(ssi_hex, 2 * ssi_len + 1, ssi, ssi_len); |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 1557 | wpa_msg_global(wpa_s, MSG_INFO, NAN_REPLIED |
| 1558 | "publish_id=%d address=" MACSTR |
| 1559 | " subscribe_id=%d srv_proto_type=%u ssi=%s", |
| 1560 | publish_id, MAC2STR(peer_addr), peer_subscribe_id, |
| 1561 | srv_proto_type, ssi_hex); |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 1562 | os_free(ssi_hex); |
Gabriel Biren | 073f12b | 2024-12-12 01:05:58 +0000 | [diff] [blame] | 1563 | |
| 1564 | wpas_aidl_notify_usd_publish_replied(wpa_s, srv_proto_type, |
| 1565 | publish_id, peer_subscribe_id, peer_addr, ssi, ssi_len); |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 1566 | |
| 1567 | wpas_dbus_signal_nan_replied(wpa_s, srv_proto_type, publish_id, |
| 1568 | peer_subscribe_id, peer_addr, |
| 1569 | ssi, ssi_len); |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 1570 | } |
| 1571 | |
| 1572 | |
| 1573 | void wpas_notify_nan_receive(struct wpa_supplicant *wpa_s, int id, |
| 1574 | int peer_instance_id, const u8 *peer_addr, |
| 1575 | const u8 *ssi, size_t ssi_len) |
| 1576 | { |
| 1577 | char *ssi_hex; |
| 1578 | |
| 1579 | ssi_hex = os_zalloc(2 * ssi_len + 1); |
| 1580 | if (!ssi_hex) |
| 1581 | return; |
| 1582 | if (ssi) |
| 1583 | wpa_snprintf_hex(ssi_hex, 2 * ssi_len + 1, ssi, ssi_len); |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 1584 | wpa_msg_global(wpa_s, MSG_INFO, NAN_RECEIVE |
| 1585 | "id=%d peer_instance_id=%d address=" MACSTR " ssi=%s", |
| 1586 | id, peer_instance_id, MAC2STR(peer_addr), ssi_hex); |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 1587 | os_free(ssi_hex); |
Gabriel Biren | 073f12b | 2024-12-12 01:05:58 +0000 | [diff] [blame] | 1588 | |
| 1589 | wpas_aidl_notify_usd_message_received(wpa_s, id, peer_instance_id, |
| 1590 | peer_addr, ssi, ssi_len); |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 1591 | |
| 1592 | wpas_dbus_signal_nan_receive(wpa_s, id, peer_instance_id, peer_addr, |
| 1593 | ssi, ssi_len); |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 1594 | } |
| 1595 | |
| 1596 | |
| 1597 | static const char * nan_reason_txt(enum nan_de_reason reason) |
| 1598 | { |
| 1599 | switch (reason) { |
| 1600 | case NAN_DE_REASON_TIMEOUT: |
| 1601 | return "timeout"; |
| 1602 | case NAN_DE_REASON_USER_REQUEST: |
| 1603 | return "user-request"; |
| 1604 | case NAN_DE_REASON_FAILURE: |
| 1605 | return "failure"; |
| 1606 | } |
| 1607 | |
| 1608 | return "unknown"; |
| 1609 | } |
| 1610 | |
| 1611 | |
| 1612 | void wpas_notify_nan_publish_terminated(struct wpa_supplicant *wpa_s, |
| 1613 | int publish_id, |
| 1614 | enum nan_de_reason reason) |
| 1615 | { |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 1616 | wpa_msg_global(wpa_s, MSG_INFO, NAN_PUBLISH_TERMINATED |
| 1617 | "publish_id=%d reason=%s", |
| 1618 | publish_id, nan_reason_txt(reason)); |
| 1619 | |
Gabriel Biren | 073f12b | 2024-12-12 01:05:58 +0000 | [diff] [blame] | 1620 | wpas_aidl_notify_usd_publish_terminated(wpa_s, publish_id, reason); |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 1621 | |
| 1622 | wpas_dbus_signal_nan_publish_terminated(wpa_s, publish_id, |
| 1623 | nan_reason_txt(reason)); |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 1624 | } |
| 1625 | |
| 1626 | |
| 1627 | void wpas_notify_nan_subscribe_terminated(struct wpa_supplicant *wpa_s, |
| 1628 | int subscribe_id, |
| 1629 | enum nan_de_reason reason) |
| 1630 | { |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 1631 | wpa_msg_global(wpa_s, MSG_INFO, NAN_SUBSCRIBE_TERMINATED |
| 1632 | "subscribe_id=%d reason=%s", |
| 1633 | subscribe_id, nan_reason_txt(reason)); |
| 1634 | |
Gabriel Biren | 073f12b | 2024-12-12 01:05:58 +0000 | [diff] [blame] | 1635 | wpas_aidl_notify_usd_subscribe_terminated(wpa_s, subscribe_id, reason); |
Sunil Ravi | 79e6c4f | 2025-01-04 00:47:06 +0000 | [diff] [blame] | 1636 | |
| 1637 | wpas_dbus_signal_nan_subscribe_terminated(wpa_s, subscribe_id, |
| 1638 | nan_reason_txt(reason)); |
Sunil Ravi | c0f5d41 | 2024-09-11 22:12:49 +0000 | [diff] [blame] | 1639 | } |
| 1640 | |
| 1641 | #endif /* CONFIG_NAN_USD */ |