From e22c6e05e9ebc6cce941762020c5710b8014677b Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Fri, 18 Mar 2011 20:17:47 +0100 Subject: Imported Upstream version 0.8.3.998 --- src/nm-device-ethernet.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'src/nm-device-ethernet.c') diff --git a/src/nm-device-ethernet.c b/src/nm-device-ethernet.c index 08bbc501..49e58887 100644 --- a/src/nm-device-ethernet.c +++ b/src/nm-device-ethernet.c @@ -308,7 +308,7 @@ _update_s390_subchannels (NMDeviceEthernet *self) const char *iface; GUdevClient *client; GUdevDevice *dev; - GUdevDevice *parent; + GUdevDevice *parent = NULL; const char *parent_path, *item, *driver; const char *subsystems[] = { "net", NULL }; GDir *dir; @@ -486,9 +486,43 @@ constructor (GType type, return object; } +static void +clear_secrets_tries (NMDevice *device) +{ + NMActRequest *req; + NMConnection *connection; + + req = nm_device_get_act_request (device); + if (req) { + connection = nm_act_request_get_connection (req); + /* Clear wired secrets tries on success, failure, or when deactivating */ + g_object_set_data (G_OBJECT (connection), WIRED_SECRETS_TRIES, NULL); + } +} + +static void +device_state_changed (NMDevice *device, + NMDeviceState new_state, + NMDeviceState old_state, + NMDeviceStateReason reason, + gpointer user_data) +{ + + switch (new_state) { + case NM_DEVICE_STATE_ACTIVATED: + case NM_DEVICE_STATE_FAILED: + case NM_DEVICE_STATE_DISCONNECTED: + clear_secrets_tries (device); + break; + default: + break; + } +} + static void nm_device_ethernet_init (NMDeviceEthernet * self) { + g_signal_connect (self, "state-changed", G_CALLBACK (device_state_changed), NULL); } static gboolean @@ -1751,6 +1785,9 @@ real_deactivate_quickly (NMDevice *device) NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device); NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); + /* Clear wired secrets tries when deactivating */ + clear_secrets_tries (device); + if (priv->pending_ip4_config) { g_object_unref (priv->pending_ip4_config); priv->pending_ip4_config = NULL; -- cgit 1.3.0-6-gf8a5