summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2015-11-25 15:35:55 +0100
committerJiří Klimeš <jklimes@redhat.com>2015-11-30 15:00:44 +0100
commit816762515b53ccc597fcc63f7c5038cbbea245bd (patch)
tree6256f8fe1891ef4a9606ab83dfb1b6974c63b0e4
parent717b494a007891e8ccdd796dbd45fa9b435fec8d (diff)
downloadNetworkManager-816762515b53ccc597fcc63f7c5038cbbea245bd.tar.gz
wifi: only try adding supplicant interface 5 times on errors (bgo #753971)
When wpa_supplicant keeps returning an error, NetworkManager was trying over and over again. Which resulted in endless messages: <error> [1448462154.584916] [supplicant-manager/nm-supplicant-interface.c:879] interface_add_cb(): (AAA): error adding interface: wpa_supplicant couldn't grab this interface. NetworkManager[17073]: <info> (AAA): supplicant interface state: starting -> down Testcase: $ iw list | grep -A 3 "interface combinations" interface combinations are not supported HT Capability overrides: * MCS: ff ff ff ff ff ff ff ff ff ff * maximum A-MSDU length $ sudo iw wlan0 interface add AAA type managed ... $ sudo iw dev AAA del Fixes: 3a2e6de0d30217753c825ba1f20e589c1f647780 https://bugzilla.gnome.org/show_bug.cgi?id=753971 (cherry picked from commit 7e93ceb6408cd9345222066ade3f76cc38ad7db3)
-rw-r--r--src/devices/wifi/nm-device-wifi.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 15d41206a1..db78fb4c57 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -136,6 +136,8 @@ struct _NMDeviceWifiPrivate {
guint32 failed_link_count;
guint periodic_source_id;
guint link_timeout_id;
+ guint32 failed_iface_count;
+ guint reacquire_iface_id;
NMDeviceWifiCapabilities capabilities;
};
@@ -1959,6 +1961,15 @@ cleanup_association_attempt (NMDeviceWifi *self, gboolean disconnect)
}
static void
+cleanup_supplicant_failures (NMDeviceWifi *self)
+{
+ NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
+
+ nm_clear_g_source (&priv->reacquire_iface_id);
+ priv->failed_iface_count = 0;
+}
+
+static void
wifi_secrets_cb (NMActRequest *req,
guint32 call_id,
NMConnection *connection,
@@ -2158,6 +2169,24 @@ handle_8021x_or_psk_auth_fail (NMDeviceWifi *self,
return handled;
}
+static gboolean
+reacquire_interface_cb (gpointer user_data)
+{
+ NMDevice *device = NM_DEVICE (user_data);
+ NMDeviceWifi *self = NM_DEVICE_WIFI (device);
+ NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
+
+ priv->reacquire_iface_id = 0;
+ priv->failed_iface_count++;
+
+ _LOGW (LOGD_WIFI, "re-acquiring supplicant interface (#%d).", priv->failed_iface_count);
+
+ if (!priv->sup_iface)
+ supplicant_interface_acquire (self);
+
+ return G_SOURCE_REMOVE;
+}
+
static void
supplicant_iface_state_cb (NMSupplicantInterface *iface,
guint32 new_state,
@@ -2264,7 +2293,10 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
* ready if the supplicant comes back.
*/
supplicant_interface_release (self);
- supplicant_interface_acquire (self);
+ if (priv->failed_iface_count < 5)
+ priv->reacquire_iface_id = g_timeout_add_seconds (10, reacquire_interface_cb, self);
+ else
+ _LOGI (LOGD_DEVICE | LOGD_WIFI, "supplicant interface keeps failing, giving up");
break;
default:
break;
@@ -3061,6 +3093,7 @@ device_state_changed (NMDevice *device,
}
cleanup_association_attempt (self, TRUE);
+ cleanup_supplicant_failures (self);
remove_all_aps (self);
}
@@ -3147,6 +3180,7 @@ set_enabled (NMDevice *device, gboolean enabled)
}
/* Re-initialize the supplicant interface and wait for it to be ready */
+ cleanup_supplicant_failures (self);
if (priv->sup_iface)
supplicant_interface_release (self);
supplicant_interface_acquire (self);
@@ -3201,6 +3235,7 @@ dispose (GObject *object)
cleanup_association_attempt (self, TRUE);
supplicant_interface_release (self);
+ cleanup_supplicant_failures (self);
g_clear_object (&priv->sup_mgr);