Index: NetworkManager-0.7.1/src/nm-device-ethernet.c
===================================================================
--- NetworkManager-0.7.1.orig/src/nm-device-ethernet.c
+++ NetworkManager-0.7.1/src/nm-device-ethernet.c
@@ -1057,15 +1057,17 @@ handle_auth_or_fail (NMDeviceEthernet *s
                      gboolean new_secrets)
 {
 	const char *setting_name;
-	guint32 tries;
+	//guint32 tries;
 	NMConnection *connection;
 
 	connection = nm_act_request_get_connection (req);
 	g_assert (connection);
 
-	tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (connection), WIRED_SECRETS_TRIES));
+	//tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (connection), WIRED_SECRETS_TRIES));
+	/*
 	if (tries > 3)
 		return NM_ACT_STAGE_RETURN_FAILURE;
+	*/
 
 	nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_NONE);
 
@@ -1077,11 +1079,16 @@ handle_auth_or_fail (NMDeviceEthernet *s
 		/* If the caller doesn't necessarily want completely new secrets,
 		 * only ask for new secrets after the first failure.
 		 */
-		get_new = new_secrets ? TRUE : (tries ? TRUE : FALSE);
+
+	    nm_info("using previous settinggs,not asking for new secret");
+		//get_new = new_secrets ? TRUE : (tries ? TRUE : FALSE);
+		get_new = new_secrets;
+		
 		nm_act_request_request_connection_secrets (req, setting_name, get_new,
 		                                           SECRETS_CALLER_ETHERNET, NULL, NULL);
 
-		g_object_set_data (G_OBJECT (connection), WIRED_SECRETS_TRIES, GUINT_TO_POINTER (++tries));
+											   
+	//	g_object_set_data (G_OBJECT (connection), WIRED_SECRETS_TRIES, GUINT_TO_POINTER (++tries));
 	} else
 		nm_warning ("Cleared secrets, but setting didn't need any secrets.");
 
@@ -1108,10 +1115,12 @@ supplicant_connection_timeout_cb (gpoint
 	req = nm_device_get_act_request (device);
 	g_assert (req);
 
-	if (handle_auth_or_fail (self, req, TRUE) == NM_ACT_STAGE_RETURN_POSTPONE)
+/*	if (handle_auth_or_fail (self, req, TRUE) == NM_ACT_STAGE_RETURN_POSTPONE)
 		nm_info ("Activation (%s/wired): asking for new secrets", iface);
 	else
-		nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_NO_SECRETS);
+*/
+	nm_info (" %s logon failed,no more asking new secrets for auth", iface);
+	nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED);
 
 	return FALSE;
 }
@@ -1190,8 +1199,8 @@ nm_8021x_stage2_config (NMDeviceEthernet
 
 		nm_info ("Activation (%s/wired): connection '%s' has security, but secrets are required.",
 				 iface, nm_setting_connection_get_id (s_connection));
-
-		ret = handle_auth_or_fail (self, req, FALSE);
+	    
+		ret=handle_auth_or_fail(self,req,FALSE);
 		if (ret != NM_ACT_STAGE_RETURN_POSTPONE)
 			*reason = NM_DEVICE_STATE_REASON_NO_SECRETS;
 	} else {
Index: NetworkManager-0.7.1/src/NetworkManagerPolicy.c
===================================================================
--- NetworkManager-0.7.1.orig/src/NetworkManagerPolicy.c
+++ NetworkManager-0.7.1/src/NetworkManagerPolicy.c
@@ -41,6 +41,7 @@
 #include "nm-named-manager.h"
 #include "nm-vpn-manager.h"
 #include "nm-modem.h"
+#include "nm-setting-wired.h"
 
 typedef struct LookupThread LookupThread;
 
@@ -732,6 +733,40 @@ get_device_connection (NMDevice *device)
 	return nm_act_request_get_connection (req);
 }
 
+static GSList * get_invalid_wired_connections(NMPolicy* policy)
+{
+	GSList * connections,* iter;
+	g_assert(policy);
+	connections=nm_manager_get_connections(policy->manager,NM_CONNECTION_SCOPE_SYSTEM);
+	connections=g_slist_concat(connections,nm_manager_get_connections(policy->manager,NM_CONNECTION_SCOPE_USER));
+	g_assert(connections);
+	iter=connections;
+	while(iter)
+	{
+		NMConnection * iter_connection=NM_CONNECTION(iter->data);
+		g_assert(iter_connection);
+		GSList * next=g_slist_next(iter);
+		NMSettingConnection * s_con=NULL;
+		const char *connection_type;
+		s_con=(NMSettingConnection*)nm_connection_get_setting(iter_connection,NM_TYPE_SETTING_CONNECTION);
+		if(s_con!=NULL)
+		{
+			connection_type=nm_setting_connection_get_connection_type(s_con);
+			//remove non-wired and invalid connections
+			if(strcmp(connection_type,NM_SETTING_WIRED_SETTING_NAME)||g_object_get_data(G_OBJECT(iter_connection),INVALID_TAG)==NULL)
+			{
+//				nm_info("yes,I got a non-wired or valid connection  %s",get_connection_id(iter_connection));
+				connections=g_slist_remove_link(connections,iter);
+				g_object_unref(iter_connection);
+				g_slist_free(iter);
+			}
+		}
+		iter=next;
+	}
+	return connections;
+
+}
+
 static void
 device_state_changed (NMDevice *device,
                       NMDeviceState new_state,
@@ -761,6 +796,20 @@ device_state_changed (NMDevice *device,
 		break;
 	case NM_DEVICE_STATE_UNMANAGED:
 	case NM_DEVICE_STATE_UNAVAILABLE:
+		if((old_state==NM_DEVICE_STATE_DISCONNECTED || old_state ==NM_DEVICE_STATE_ACTIVATED) && reason==NM_DEVICE_STATE_REASON_CARRIER)
+		{
+			nm_info("%s carry OFF, so clean the invalid tag",nm_device_get_iface(device));
+			GSList * connections=get_invalid_wired_connections(policy);
+			GSList * iter=connections;
+			while(iter)
+			{
+				nm_info("remove INVALID_TAG from '%s'",get_connection_id(NM_CONNECTION(iter->data)));
+				g_object_set_data(G_OBJECT(iter->data),INVALID_TAG,NULL);
+				iter=g_slist_next(iter);
+			}
+			g_slist_foreach(connections,(GFunc)g_object_unref,NULL);
+			g_slist_free(connections);
+		}
 	case NM_DEVICE_STATE_DISCONNECTED:
 		update_routing_and_dns (policy, FALSE);
 		schedule_activate_check (policy, device);
