MD5OBJS = ../src/crypto/md5.o
OBJS = config.o
+OBJS += notify.o
OBJS += ../src/utils/common.o
OBJS += ../src/utils/wpa_debug.o
OBJS += ../src/utils/wpabuf.o
#include "wps/wps.h"
#include "ibss_rsn.h"
#include "ap.h"
+#include "notify.h"
extern struct wpa_driver_ops *wpa_drivers[];
ssid = wpa_config_add_network(wpa_s->conf);
if (ssid == NULL)
return -1;
+
+ wpas_notify_network_added(wpa_s, ssid);
+
ssid->disabled = 1;
wpa_config_set_network_defaults(ssid);
wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_NETWORK all");
ssid = wpa_s->conf->ssid;
while (ssid) {
+ struct wpa_ssid *remove_ssid = ssid;
id = ssid->id;
ssid = ssid->next;
+ wpas_notify_network_removed(wpa_s, remove_ssid);
wpa_config_remove_network(wpa_s->conf, id);
}
if (wpa_s->current_ssid) {
#include "driver_i.h"
#include "ctrl_iface_dbus.h"
#include "ctrl_iface_dbus_handlers.h"
+#include "notify.h"
#include "eap_peer/eap_methods.h"
#include "dbus_dict_helpers.h"
#include "ieee802_11_defs.h"
"a network on this interface.");
goto out;
}
+ wpas_notify_network_added(wpa_s, ssid);
ssid->disabled = 1;
wpa_config_set_network_defaults(ssid);
goto out;
}
+ wpas_notify_network_removed(wpa_s, ssid);
+
if (wpa_config_remove_network(wpa_s->conf, id) < 0) {
reply = dbus_message_new_error(message,
WPAS_ERROR_REMOVE_NETWORK_ERROR,
}
/* Success */
- wpa_config_remove_blob(wpa_s->conf, blob->name);
+ if (!wpa_config_remove_blob(wpa_s->conf, blob->name))
+ wpas_notify_blob_removed(wpa_s, blob->name);
wpa_config_set_blob(wpa_s->conf, blob);
+ wpas_notify_blob_added(wpa_s, blob->name);
+
wpa_dbus_dict_entry_clear(&entry);
}
wpa_dbus_dict_entry_clear(&entry);
if (wpa_config_remove_blob(wpa_s->conf, name) != 0)
err_msg = "Error removing blob.";
+ else
+ wpas_notify_blob_removed(wpa_s, name);
dbus_message_iter_next(&array);
}
#include "pmksa_cache.h"
#include "wpa_ctrl.h"
#include "eap_peer/eap.h"
-#include "ctrl_iface_dbus.h"
+#include "notify.h"
#include "ieee802_11_defs.h"
#include "blacklist.h"
#include "wpas_glue.h"
static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
{
- struct wpa_ssid *ssid;
+ struct wpa_ssid *ssid, *old_ssid;
if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid)
return 0;
if (wpa_s->current_ssid && wpa_s->current_ssid != ssid)
eapol_sm_invalidate_cached_session(wpa_s->eapol);
+ old_ssid = wpa_s->current_ssid;
wpa_s->current_ssid = ssid;
wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
wpa_supplicant_initiate_eapol(wpa_s);
+ if (old_ssid != wpa_s->current_ssid)
+ wpas_notify_network_changed(wpa_s);
return 0;
}
void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
{
+ int bssid_changed;
+
wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+ bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
os_memset(wpa_s->bssid, 0, ETH_ALEN);
os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
+ if (bssid_changed)
+ wpas_notify_bssid_changed(wpa_s);
+
eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt))
"empty - not posting");
} else {
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
- wpa_supplicant_dbus_notify_scan_results(wpa_s);
- wpas_wps_notify_scan_results(wpa_s);
+ wpas_notify_scan_results(wpa_s);
}
+ wpas_notify_scan_done(wpa_s, 1);
+
if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s)) ||
wpa_s->disconnected)
return;
{
u8 bssid[ETH_ALEN];
int ft_completed = wpa_ft_is_completed(wpa_s->wpa);
+ int bssid_changed;
if (data)
wpa_supplicant_event_associnfo(wpa_s, data);
os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0)) {
wpa_msg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID="
MACSTR, MAC2STR(bssid));
+ bssid_changed = os_memcmp(wpa_s->bssid, bssid, ETH_ALEN);
os_memcpy(wpa_s->bssid, bssid, ETH_ALEN);
os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
+ if (bssid_changed)
+ wpas_notify_bssid_changed(wpa_s);
+
if (wpa_supplicant_dynamic_keys(wpa_s) && !ft_completed) {
wpa_clear_keys(wpa_s, bssid);
}
#include "eloop.h"
#include "config_ssid.h"
#include "wpa_supplicant_i.h"
+#include "notify.h"
#include "driver_i.h"
#include "wpa.h"
#include "ieee802_11_defs.h"
static int ieee80211_sta_join_ibss(struct wpa_supplicant *wpa_s,
struct ieee80211_sta_bss *bss)
{
- int res = 0, rates, done = 0;
+ int res = 0, rates, done = 0, bssid_changed;
struct ieee80211_mgmt *mgmt;
#if 0 /* FIX */
struct ieee80211_tx_control control;
local->hw->reset_tsf(local->mdev);
}
#endif
+ bssid_changed = os_memcmp(wpa_s->bssid, bss->bssid, ETH_ALEN);
os_memcpy(wpa_s->bssid, bss->bssid, ETH_ALEN);
+ if (bssid_changed)
+ wpas_notify_bssid_changed(wpa_s);
#if 0 /* FIX */
local->conf.beacon_int = bss->beacon_int >= 10 ? bss->beacon_int : 10;
struct wpa_driver_associate_params *params)
{
struct ieee80211_sta_bss *bss;
+ int bssid_changed;
wpa_s->mlme.bssid_set = 0;
wpa_s->mlme.freq = params->freq;
if (params->bssid) {
+ bssid_changed = os_memcmp(wpa_s->bssid, params->bssid,
+ ETH_ALEN);
os_memcpy(wpa_s->bssid, params->bssid, ETH_ALEN);
+ if (bssid_changed)
+ wpas_notify_bssid_changed(wpa_s);
+
if (!is_zero_ether_addr(params->bssid))
wpa_s->mlme.bssid_set = 1;
bss = ieee80211_bss_get(wpa_s, wpa_s->bssid);
--- /dev/null
+/*
+ * wpa_supplicant - Event notifications
+ * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#include "includes.h"
+
+#include "common.h"
+#include "config.h"
+#include "wpa_supplicant_i.h"
+#include "wps_supplicant.h"
+#include "ctrl_iface_dbus.h"
+#include "notify.h"
+
+
+void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
+ wpa_states new_state, wpa_states old_state)
+{
+ /* notify the old DBus API */
+ wpa_supplicant_dbus_notify_state_change(wpa_s, new_state,
+ old_state);
+}
+
+
+void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
+{
+}
+
+
+void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
+{
+}
+
+
+void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
+{
+}
+
+
+void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid)
+{
+}
+
+
+void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid)
+{
+}
+
+
+void wpas_notify_unregister_interface(struct wpa_supplicant *wpa_s)
+{
+ /* unregister interface in old DBus ctrl iface */
+ wpas_dbus_unregister_iface(wpa_s);
+}
+
+
+void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
+{
+ /* notify the old DBus API */
+ wpa_supplicant_dbus_notify_scanning(wpa_s);
+}
+
+
+void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
+{
+}
+
+
+void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
+{
+ /* notify the old DBus API */
+ wpa_supplicant_dbus_notify_scan_results(wpa_s);
+
+ wpas_wps_notify_scan_results(wpa_s);
+}
+
+
+void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
+ const struct wps_credential *cred)
+{
+ /* notify the old DBus API */
+ wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
+}
+
+
+void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
+ struct wps_event_m2d *m2d)
+{
+}
+
+
+void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
+ struct wps_event_fail *fail)
+{
+}
+
+
+void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
+{
+}
+
+
+void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid)
+{
+}
+
+
+void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid)
+{
+}
+
+
+void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
+{
+}
+
+
+void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
+{
+}
+
+
+void wpas_notify_debug_params_changed(struct wpa_global *global)
+{
+}
--- /dev/null
+/*
+ * wpa_supplicant - Event notifications
+ * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef NOTIFY_H
+#define NOTIFY_H
+
+struct wps_credential;
+struct wps_event_m2d;
+struct wps_event_fail;
+
+void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
+ wpa_states new_state, wpa_states old_state);
+void wpas_notify_network_changed(struct wpa_supplicant *wpa_s);
+void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s);
+void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s);
+void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid);
+void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid);
+void wpas_notify_unregister_interface(struct wpa_supplicant *wpa_s);
+void wpas_notify_scanning(struct wpa_supplicant *wpa_s);
+void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success);
+void wpas_notify_scan_results(struct wpa_supplicant *wpa_s);
+void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
+ const struct wps_credential *cred);
+void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
+ struct wps_event_m2d *m2d);
+void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
+ struct wps_event_fail *fail);
+void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s);
+void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid);
+void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid);
+void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name);
+void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name);
+
+void wpas_notify_debug_params_changed(struct wpa_global *global);
+
+#endif /* NOTIFY_H */
#include "driver_i.h"
#include "mlme.h"
#include "wps_supplicant.h"
-#include "ctrl_iface_dbus.h"
+#include "notify.h"
static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s)
if (ssid == NULL)
return;
- if (wpa_s->current_ssid == NULL)
+ if (wpa_s->current_ssid == NULL) {
wpa_s->current_ssid = ssid;
+ if (wpa_s->current_ssid != NULL)
+ wpas_notify_network_changed(wpa_s);
+ }
wpa_supplicant_initiate_eapol(wpa_s);
wpa_printf(MSG_DEBUG, "Already associated with a configured network - "
"generating associated event");
wpa_printf(MSG_DEBUG, "Using wired authentication - "
"overriding ap_scan configuration");
wpa_s->conf->ap_scan = 0;
+ wpas_notify_ap_scan_changed(wpa_s);
}
if (wpa_s->conf->ap_scan == 0) {
if (ret) {
wpa_printf(MSG_WARNING, "Failed to initiate AP scan.");
wpa_supplicant_notify_scanning(wpa_s, 0);
+ wpas_notify_scan_done(wpa_s, 0);
wpa_supplicant_req_scan(wpa_s, 10, 0);
} else
wpa_s->scan_runs++;
{
if (wpa_s->scanning != scanning) {
wpa_s->scanning = scanning;
- wpa_supplicant_dbus_notify_scanning(wpa_s);
+ wpas_notify_scanning(wpa_s);
}
}
#include "driver_i.h"
#include "wpas_glue.h"
#include "wps_supplicant.h"
+#include "notify.h"
#include "sme.h"
void sme_authenticate(struct wpa_supplicant *wpa_s,
struct wpa_scan_res *bss, struct wpa_ssid *ssid)
{
struct wpa_driver_auth_params params;
+ struct wpa_ssid *old_ssid;
const u8 *ie;
#ifdef CONFIG_IEEE80211R
const u8 *md = NULL;
#endif /* CONFIG_IEEE80211R */
- int i;
+ int i, bssid_changed;
if (bss == NULL) {
wpa_printf(MSG_ERROR, "SME: No scan result available for the "
}
params.wep_tx_keyidx = ssid->wep_tx_keyidx;
+ bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
os_memset(wpa_s->bssid, 0, ETH_ALEN);
os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN);
+ if (bssid_changed)
+ wpas_notify_bssid_changed(wpa_s);
if (bss && (wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE) ||
wpa_scan_get_ie(bss, WLAN_EID_RSN)) &&
wpa_clear_keys(wpa_s, bss->bssid);
wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING);
+ old_ssid = wpa_s->current_ssid;
wpa_s->current_ssid = ssid;
wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
wpa_supplicant_initiate_eapol(wpa_s);
+ if (old_ssid != wpa_s->current_ssid)
+ wpas_notify_network_changed(wpa_s);
if (wpa_drv_authenticate(wpa_s, ¶ms) < 0) {
wpa_msg(wpa_s, MSG_INFO, "Authentication request to the "
void sme_event_assoc_reject(struct wpa_supplicant *wpa_s,
union wpa_event_data *data)
{
+ int bssid_changed;
+
wpa_printf(MSG_DEBUG, "SME: Association failed: status code %d",
data->assoc_reject.status_code);
wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+ bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
os_memset(wpa_s->bssid, 0, ETH_ALEN);
os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
+ if (bssid_changed)
+ wpas_notify_bssid_changed(wpa_s);
/*
* TODO: if more than one possible AP is available in scan results,
#include "ibss_rsn.h"
#include "sme.h"
#include "ap.h"
+#include "notify.h"
const char *wpa_supplicant_version =
"wpa_supplicant v" VERSION_STR "\n"
if (state != WPA_SCANNING)
wpa_supplicant_notify_scanning(wpa_s, 0);
- wpa_supplicant_dbus_notify_state_change(wpa_s, state,
- wpa_s->wpa_state);
+ wpas_notify_state_changed(wpa_s, state, wpa_s->wpa_state);
if (state == WPA_COMPLETED && wpa_s->new_connection) {
#if defined(CONFIG_CTRL_IFACE) || !defined(CONFIG_NO_STDOUT_DEBUG)
static void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s)
{
+ wpa_states old_state = wpa_s->wpa_state;
wpa_s->pairwise_cipher = 0;
wpa_s->group_cipher = 0;
wpa_s->mgmt_group_cipher = 0;
wpa_s->key_mgmt = 0;
wpa_s->wpa_state = WPA_DISCONNECTED;
+ wpas_notify_state_changed(wpa_s, wpa_s->wpa_state, old_state);
}
int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s)
{
struct wpa_config *conf;
+ struct wpa_ssid *old_ssid;
int reconf_ctrl;
+ int old_ap_scan;
+
if (wpa_s->confname == NULL)
return -1;
conf = wpa_config_read(wpa_s->confname);
}
eapol_sm_invalidate_cached_session(wpa_s->eapol);
+ old_ssid = wpa_s->current_ssid;
wpa_s->current_ssid = NULL;
+ if (old_ssid != wpa_s->current_ssid)
+ wpas_notify_network_changed(wpa_s);
+
/*
* TODO: should notify EAPOL SM about changes in opensc_engine_path,
* pkcs11_engine_path, pkcs11_module_path.
wpa_sm_set_config(wpa_s->wpa, NULL);
wpa_sm_set_fast_reauth(wpa_s->wpa, wpa_s->conf->fast_reauth);
rsn_preauth_deinit(wpa_s->wpa);
+
+ old_ap_scan = wpa_s->conf->ap_scan;
wpa_config_free(wpa_s->conf);
wpa_s->conf = conf;
+ if (old_ap_scan != wpa_s->conf->ap_scan)
+ wpas_notify_ap_scan_changed(wpa_s);
+
if (reconf_ctrl)
wpa_s->ctrl_iface = wpa_supplicant_ctrl_iface_init(wpa_s);
{
u8 wpa_ie[80];
size_t wpa_ie_len;
- int use_crypt, ret, i;
+ int use_crypt, ret, i, bssid_changed;
int algs = AUTH_ALG_OPEN_SYSTEM;
wpa_cipher cipher_pairwise, cipher_group;
struct wpa_driver_associate_params params;
int wep_keys_set = 0;
struct wpa_driver_capa capa;
int assoc_failed = 0;
+ struct wpa_ssid *old_ssid;
if (ssid->mode == 2) {
#ifdef CONFIG_AP
wpa_msg(wpa_s, MSG_INFO, "Trying to associate with " MACSTR
" (SSID='%s' freq=%d MHz)", MAC2STR(bss->bssid),
ie ? wpa_ssid_txt(ie + 2, ie[1]) : "", bss->freq);
+ bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
os_memset(wpa_s->bssid, 0, ETH_ALEN);
os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN);
+ if (bssid_changed)
+ wpas_notify_bssid_changed(wpa_s);
#ifdef CONFIG_IEEE80211R
ie = wpa_scan_get_ie(bss, WLAN_EID_MOBILITY_DOMAIN);
if (ie && ie[1] >= MOBILITY_DOMAIN_ID_LEN)
*/
eapol_sm_invalidate_cached_session(wpa_s->eapol);
}
+ old_ssid = wpa_s->current_ssid;
wpa_s->current_ssid = ssid;
wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
wpa_supplicant_initiate_eapol(wpa_s);
+ if (old_ssid != wpa_s->current_ssid)
+ wpas_notify_network_changed(wpa_s);
}
void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
int reason_code)
{
+ struct wpa_ssid *old_ssid;
u8 *addr = NULL;
+
if (!is_zero_ether_addr(wpa_s->bssid)) {
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)
ieee80211_sta_disassociate(wpa_s, reason_code);
}
wpa_clear_keys(wpa_s, addr);
wpa_supplicant_mark_disassoc(wpa_s);
+ old_ssid = wpa_s->current_ssid;
wpa_s->current_ssid = NULL;
wpa_sm_set_config(wpa_s->wpa, NULL);
eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
+ if (old_ssid != wpa_s->current_ssid)
+ wpas_notify_network_changed(wpa_s);
}
void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
int reason_code)
{
+ struct wpa_ssid *old_ssid;
u8 *addr = NULL;
+
if (!is_zero_ether_addr(wpa_s->bssid)) {
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)
ieee80211_sta_deauthenticate(wpa_s, reason_code);
}
wpa_clear_keys(wpa_s, addr);
wpa_supplicant_mark_disassoc(wpa_s);
+ old_ssid = wpa_s->current_ssid;
wpa_s->current_ssid = NULL;
wpa_sm_set_config(wpa_s->wpa, NULL);
eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
+ if (old_ssid != wpa_s->current_ssid)
+ wpas_notify_network_changed(wpa_s);
}
wpa_clear_keys(wpa_s, NULL);
}
- wpas_dbus_unregister_iface(wpa_s);
+ wpas_notify_unregister_interface(wpa_s);
wpa_supplicant_cleanup(wpa_s);
#include "eloop.h"
#include "uuid.h"
#include "wpa_ctrl.h"
-#include "ctrl_iface_dbus.h"
+#include "notify.h"
#include "eap_common/eap_wsc_common.h"
#include "blacklist.h"
#include "wpa.h"
WPS_EVENT_CRED_RECEIVED, buf);
os_free(buf);
}
- wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
+
+ wpas_notify_wps_credential(wpa_s, cred);
} else
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_CRED_RECEIVED);
ssid = wpa_config_add_network(wpa_s->conf);
if (ssid == NULL)
return -1;
+ wpas_notify_network_added(wpa_s, ssid);
}
wpa_config_set_network_defaults(ssid);
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_M2D
"dev_password_id=%d config_error=%d",
m2d->dev_password_id, m2d->config_error);
+ wpas_notify_wps_event_m2d(wpa_s, m2d);
}
{
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_FAIL "msg=%d", fail->msg);
wpas_clear_wps(wpa_s);
+ wpas_notify_wps_event_fail(wpa_s, fail);
}
{
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_SUCCESS);
wpa_s->wps_success = 1;
+ wpas_notify_wps_event_success(wpa_s);
}
static void wpas_clear_wps(struct wpa_supplicant *wpa_s)
{
int id;
- struct wpa_ssid *ssid;
+ struct wpa_ssid *ssid, *remove_ssid = NULL;
eloop_cancel_timeout(wpas_wps_timeout, wpa_s, NULL);
ssid = wpa_s->conf->ssid;
while (ssid) {
if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
- if (ssid == wpa_s->current_ssid)
+ if (ssid == wpa_s->current_ssid) {
wpa_s->current_ssid = NULL;
+ if (ssid != NULL)
+ wpas_notify_network_changed(wpa_s);
+ }
id = ssid->id;
+ remove_ssid = ssid;
} else
id = -1;
ssid = ssid->next;
- if (id >= 0)
+ if (id >= 0) {
+ wpas_notify_network_removed(wpa_s, remove_ssid);
wpa_config_remove_network(wpa_s->conf, id);
+ }
}
}
ssid = wpa_config_add_network(wpa_s->conf);
if (ssid == NULL)
return NULL;
+ wpas_notify_network_added(wpa_s, ssid);
wpa_config_set_network_defaults(ssid);
if (wpa_config_set(ssid, "key_mgmt", "WPS", 0) < 0 ||
wpa_config_set(ssid, "eap", "WSC", 0) < 0 ||
wpa_config_set(ssid, "identity", registrar ?
"\"" WSC_ID_REGISTRAR "\"" :
"\"" WSC_ID_ENROLLEE "\"", 0) < 0) {
+ wpas_notify_network_removed(wpa_s, ssid);
wpa_config_remove_network(wpa_s->conf, ssid->id);
return NULL;
}
/* Mark all other networks disabled and trigger reassociation */
ssid = wpa_s->conf->ssid;
while (ssid) {
+ int was_disabled = ssid->disabled;
ssid->disabled = ssid != selected;
+ if (was_disabled != ssid->disabled)
+ wpas_notify_network_enabled_changed(wpa_s, ssid);
ssid = ssid->next;
}
wpa_s->disconnected = 0;