Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * wpa_supplicant - Event notifications |
| 3 | * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi> |
| 4 | * |
Dmitry Shmidt | c5ec7f5 | 2012-03-06 16:33:24 -0800 | [diff] [blame] | 5 | * This software may be distributed under the terms of the BSD license. |
| 6 | * See README for more details. |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include "utils/includes.h" |
| 10 | |
| 11 | #include "utils/common.h" |
| 12 | #include "common/wpa_ctrl.h" |
| 13 | #include "config.h" |
| 14 | #include "wpa_supplicant_i.h" |
| 15 | #include "wps_supplicant.h" |
| 16 | #include "dbus/dbus_common.h" |
| 17 | #include "dbus/dbus_old.h" |
| 18 | #include "dbus/dbus_new.h" |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 19 | #include "rsn_supp/wpa.h" |
Dmitry Shmidt | 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" |
| 25 | |
| 26 | int wpas_notify_supplicant_initialized(struct wpa_global *global) |
| 27 | { |
| 28 | #ifdef CONFIG_DBUS |
| 29 | if (global->params.dbus_ctrl_interface) { |
| 30 | global->dbus = wpas_dbus_init(global); |
| 31 | if (global->dbus == NULL) |
| 32 | return -1; |
| 33 | } |
| 34 | #endif /* CONFIG_DBUS */ |
| 35 | |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | |
| 40 | void wpas_notify_supplicant_deinitialized(struct wpa_global *global) |
| 41 | { |
| 42 | #ifdef CONFIG_DBUS |
| 43 | if (global->dbus) |
| 44 | wpas_dbus_deinit(global->dbus); |
| 45 | #endif /* CONFIG_DBUS */ |
| 46 | } |
| 47 | |
| 48 | |
| 49 | int wpas_notify_iface_added(struct wpa_supplicant *wpa_s) |
| 50 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 51 | if (wpa_s->p2p_mgmt) |
| 52 | return 0; |
| 53 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 54 | if (wpas_dbus_register_iface(wpa_s)) |
| 55 | return -1; |
| 56 | |
| 57 | if (wpas_dbus_register_interface(wpa_s)) |
| 58 | return -1; |
| 59 | |
| 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | |
| 64 | void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s) |
| 65 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 66 | if (wpa_s->p2p_mgmt) |
| 67 | return; |
| 68 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 69 | /* unregister interface in old DBus ctrl iface */ |
| 70 | wpas_dbus_unregister_iface(wpa_s); |
| 71 | |
| 72 | /* unregister interface in new DBus ctrl iface */ |
| 73 | wpas_dbus_unregister_interface(wpa_s); |
| 74 | } |
| 75 | |
| 76 | |
| 77 | void wpas_notify_state_changed(struct wpa_supplicant *wpa_s, |
| 78 | enum wpa_states new_state, |
| 79 | enum wpa_states old_state) |
| 80 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 81 | if (wpa_s->p2p_mgmt) |
| 82 | return; |
| 83 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 84 | /* notify the old DBus API */ |
| 85 | wpa_supplicant_dbus_notify_state_change(wpa_s, new_state, |
| 86 | old_state); |
| 87 | |
| 88 | /* notify the new DBus API */ |
| 89 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE); |
| 90 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 91 | if (new_state == WPA_COMPLETED) |
| 92 | wpas_p2p_notif_connected(wpa_s); |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 93 | else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 94 | wpas_p2p_notif_disconnected(wpa_s); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 95 | |
| 96 | sme_state_changed(wpa_s); |
| 97 | |
| 98 | #ifdef ANDROID |
| 99 | wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE |
Irfan Sheriff | f20a443 | 2012-04-16 16:48:34 -0700 | [diff] [blame] | 100 | "id=%d state=%d BSSID=" MACSTR " SSID=%s", |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 101 | wpa_s->current_ssid ? wpa_s->current_ssid->id : -1, |
Irfan Sheriff | f20a443 | 2012-04-16 16:48:34 -0700 | [diff] [blame] | 102 | new_state, |
Irfan Sheriff | e78e767 | 2012-08-01 11:10:15 -0700 | [diff] [blame] | 103 | MAC2STR(wpa_s->bssid), |
andy2_kuo | 5b5fb02 | 2012-05-22 11:53:07 -0700 | [diff] [blame] | 104 | wpa_s->current_ssid && wpa_s->current_ssid->ssid ? |
| 105 | wpa_ssid_txt(wpa_s->current_ssid->ssid, |
Dmitry Shmidt | e0e48dc | 2013-11-18 12:00:06 -0800 | [diff] [blame] | 106 | wpa_s->current_ssid->ssid_len) : ""); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 107 | #endif /* ANDROID */ |
| 108 | } |
| 109 | |
| 110 | |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 111 | void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s) |
| 112 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 113 | if (wpa_s->p2p_mgmt) |
| 114 | return; |
| 115 | |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 116 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON); |
| 117 | } |
| 118 | |
| 119 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 120 | void wpas_notify_network_changed(struct wpa_supplicant *wpa_s) |
| 121 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 122 | if (wpa_s->p2p_mgmt) |
| 123 | return; |
| 124 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 125 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK); |
| 126 | } |
| 127 | |
| 128 | |
| 129 | void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s) |
| 130 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 131 | if (wpa_s->p2p_mgmt) |
| 132 | return; |
| 133 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 134 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN); |
| 135 | } |
| 136 | |
| 137 | |
| 138 | void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s) |
| 139 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 140 | if (wpa_s->p2p_mgmt) |
| 141 | return; |
| 142 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 143 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS); |
| 144 | } |
| 145 | |
| 146 | |
| 147 | void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s) |
| 148 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 149 | if (wpa_s->p2p_mgmt) |
| 150 | return; |
| 151 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 152 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE); |
| 153 | } |
| 154 | |
| 155 | |
| 156 | void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s, |
| 157 | struct wpa_ssid *ssid) |
| 158 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 159 | if (wpa_s->p2p_mgmt) |
| 160 | return; |
| 161 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 162 | wpas_dbus_signal_network_enabled_changed(wpa_s, ssid); |
| 163 | } |
| 164 | |
| 165 | |
| 166 | void wpas_notify_network_selected(struct wpa_supplicant *wpa_s, |
| 167 | struct wpa_ssid *ssid) |
| 168 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 169 | if (wpa_s->p2p_mgmt) |
| 170 | return; |
| 171 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 172 | wpas_dbus_signal_network_selected(wpa_s, ssid->id); |
| 173 | } |
| 174 | |
| 175 | |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 176 | void wpas_notify_network_request(struct wpa_supplicant *wpa_s, |
| 177 | struct wpa_ssid *ssid, |
| 178 | enum wpa_ctrl_req_type rtype, |
| 179 | const char *default_txt) |
| 180 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 181 | if (wpa_s->p2p_mgmt) |
| 182 | return; |
| 183 | |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 184 | wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt); |
| 185 | } |
| 186 | |
| 187 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 188 | void wpas_notify_scanning(struct wpa_supplicant *wpa_s) |
| 189 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 190 | if (wpa_s->p2p_mgmt) |
| 191 | return; |
| 192 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 193 | /* notify the old DBus API */ |
| 194 | wpa_supplicant_dbus_notify_scanning(wpa_s); |
| 195 | |
| 196 | /* notify the new DBus API */ |
| 197 | wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING); |
| 198 | } |
| 199 | |
| 200 | |
| 201 | void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success) |
| 202 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 203 | if (wpa_s->p2p_mgmt) |
| 204 | return; |
| 205 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 206 | wpas_dbus_signal_scan_done(wpa_s, success); |
| 207 | } |
| 208 | |
| 209 | |
| 210 | void wpas_notify_scan_results(struct wpa_supplicant *wpa_s) |
| 211 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 212 | if (wpa_s->p2p_mgmt) |
| 213 | return; |
| 214 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 215 | /* notify the old DBus API */ |
| 216 | wpa_supplicant_dbus_notify_scan_results(wpa_s); |
| 217 | |
| 218 | wpas_wps_notify_scan_results(wpa_s); |
| 219 | } |
| 220 | |
| 221 | |
| 222 | void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s, |
| 223 | const struct wps_credential *cred) |
| 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 | #ifdef CONFIG_WPS |
| 229 | /* notify the old DBus API */ |
| 230 | wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred); |
| 231 | /* notify the new DBus API */ |
| 232 | wpas_dbus_signal_wps_cred(wpa_s, cred); |
| 233 | #endif /* CONFIG_WPS */ |
| 234 | } |
| 235 | |
| 236 | |
| 237 | void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s, |
| 238 | struct wps_event_m2d *m2d) |
| 239 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 240 | if (wpa_s->p2p_mgmt) |
| 241 | return; |
| 242 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 243 | #ifdef CONFIG_WPS |
| 244 | wpas_dbus_signal_wps_event_m2d(wpa_s, m2d); |
| 245 | #endif /* CONFIG_WPS */ |
| 246 | } |
| 247 | |
| 248 | |
| 249 | void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s, |
| 250 | struct wps_event_fail *fail) |
| 251 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 252 | if (wpa_s->p2p_mgmt) |
| 253 | return; |
| 254 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 255 | #ifdef CONFIG_WPS |
| 256 | wpas_dbus_signal_wps_event_fail(wpa_s, fail); |
| 257 | #endif /* CONFIG_WPS */ |
| 258 | } |
| 259 | |
| 260 | |
| 261 | void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s) |
| 262 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 263 | if (wpa_s->p2p_mgmt) |
| 264 | return; |
| 265 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 266 | #ifdef CONFIG_WPS |
| 267 | wpas_dbus_signal_wps_event_success(wpa_s); |
| 268 | #endif /* CONFIG_WPS */ |
| 269 | } |
| 270 | |
| 271 | |
| 272 | void wpas_notify_network_added(struct wpa_supplicant *wpa_s, |
| 273 | struct wpa_ssid *ssid) |
| 274 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 275 | if (wpa_s->p2p_mgmt) |
| 276 | return; |
| 277 | |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 278 | /* |
| 279 | * Networks objects created during any P2P activities should not be |
| 280 | * exposed out. They might/will confuse certain non-P2P aware |
| 281 | * applications since these network objects won't behave like |
| 282 | * regular ones. |
| 283 | */ |
Dmitry Shmidt | 391c59f | 2013-09-03 12:16:28 -0700 | [diff] [blame] | 284 | if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 285 | wpas_dbus_register_network(wpa_s, ssid); |
| 286 | } |
| 287 | |
| 288 | |
| 289 | void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s, |
| 290 | struct wpa_ssid *ssid) |
| 291 | { |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 292 | #ifdef CONFIG_P2P |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 293 | wpas_dbus_register_persistent_group(wpa_s, ssid); |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 294 | #endif /* CONFIG_P2P */ |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | |
| 298 | void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s, |
| 299 | struct wpa_ssid *ssid) |
| 300 | { |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 301 | #ifdef CONFIG_P2P |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 302 | wpas_dbus_unregister_persistent_group(wpa_s, ssid->id); |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 303 | #endif /* CONFIG_P2P */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | |
| 307 | void wpas_notify_network_removed(struct wpa_supplicant *wpa_s, |
| 308 | struct wpa_ssid *ssid) |
| 309 | { |
Dmitry Shmidt | f21452a | 2014-02-26 10:55:25 -0800 | [diff] [blame] | 310 | if (wpa_s->next_ssid == ssid) |
| 311 | wpa_s->next_ssid = NULL; |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 312 | if (wpa_s->wpa) |
| 313 | wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid); |
Dmitry Shmidt | cc00d5d | 2015-05-04 10:34:12 -0700 | [diff] [blame^] | 314 | if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s && |
| 315 | !wpa_s->p2p_mgmt) |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 316 | wpas_dbus_unregister_network(wpa_s, ssid->id); |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 317 | if (network_is_persistent_group(ssid)) |
| 318 | wpas_notify_persistent_group_removed(wpa_s, ssid); |
| 319 | |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 320 | wpas_p2p_network_removed(wpa_s, ssid); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | |
| 324 | void wpas_notify_bss_added(struct wpa_supplicant *wpa_s, |
| 325 | u8 bssid[], unsigned int id) |
| 326 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 327 | if (wpa_s->p2p_mgmt) |
| 328 | return; |
| 329 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 330 | wpas_dbus_register_bss(wpa_s, bssid, id); |
| 331 | wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR, |
| 332 | id, MAC2STR(bssid)); |
| 333 | } |
| 334 | |
| 335 | |
| 336 | void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s, |
| 337 | u8 bssid[], unsigned int id) |
| 338 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 339 | if (wpa_s->p2p_mgmt) |
| 340 | return; |
| 341 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 342 | wpas_dbus_unregister_bss(wpa_s, bssid, id); |
| 343 | wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR, |
| 344 | id, MAC2STR(bssid)); |
| 345 | } |
| 346 | |
| 347 | |
| 348 | void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s, |
| 349 | unsigned int id) |
| 350 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 351 | if (wpa_s->p2p_mgmt) |
| 352 | return; |
| 353 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 354 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id); |
| 355 | } |
| 356 | |
| 357 | |
| 358 | void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s, |
| 359 | unsigned int id) |
| 360 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 361 | if (wpa_s->p2p_mgmt) |
| 362 | return; |
| 363 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 364 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL, |
| 365 | id); |
| 366 | } |
| 367 | |
| 368 | |
| 369 | void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s, |
| 370 | unsigned int id) |
| 371 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 372 | if (wpa_s->p2p_mgmt) |
| 373 | return; |
| 374 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 375 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY, |
| 376 | id); |
| 377 | } |
| 378 | |
| 379 | |
| 380 | void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s, |
| 381 | unsigned int id) |
| 382 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 383 | if (wpa_s->p2p_mgmt) |
| 384 | return; |
| 385 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 386 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id); |
| 387 | } |
| 388 | |
| 389 | |
| 390 | void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s, |
| 391 | unsigned int id) |
| 392 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 393 | if (wpa_s->p2p_mgmt) |
| 394 | return; |
| 395 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 396 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id); |
| 397 | } |
| 398 | |
| 399 | |
| 400 | void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s, |
| 401 | unsigned int id) |
| 402 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 403 | if (wpa_s->p2p_mgmt) |
| 404 | return; |
| 405 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 406 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id); |
| 407 | } |
| 408 | |
| 409 | |
| 410 | void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s, |
| 411 | unsigned int id) |
| 412 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 413 | if (wpa_s->p2p_mgmt) |
| 414 | return; |
| 415 | |
Dmitry Shmidt | d5e4923 | 2012-12-03 15:08:10 -0800 | [diff] [blame] | 416 | #ifdef CONFIG_WPS |
| 417 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id); |
| 418 | #endif /* CONFIG_WPS */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | |
| 422 | void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s, |
| 423 | unsigned int id) |
| 424 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 425 | if (wpa_s->p2p_mgmt) |
| 426 | return; |
| 427 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 428 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id); |
| 429 | } |
| 430 | |
| 431 | |
| 432 | void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s, |
| 433 | unsigned int id) |
| 434 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 435 | if (wpa_s->p2p_mgmt) |
| 436 | return; |
| 437 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 438 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id); |
| 439 | } |
| 440 | |
| 441 | |
Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 442 | void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, 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 | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 447 | wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id); |
| 448 | } |
| 449 | |
| 450 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 451 | void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name) |
| 452 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 453 | if (wpa_s->p2p_mgmt) |
| 454 | return; |
| 455 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 456 | wpas_dbus_signal_blob_added(wpa_s, name); |
| 457 | } |
| 458 | |
| 459 | |
| 460 | void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name) |
| 461 | { |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 462 | if (wpa_s->p2p_mgmt) |
| 463 | return; |
| 464 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 465 | wpas_dbus_signal_blob_removed(wpa_s, name); |
| 466 | } |
| 467 | |
| 468 | |
| 469 | void wpas_notify_debug_level_changed(struct wpa_global *global) |
| 470 | { |
| 471 | wpas_dbus_signal_debug_level_changed(global); |
| 472 | } |
| 473 | |
| 474 | |
| 475 | void wpas_notify_debug_timestamp_changed(struct wpa_global *global) |
| 476 | { |
| 477 | wpas_dbus_signal_debug_timestamp_changed(global); |
| 478 | } |
| 479 | |
| 480 | |
| 481 | void wpas_notify_debug_show_keys_changed(struct wpa_global *global) |
| 482 | { |
| 483 | wpas_dbus_signal_debug_show_keys_changed(global); |
| 484 | } |
| 485 | |
| 486 | |
| 487 | void wpas_notify_suspend(struct wpa_global *global) |
| 488 | { |
| 489 | struct wpa_supplicant *wpa_s; |
| 490 | |
| 491 | os_get_time(&global->suspend_time); |
| 492 | wpa_printf(MSG_DEBUG, "System suspend notification"); |
| 493 | for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) |
| 494 | wpa_drv_suspend(wpa_s); |
| 495 | } |
| 496 | |
| 497 | |
| 498 | void wpas_notify_resume(struct wpa_global *global) |
| 499 | { |
| 500 | struct os_time now; |
| 501 | int slept; |
| 502 | struct wpa_supplicant *wpa_s; |
| 503 | |
| 504 | if (global->suspend_time.sec == 0) |
| 505 | slept = -1; |
| 506 | else { |
| 507 | os_get_time(&now); |
| 508 | slept = now.sec - global->suspend_time.sec; |
| 509 | } |
| 510 | wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)", |
| 511 | slept); |
| 512 | |
| 513 | for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { |
| 514 | wpa_drv_resume(wpa_s); |
| 515 | if (wpa_s->wpa_state == WPA_DISCONNECTED) |
| 516 | wpa_supplicant_req_scan(wpa_s, 0, 100000); |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | |
| 521 | #ifdef CONFIG_P2P |
| 522 | |
| 523 | void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s, |
| 524 | const u8 *dev_addr, int new_device) |
| 525 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 526 | if (new_device) { |
| 527 | /* Create the new peer object */ |
| 528 | wpas_dbus_register_peer(wpa_s, dev_addr); |
| 529 | } |
| 530 | |
| 531 | /* Notify a new peer has been detected*/ |
| 532 | wpas_dbus_signal_peer_device_found(wpa_s, dev_addr); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 533 | } |
| 534 | |
| 535 | |
| 536 | void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s, |
| 537 | const u8 *dev_addr) |
| 538 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 539 | wpas_dbus_unregister_peer(wpa_s, dev_addr); |
| 540 | |
| 541 | /* Create signal on interface object*/ |
| 542 | wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | |
| 546 | void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s, |
| 547 | const struct wpa_ssid *ssid, |
| 548 | const char *role) |
| 549 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 550 | wpas_dbus_signal_p2p_group_removed(wpa_s, role); |
Dmitry Shmidt | 0365883 | 2014-08-13 11:03:49 -0700 | [diff] [blame] | 551 | |
| 552 | wpas_dbus_unregister_p2p_group(wpa_s, ssid); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 553 | } |
| 554 | |
| 555 | |
| 556 | void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s, |
| 557 | const u8 *src, u16 dev_passwd_id) |
| 558 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 559 | wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 560 | } |
| 561 | |
| 562 | |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 563 | void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s, |
| 564 | struct p2p_go_neg_results *res) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 565 | { |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 566 | wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 567 | } |
| 568 | |
| 569 | |
| 570 | void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s, |
| 571 | int status, const u8 *bssid) |
| 572 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 573 | wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 574 | } |
| 575 | |
| 576 | |
| 577 | void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s, |
| 578 | int freq, const u8 *sa, u8 dialog_token, |
| 579 | u16 update_indic, const u8 *tlvs, |
| 580 | size_t tlvs_len) |
| 581 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 582 | wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token, |
| 583 | update_indic, tlvs, tlvs_len); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 584 | } |
| 585 | |
| 586 | |
| 587 | void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s, |
| 588 | const u8 *sa, u16 update_indic, |
| 589 | const u8 *tlvs, size_t tlvs_len) |
| 590 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 591 | wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic, |
| 592 | tlvs, tlvs_len); |
| 593 | } |
| 594 | |
| 595 | |
| 596 | /** |
| 597 | * wpas_notify_p2p_provision_discovery - Notification of provision discovery |
| 598 | * @dev_addr: Who sent the request or responded to our request. |
| 599 | * @request: Will be 1 if request, 0 for response. |
| 600 | * @status: Valid only in case of response (0 in case of success) |
| 601 | * @config_methods: WPS config methods |
| 602 | * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method |
| 603 | * |
| 604 | * This can be used to notify: |
| 605 | * - Requests or responses |
| 606 | * - Various config methods |
| 607 | * - Failure condition in case of response |
| 608 | */ |
| 609 | void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s, |
| 610 | const u8 *dev_addr, int request, |
| 611 | enum p2p_prov_disc_status status, |
| 612 | u16 config_methods, |
| 613 | unsigned int generated_pin) |
| 614 | { |
| 615 | wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request, |
| 616 | status, config_methods, |
| 617 | generated_pin); |
| 618 | } |
| 619 | |
| 620 | |
| 621 | void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s, |
| 622 | struct wpa_ssid *ssid, int network_id, |
| 623 | int client) |
| 624 | { |
| 625 | /* Notify a group has been started */ |
| 626 | wpas_dbus_register_p2p_group(wpa_s, ssid); |
| 627 | |
| 628 | wpas_dbus_signal_p2p_group_started(wpa_s, ssid, client, network_id); |
| 629 | } |
| 630 | |
| 631 | |
| 632 | void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s, |
| 633 | struct wps_event_fail *fail) |
| 634 | { |
| 635 | wpas_dbus_signal_p2p_wps_failed(wpa_s, fail); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 636 | } |
| 637 | |
| 638 | #endif /* CONFIG_P2P */ |
| 639 | |
| 640 | |
| 641 | static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 642 | const u8 *sta, |
| 643 | const u8 *p2p_dev_addr) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 644 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 645 | #ifdef CONFIG_P2P |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 646 | wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr); |
| 647 | |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 648 | /* |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 649 | * Create 'peer-joined' signal on group object -- will also |
| 650 | * check P2P itself. |
| 651 | */ |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 652 | if (p2p_dev_addr) |
| 653 | wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr); |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 654 | #endif /* CONFIG_P2P */ |
Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 655 | |
| 656 | /* Notify listeners a new station has been authorized */ |
| 657 | wpas_dbus_signal_sta_authorized(wpa_s, sta); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 658 | } |
| 659 | |
| 660 | |
| 661 | static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s, |
Dmitry Shmidt | d30ac60 | 2014-06-30 09:54:22 -0700 | [diff] [blame] | 662 | const u8 *sta, |
| 663 | const u8 *p2p_dev_addr) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 664 | { |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 665 | #ifdef CONFIG_P2P |
| 666 | /* |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 667 | * Create 'peer-disconnected' signal on group object if this |
| 668 | * is a P2P group. |
| 669 | */ |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 670 | if (p2p_dev_addr) |
| 671 | wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr); |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 672 | #endif /* CONFIG_P2P */ |
Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 673 | |
| 674 | /* Notify listeners a station has been deauthorized */ |
| 675 | wpas_dbus_signal_sta_deauthorized(wpa_s, sta); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 676 | } |
| 677 | |
| 678 | |
| 679 | void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s, |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 680 | const u8 *mac_addr, int authorized, |
| 681 | const u8 *p2p_dev_addr) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 682 | { |
| 683 | if (authorized) |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 684 | wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 685 | else |
Dmitry Shmidt | d30ac60 | 2014-06-30 09:54:22 -0700 | [diff] [blame] | 686 | wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 687 | } |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 688 | |
| 689 | |
| 690 | void wpas_notify_certification(struct wpa_supplicant *wpa_s, int depth, |
Dmitry Shmidt | 2f74e36 | 2015-01-21 13:19:05 -0800 | [diff] [blame] | 691 | const char *subject, const char *altsubject[], |
| 692 | int num_altsubject, const char *cert_hash, |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 693 | const struct wpabuf *cert) |
| 694 | { |
| 695 | wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT |
| 696 | "depth=%d subject='%s'%s%s", |
Dmitry Shmidt | 2f74e36 | 2015-01-21 13:19:05 -0800 | [diff] [blame] | 697 | depth, subject, cert_hash ? " hash=" : "", |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 698 | cert_hash ? cert_hash : ""); |
| 699 | |
| 700 | if (cert) { |
| 701 | char *cert_hex; |
| 702 | size_t len = wpabuf_len(cert) * 2 + 1; |
| 703 | cert_hex = os_malloc(len); |
| 704 | if (cert_hex) { |
| 705 | wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert), |
| 706 | wpabuf_len(cert)); |
| 707 | wpa_msg_ctrl(wpa_s, MSG_INFO, |
| 708 | WPA_EVENT_EAP_PEER_CERT |
| 709 | "depth=%d subject='%s' cert=%s", |
| 710 | depth, subject, cert_hex); |
| 711 | os_free(cert_hex); |
| 712 | } |
| 713 | } |
| 714 | |
Dmitry Shmidt | 2f74e36 | 2015-01-21 13:19:05 -0800 | [diff] [blame] | 715 | if (altsubject) { |
| 716 | int i; |
| 717 | |
| 718 | for (i = 0; i < num_altsubject; i++) |
| 719 | wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT |
| 720 | "depth=%d %s", depth, altsubject[i]); |
| 721 | } |
| 722 | |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 723 | /* notify the old DBus API */ |
| 724 | wpa_supplicant_dbus_notify_certification(wpa_s, depth, subject, |
| 725 | cert_hash, cert); |
| 726 | /* notify the new DBus API */ |
Dmitry Shmidt | 2f74e36 | 2015-01-21 13:19:05 -0800 | [diff] [blame] | 727 | wpas_dbus_signal_certification(wpa_s, depth, subject, altsubject, |
| 728 | num_altsubject, cert_hash, cert); |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 729 | } |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 730 | |
| 731 | |
| 732 | void wpas_notify_preq(struct wpa_supplicant *wpa_s, |
| 733 | const u8 *addr, const u8 *dst, const u8 *bssid, |
| 734 | const u8 *ie, size_t ie_len, u32 ssi_signal) |
| 735 | { |
| 736 | #ifdef CONFIG_AP |
| 737 | wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal); |
| 738 | #endif /* CONFIG_AP */ |
| 739 | } |
| 740 | |
| 741 | |
| 742 | void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status, |
| 743 | const char *parameter) |
| 744 | { |
| 745 | wpas_dbus_signal_eap_status(wpa_s, status, parameter); |
Dmitry Shmidt | 8da800a | 2013-04-24 12:57:01 -0700 | [diff] [blame] | 746 | wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS |
| 747 | "status='%s' parameter='%s'", |
| 748 | status, parameter); |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 749 | } |
Dmitry Shmidt | 661b4f7 | 2014-09-29 14:58:27 -0700 | [diff] [blame] | 750 | |
| 751 | |
| 752 | void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s, |
| 753 | struct wpa_ssid *ssid) |
| 754 | { |
| 755 | if (wpa_s->current_ssid != ssid) |
| 756 | return; |
| 757 | |
| 758 | wpa_dbg(wpa_s, MSG_DEBUG, |
| 759 | "Network bssid config changed for the current network - within-ESS roaming %s", |
| 760 | ssid->bssid_set ? "disabled" : "enabled"); |
| 761 | |
| 762 | wpa_drv_roaming(wpa_s, !ssid->bssid_set, |
| 763 | ssid->bssid_set ? ssid->bssid : NULL); |
| 764 | } |
Dmitry Shmidt | 7f65602 | 2015-02-25 14:36:37 -0800 | [diff] [blame] | 765 | |
| 766 | |
| 767 | void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s, |
| 768 | struct wpa_ssid *ssid) |
| 769 | { |
| 770 | #ifdef CONFIG_P2P |
| 771 | if (ssid->disabled == 2) { |
| 772 | /* Changed from normal network profile to persistent group */ |
| 773 | ssid->disabled = 0; |
| 774 | wpas_dbus_unregister_network(wpa_s, ssid->id); |
| 775 | ssid->disabled = 2; |
| 776 | wpas_dbus_register_persistent_group(wpa_s, ssid); |
| 777 | } else { |
| 778 | /* Changed from persistent group to normal network profile */ |
| 779 | wpas_dbus_unregister_persistent_group(wpa_s, ssid->id); |
| 780 | wpas_dbus_register_network(wpa_s, ssid); |
| 781 | } |
| 782 | #endif /* CONFIG_P2P */ |
| 783 | } |