File nm-remove-AP-always-on-device-disconnect.diff of Package NetworkManager

From 3fca6c951b4db9de7c5337c5a36832b5ac1fe4e8 Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Fri, 7 Oct 2011 14:48:26 +0200
Subject: [PATCH 1/3] remove AP always on device disconnect

This avoids immediate reconnect after link timeout to an AP that may no longer exist (down/out of range). This also avoids needless prompting for a password for the no longer existing AP.
---
 src/nm-device-wifi.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index 42080ae..e73ab92 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -1285,15 +1285,9 @@ real_deactivate (NMDevice *dev)
 	set_current_ap (self, NULL);
 	priv->rate = 0;
 
-	/* If the AP is 'fake', i.e. it wasn't actually found from
-	 * a scan but the user tried to connect to it manually (maybe it
-	 * was non-broadcasting or something) get rid of it, because 'fake'
-	 * APs should only live for as long as we're connected to them.  Fixes
-	 * a bug where user-created Ad-Hoc APs are never removed from the scan
-	 * list, because scanning is disabled while in Ad-Hoc mode (for stability),
-	 * and thus the AP culling never happens. (bgo #569241)
-	 */
-	if (orig_ap && nm_ap_get_fake (orig_ap)) {
+	/* remove ap always. If it's still there it will re-appear on next
+	 * scan. Avoids reconnect when is no longer available */
+	if (orig_ap /* && nm_ap_get_fake (orig_ap) */) {
 		access_point_removed (self, orig_ap);
 		priv->ap_list = g_slist_remove (priv->ap_list, orig_ap);
 		g_object_unref (orig_ap);
-- 
1.7.3.4