mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-05 00:40:32 +01:00
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:3a2e6de0d3https://bugzilla.gnome.org/show_bug.cgi?id=753971 (cherry picked from commit7e93ceb640)
This commit is contained in:
parent
717b494a00
commit
816762515b
1 changed files with 36 additions and 1 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
@ -1958,6 +1960,15 @@ cleanup_association_attempt (NMDeviceWifi *self, gboolean disconnect)
|
|||
nm_supplicant_interface_disconnect (priv->sup_iface);
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue