Patchwork [2/3] wpa_supplicant: add function that enables one network

login
register
mail settings
Submitter Spinadel, David
Date Oct. 29, 2012, 9:13 a.m.
Message ID <1351502021-10795-2-git-send-email-david.spinadel@intel.com>
Download mbox | patch
Permalink /patch/194922/
State Changes Requested
Headers show

Comments

Spinadel, David - Oct. 29, 2012, 9:13 a.m.
From: David Spinadel <david.spinadel@intel.com>

This function enables one network, clears temp_disabled, notifies
About changing status and toggles reassociate if we are disconnected.

Change-Id: I4de07241b982cb64cc17424d8ee504f4edcd5dad
Signed-off-by: David Spinadel <david.spinadel@intel.com>
---
 wpa_supplicant/wpa_supplicant.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

Patch

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 1e6a93f..358917f 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1791,6 +1791,23 @@  void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
 	wpa_supplicant_clear_connection(wpa_s, addr);
 }
 
+static void wpa_supplicant_enable_one_network(struct wpa_supplicant *wpa_s,
+					     struct wpa_ssid *ssid)
+{
+	if (!ssid || !ssid->disabled || ssid->disabled == 2)
+		return;
+
+	ssid->disabled = 0;
+	wpas_clear_temp_disabled(wpa_s, ssid, 1);
+	wpas_notify_network_enabled_changed(wpa_s, ssid);
+
+	/*
+	 *Try to reassociate since there is no current configuration and a new
+	 * network was made available.
+	 */
+	if (!wpa_s->current_ssid)
+		wpa_s->reassociate = 1;
+}
 
 /**
  * wpa_supplicant_enable_network - Mark a configured network as enabled