about summary refs log tree commit diff
path: root/src/settings
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-08-28 01:13:48 +0200
committerMichael Biebl <biebl@debian.org>2015-08-28 01:13:48 +0200
commit81836c2d44802b4cca833d7775dd627e0797a7e2 (patch)
tree91154e6cefc0465306603f51ec0010d9963bbea4 /src/settings
parent50a58f0fabd8a34c1b6108a107e08abe3c1ccd24 (diff)
Imported Upstream version 1.0.6 upstream/1.0.6
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/nm-settings-connection.c422
-rw-r--r--src/settings/nm-settings-connection.h68
-rw-r--r--src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c27
-rw-r--r--src/settings/plugins/ifcfg-rh/plugin.c15
-rw-r--r--src/settings/plugins/ifcfg-rh/reader.c87
-rw-r--r--src/settings/plugins/ifcfg-rh/shvar.c6
-rw-r--r--src/settings/plugins/ifcfg-rh/shvar.h2
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am3
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in3
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-wake-on-lan22
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c125
-rw-r--r--src/settings/plugins/ifcfg-rh/writer.c114
12 files changed, 611 insertions, 283 deletions
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index 0f67a216..da5384c0 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -38,32 +38,57 @@
 #include "nm-properties-changed-signal.h"
 #include "nm-core-internal.h"
 #include "nm-glib-compat.h"
+#include "gsystem-local-alloc.h"
 
 #define SETTINGS_TIMESTAMPS_FILE  NMSTATEDIR "/timestamps"
 #define SETTINGS_SEEN_BSSIDS_FILE NMSTATEDIR "/seen-bssids"
 
-static void impl_settings_connection_get_settings (NMSettingsConnection *connection,
+#define _NMLOG_DOMAIN        LOGD_SETTINGS
+#define _NMLOG_PREFIX_NAME   "settings-connection"
+#define _NMLOG(level, ...) \
+    G_STMT_START { \
+        const NMLogLevel __level = (level); \
+        \
+        if (nm_logging_enabled (__level, _NMLOG_DOMAIN)) { \
+            char __prefix[128]; \
+            const char *__p_prefix = _NMLOG_PREFIX_NAME; \
+            const void *const __self = (self); \
+            \
+            if (__self) { \
+                const char *__uuid = nm_connection_get_uuid ((NMConnection *) __self); \
+                \
+                g_snprintf (__prefix, sizeof (__prefix), "%s[%p%s%s]", _NMLOG_PREFIX_NAME, __self, __uuid ? "," : "", __uuid ? __uuid : ""); \
+                __p_prefix = __prefix; \
+            } \
+            _nm_log (__level, _NMLOG_DOMAIN, 0, \
+                     "%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
+                     __p_prefix _NM_UTILS_MACRO_REST (__VA_ARGS__)); \
+        } \
+    } G_STMT_END
+
+
+static void impl_settings_connection_get_settings (NMSettingsConnection *self,
                                                    DBusGMethodInvocation *context);
 
-static void impl_settings_connection_update (NMSettingsConnection *connection,
+static void impl_settings_connection_update (NMSettingsConnection *self,
                                              GHashTable *new_settings,
                                              DBusGMethodInvocation *context);
 
-static void impl_settings_connection_update_unsaved (NMSettingsConnection *connection,
+static void impl_settings_connection_update_unsaved (NMSettingsConnection *self,
                                                      GHashTable *new_settings,
                                                      DBusGMethodInvocation *context);
 
-static void impl_settings_connection_save (NMSettingsConnection *connection,
+static void impl_settings_connection_save (NMSettingsConnection *self,
                                            DBusGMethodInvocation *context);
 
-static void impl_settings_connection_delete (NMSettingsConnection *connection,
+static void impl_settings_connection_delete (NMSettingsConnection *self,
                                              DBusGMethodInvocation *context);
 
-static void impl_settings_connection_get_secrets (NMSettingsConnection *connection,
+static void impl_settings_connection_get_secrets (NMSettingsConnection *self,
                                                   const gchar *setting_name,
                                                   DBusGMethodInvocation *context);
 
-static void impl_settings_connection_clear_secrets (NMSettingsConnection *connection,
+static void impl_settings_connection_clear_secrets (NMSettingsConnection *self,
                                                     DBusGMethodInvocation *context);
 
 #include "nm-settings-connection-glue.h"
@@ -146,7 +171,7 @@ typedef gboolean (*ForEachSecretFunc) (GHashTableIter *iter,
                                        gpointer user_data);
 
 static void
-for_each_secret (NMConnection *connection,
+for_each_secret (NMConnection *self,
                  GHashTable *secrets,
                  gboolean remove_non_secrets,
                  ForEachSecretFunc callback,
@@ -189,7 +214,7 @@ for_each_secret (NMConnection *connection,
 		 * from the connection data, since flags aren't secrets.  What we're
 		 * iterating here is just the secrets, not a whole connection.
 		 */
-		setting = nm_connection_get_setting_by_name (connection, setting_name);
+		setting = nm_connection_get_setting_by_name (self, setting_name);
 		if (setting == NULL)
 			continue;
 
@@ -488,6 +513,9 @@ nm_settings_connection_replace_settings (NMSettingsConnection *self,
 		nm_utils_log_connection_diff (new_connection, NM_CONNECTION (self), LOGL_DEBUG, LOGD_CORE, log_diff_name, "++ ");
 
 	nm_connection_replace_settings_from_connection (NM_CONNECTION (self), new_connection);
+
+	_LOGD ("replace settings from connection %p (%s)", new_connection, nm_connection_get_id (NM_CONNECTION (self)));
+
 	nm_settings_connection_set_flags (self,
 	                                  NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED | NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED,
 	                                  FALSE);
@@ -526,7 +554,7 @@ nm_settings_connection_replace_settings (NMSettingsConnection *self,
 }
 
 static void
-ignore_cb (NMSettingsConnection *connection,
+ignore_cb (NMSettingsConnection *self,
            GError *error,
            gpointer user_data)
 {
@@ -583,49 +611,49 @@ commit_changes (NMSettingsConnection *self,
 }
 
 void
-nm_settings_connection_commit_changes (NMSettingsConnection *connection,
+nm_settings_connection_commit_changes (NMSettingsConnection *self,
                                        NMSettingsConnectionCommitFunc callback,
                                        gpointer user_data)
 {
-	g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection));
+	g_return_if_fail (NM_IS_SETTINGS_CONNECTION (self));
 
-	if (NM_SETTINGS_CONNECTION_GET_CLASS (connection)->commit_changes) {
-		NM_SETTINGS_CONNECTION_GET_CLASS (connection)->commit_changes (connection,
-		                                                               callback ? callback : ignore_cb,
-		                                                               user_data);
+	if (NM_SETTINGS_CONNECTION_GET_CLASS (self)->commit_changes) {
+		NM_SETTINGS_CONNECTION_GET_CLASS (self)->commit_changes (self,
+		                                                         callback ? callback : ignore_cb,
+		                                                         user_data);
 	} else {
 		GError *error = g_error_new (NM_SETTINGS_ERROR,
 		                             NM_SETTINGS_ERROR_FAILED,
 		                             "%s: %s:%d commit_changes() unimplemented", __func__, __FILE__, __LINE__);
 		if (callback)
-			callback (connection, error, user_data);
+			callback (self, error, user_data);
 		g_error_free (error);
 	}
 }
 
 void
-nm_settings_connection_delete (NMSettingsConnection *connection,
+nm_settings_connection_delete (NMSettingsConnection *self,
                                NMSettingsConnectionDeleteFunc callback,
                                gpointer user_data)
 {
-	g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection));
+	g_return_if_fail (NM_IS_SETTINGS_CONNECTION (self));
 
-	if (NM_SETTINGS_CONNECTION_GET_CLASS (connection)->delete) {
-		NM_SETTINGS_CONNECTION_GET_CLASS (connection)->delete (connection,
-		                                                       callback ? callback : ignore_cb,
-		                                                       user_data);
+	if (NM_SETTINGS_CONNECTION_GET_CLASS (self)->delete) {
+		NM_SETTINGS_CONNECTION_GET_CLASS (self)->delete (self,
+		                                                 callback ? callback : ignore_cb,
+		                                                 user_data);
 	} else {
 		GError *error = g_error_new (NM_SETTINGS_ERROR,
 		                             NM_SETTINGS_ERROR_FAILED,
 		                             "%s: %s:%d delete() unimplemented", __func__, __FILE__, __LINE__);
 		if (callback)
-			callback (connection, error, user_data);
+			callback (self, error, user_data);
 		g_error_free (error);
 	}
 }
 
 static void
-remove_entry_from_db (NMSettingsConnection *connection, const char* db_name)
+remove_entry_from_db (NMSettingsConnection *self, const char* db_name)
 {
 	GKeyFile *key_file;
 	const char *db_file;
@@ -644,7 +672,7 @@ remove_entry_from_db (NMSettingsConnection *connection, const char* db_name)
 		gsize len;
 		GError *error = NULL;
 
-		connection_uuid = nm_connection_get_uuid (NM_CONNECTION (connection));
+		connection_uuid = nm_connection_get_uuid (NM_CONNECTION (self));
 
 		g_key_file_remove_key (key_file, db_name, connection_uuid, NULL);
 		data = g_key_file_to_data (key_file, &len, &error);
@@ -653,7 +681,7 @@ remove_entry_from_db (NMSettingsConnection *connection, const char* db_name)
 			g_free (data);
 		}
 		if (error) {
-			nm_log_warn (LOGD_SETTINGS, "error writing %s file '%s': %s", db_name, db_file, error->message);
+			_LOGW ("error writing %s file '%s': %s", db_name, db_file, error->message);
 			g_error_free (error);
 		}
 	}
@@ -661,39 +689,39 @@ remove_entry_from_db (NMSettingsConnection *connection, const char* db_name)
 }
 
 static void
-do_delete (NMSettingsConnection *connection,
+do_delete (NMSettingsConnection *self,
            NMSettingsConnectionDeleteFunc callback,
            gpointer user_data)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 	NMConnection *for_agents;
 
-	g_object_ref (connection);
-	set_visible (connection, FALSE);
+	g_object_ref (self);
+	set_visible (self, FALSE);
 
 	/* Tell agents to remove secrets for this connection */
-	for_agents = nm_simple_connection_new_clone (NM_CONNECTION (connection));
+	for_agents = nm_simple_connection_new_clone (NM_CONNECTION (self));
 	nm_connection_clear_secrets (for_agents);
 	nm_agent_manager_delete_secrets (priv->agent_mgr, for_agents);
 	g_object_unref (for_agents);
 
 	/* Remove timestamp from timestamps database file */
-	remove_entry_from_db (connection, "timestamps");
+	remove_entry_from_db (self, "timestamps");
 
 	/* Remove connection from seen-bssids database file */
-	remove_entry_from_db (connection, "seen-bssids");
+	remove_entry_from_db (self, "seen-bssids");
 
-	nm_settings_connection_signal_remove (connection);
+	nm_settings_connection_signal_remove (self);
 
-	callback (connection, NULL, user_data);
+	callback (self, NULL, user_data);
 
-	g_object_unref (connection);
+	g_object_unref (self);
 }
 
 /**************************************************************/
 
 static gboolean
-supports_secrets (NMSettingsConnection *connection, const char *setting_name)
+supports_secrets (NMSettingsConnection *self, const char *setting_name)
 {
 	/* All secrets supported */
 	return TRUE;
@@ -734,13 +762,13 @@ has_system_owned_secrets (GHashTableIter *iter,
 }
 
 static void
-new_secrets_commit_cb (NMSettingsConnection *connection,
+new_secrets_commit_cb (NMSettingsConnection *self,
                        GError *error,
                        gpointer user_data)
 {
 	if (error) {
-		nm_log_warn (LOGD_SETTINGS, "Error saving new secrets to backing storage: (%d) %s",
-		             error->code, error->message ? error->message : "(unknown)");
+		_LOGW ("Error saving new secrets to backing storage: (%d) %s",
+		       error->code, error->message ? error->message : "(unknown)");
 	}
 }
 
@@ -767,12 +795,11 @@ agent_secrets_done_cb (NMAgentManager *manager,
 	gboolean agent_had_system = FALSE;
 
 	if (error) {
-		nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) secrets request error: (%d) %s",
-		            nm_connection_get_uuid (NM_CONNECTION (self)),
-		            setting_name,
-		            call_id,
-		            error->code,
-		            error->message ? error->message : "(unknown)");
+		_LOGD ("(%s:%u) secrets request error: (%d) %s",
+		       setting_name,
+		       call_id,
+		       error->code,
+		       error->message ? error->message : "(unknown)");
 
 		callback (self, call_id, NULL, setting_name, error, callback_data);
 		return;
@@ -789,11 +816,10 @@ agent_secrets_done_cb (NMAgentManager *manager,
 
 	g_assert (secrets);
 	if (agent_dbus_owner) {
-		nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) secrets returned from agent %s",
-		            nm_connection_get_uuid (NM_CONNECTION (self)),
-		            setting_name,
-		            call_id,
-		            agent_dbus_owner);
+		_LOGD ("(%s:%u) secrets returned from agent %s",
+		       setting_name,
+		       call_id,
+		       agent_dbus_owner);
 
 		/* If the agent returned any system-owned secrets (initial connect and no
 		 * secrets given when the connection was created, or something like that)
@@ -807,36 +833,32 @@ agent_secrets_done_cb (NMAgentManager *manager,
 				/* No user interaction was allowed when requesting secrets; the
 				 * agent is being bad.  Remove system-owned secrets.
 				 */
-				nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) interaction forbidden but agent %s returned system secrets",
-				            nm_connection_get_uuid (NM_CONNECTION (self)),
-				            setting_name,
-				            call_id,
-				            agent_dbus_owner);
+				_LOGD ("(%s:%u) interaction forbidden but agent %s returned system secrets",
+				       setting_name,
+				       call_id,
+				       agent_dbus_owner);
 
 				for_each_secret (NM_CONNECTION (self), secrets, FALSE, clear_nonagent_secrets, NULL);
 			} else if (agent_has_modify == FALSE) {
 				/* Agent didn't successfully authenticate; clear system-owned secrets
 				 * from the secrets the agent returned.
 				 */
-				nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) agent failed to authenticate but provided system secrets",
-				            nm_connection_get_uuid (NM_CONNECTION (self)),
-				            setting_name,
-				            call_id);
+				_LOGD ("(%s:%u) agent failed to authenticate but provided system secrets",
+				       setting_name,
+				       call_id);
 
 				for_each_secret (NM_CONNECTION (self), secrets, FALSE, clear_nonagent_secrets, NULL);
 			}
 		}
 	} else {
-		nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) existing secrets returned",
-		            nm_connection_get_uuid (NM_CONNECTION (self)),
-		            setting_name,
-		            call_id);
+		_LOGD ("(%s:%u) existing secrets returned",
+		       setting_name,
+		       call_id);
 	}
 
-	nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) secrets request completed",
-	            nm_connection_get_uuid (NM_CONNECTION (self)),
-	            setting_name,
-	            call_id);
+	_LOGD ("(%s:%u) secrets request completed",
+	       setting_name,
+	       call_id);
 
 	/* If no user interaction was allowed, make sure that no "unsaved" secrets
 	 * came back.  Unsaved secrets by definition require user interaction.
@@ -869,34 +891,30 @@ agent_secrets_done_cb (NMAgentManager *manager,
 			 * nothing has changed, since agent-owned secrets don't get saved here.
 			 */
 			if (agent_had_system) {
-				nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) saving new secrets to backing storage",
-						    nm_connection_get_uuid (NM_CONNECTION (self)),
-						    setting_name,
-						    call_id);
+				_LOGD ("(%s:%u) saving new secrets to backing storage",
+				       setting_name,
+				       call_id);
 
 				nm_settings_connection_commit_changes (self, new_secrets_commit_cb, NULL);
 			} else {
-				nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) new agent secrets processed",
-						    nm_connection_get_uuid (NM_CONNECTION (self)),
-						    setting_name,
-						    call_id);
+				_LOGD ("(%s:%u) new agent secrets processed",
+				       setting_name,
+				       call_id);
 			}
 		} else {
-			nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) failed to update with agent secrets: (%d) %s",
-			            nm_connection_get_uuid (NM_CONNECTION (self)),
-			            setting_name,
-			            call_id,
-			            local ? local->code : -1,
-			            (local && local->message) ? local->message : "(unknown)");
+			_LOGD ("(%s:%u) failed to update with agent secrets: (%d) %s",
+			       setting_name,
+			       call_id,
+			       local ? local->code : -1,
+			       (local && local->message) ? local->message : "(unknown)");
 		}
 		g_variant_unref (secrets_dict);
 	} else {
-		nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) failed to update with existing secrets: (%d) %s",
-		            nm_connection_get_uuid (NM_CONNECTION (self)),
-		            setting_name,
-		            call_id,
-		            local ? local->code : -1,
-		            (local && local->message) ? local->message : "(unknown)");
+		_LOGD ("(%s:%u) failed to update with existing secrets: (%d) %s",
+		       setting_name,
+		       call_id,
+		       local ? local->code : -1,
+		       (local && local->message) ? local->message : "(unknown)");
 	}
 
 	callback (self, call_id, agent_username, setting_name, local, callback_data);
@@ -907,7 +925,7 @@ agent_secrets_done_cb (NMAgentManager *manager,
 
 /**
  * nm_settings_connection_get_secrets:
- * @connection: the #NMSettingsConnection
+ * @self: the #NMSettingsConnection
  * @subject: the #NMAuthSubject originating the request
  * @setting_name: the setting to return secrets for
  * @flags: flags to modify the secrets request
@@ -935,7 +953,7 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self,
 	GVariant *existing_secrets;
 	GHashTable *existing_secrets_hash;
 	guint32 call_id = 0;
-	char *joined_hints = NULL;
+	gs_free char *joined_hints = NULL;
 
 	/* Use priv->secrets to work around the fact that nm_connection_clear_secrets()
 	 * will clear secrets on this object's settings.
@@ -973,17 +991,11 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self,
 	if (existing_secrets)
 		g_variant_unref (existing_secrets);
 
-	if (nm_logging_enabled (LOGL_DEBUG, LOGD_SETTINGS)) {
-		if (hints)
-			joined_hints = g_strjoinv (",", (char **) hints);
-		nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) secrets requested flags 0x%X hints '%s'",
-		            nm_connection_get_uuid (NM_CONNECTION (self)),
-		            setting_name,
-		            call_id,
-		            flags,
-		            joined_hints ? joined_hints : "(none)");
-		g_free (joined_hints);
-	}
+	_LOGD ("(%s:%u) secrets requested flags 0x%X hints '%s'",
+	       setting_name,
+	       call_id,
+	       flags,
+	       (hints && hints[0]) ? (joined_hints = g_strjoinv (",", (char **) hints)) : "(none)");
 
 	return call_id;
 }
@@ -994,9 +1006,8 @@ nm_settings_connection_cancel_secrets (NMSettingsConnection *self,
 {
 	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 
-	nm_log_dbg (LOGD_SETTINGS, "(%s:%u) secrets canceled",
-	            nm_connection_get_uuid (NM_CONNECTION (self)),
-	            call_id);
+	_LOGD ("(%u) secrets canceled",
+	       call_id);
 
 	priv->reqs = g_slist_remove (priv->reqs, GUINT_TO_POINTER (call_id));
 	nm_agent_manager_cancel_secrets (priv->agent_mgr, call_id);
@@ -1004,7 +1015,7 @@ nm_settings_connection_cancel_secrets (NMSettingsConnection *self,
 
 /**** User authorization **************************************/
 
-typedef void (*AuthCallback) (NMSettingsConnection *connection, 
+typedef void (*AuthCallback) (NMSettingsConnection *self,
                               DBusGMethodInvocation *context,
                               NMAuthSubject *subject,
                               GError *error,
@@ -1136,13 +1147,13 @@ auth_start (NMSettingsConnection *self,
 /**** DBus method handlers ************************************/
 
 static gboolean
-check_writable (NMConnection *connection, GError **error)
+check_writable (NMConnection *self, GError **error)
 {
 	NMSettingConnection *s_con;
 
-	g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
+	g_return_val_if_fail (NM_IS_CONNECTION (self), FALSE);
 
-	s_con = nm_connection_get_setting_connection (connection);
+	s_con = nm_connection_get_setting_connection (self);
 	if (!s_con) {
 		g_set_error_literal (error,
 		                     NM_SETTINGS_ERROR,
@@ -1272,11 +1283,11 @@ has_some_secrets_cb (NMSetting *setting,
 }
 
 static gboolean
-any_secrets_present (NMConnection *connection)
+any_secrets_present (NMConnection *self)
 {
 	gboolean has_secrets = FALSE;
 
-	nm_connection_for_each_setting_value (connection, has_some_secrets_cb, &has_secrets);
+	nm_connection_for_each_setting_value (self, has_some_secrets_cb, &has_secrets);
 	return has_secrets;
 }
 
@@ -1515,7 +1526,7 @@ impl_settings_connection_save (NMSettingsConnection *self,
 }
 
 static void
-con_delete_cb (NMSettingsConnection *connection,
+con_delete_cb (NMSettingsConnection *self,
                GError *error,
                gpointer user_data)
 {
@@ -1528,7 +1539,7 @@ con_delete_cb (NMSettingsConnection *connection,
 }
 
 static void
-delete_auth_cb (NMSettingsConnection *self, 
+delete_auth_cb (NMSettingsConnection *self,
                 DBusGMethodInvocation *context,
                 NMAuthSubject *subject,
                 GError *error,
@@ -1543,7 +1554,7 @@ delete_auth_cb (NMSettingsConnection *self,
 }
 
 static const char *
-get_modify_permission_basic (NMSettingsConnection *connection)
+get_modify_permission_basic (NMSettingsConnection *self)
 {
 	NMSettingConnection *s_con;
 
@@ -1551,7 +1562,7 @@ get_modify_permission_basic (NMSettingsConnection *connection)
 	 * we use the 'modify.own' permission instead of 'modify.system'.  If the
 	 * request affects more than just the caller, require 'modify.system'.
 	 */
-	s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
+	s_con = nm_connection_get_setting_connection (NM_CONNECTION (self));
 	g_assert (s_con);
 	if (nm_setting_connection_get_num_permissions (s_con) == 1)
 		return NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN;
@@ -1692,7 +1703,7 @@ clear_secrets_cb (NMSettingsConnection *self,
 }
 
 static void
-dbus_clear_secrets_auth_cb (NMSettingsConnection *self, 
+dbus_clear_secrets_auth_cb (NMSettingsConnection *self,
                             DBusGMethodInvocation *context,
                             NMAuthSubject *subject,
                             GError *error,
@@ -1815,7 +1826,7 @@ nm_settings_connection_set_flags_all (NMSettingsConnection *self, NMSettingsConn
 
 /**
  * nm_settings_connection_get_timestamp:
- * @connection: the #NMSettingsConnection
+ * @self: the #NMSettingsConnection
  * @out_timestamp: the connection's timestamp
  *
  * Returns the time (in seconds since the Unix epoch) when the connection
@@ -1824,19 +1835,19 @@ nm_settings_connection_set_flags_all (NMSettingsConnection *self, NMSettingsConn
  * Returns: %TRUE if the timestamp has ever been set, otherwise %FALSE.
  **/
 gboolean
-nm_settings_connection_get_timestamp (NMSettingsConnection *connection,
+nm_settings_connection_get_timestamp (NMSettingsConnection *self,
                                       guint64 *out_timestamp)
 {
-	g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), FALSE);
+	g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (self), FALSE);
 
 	if (out_timestamp)
-		*out_timestamp = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->timestamp;
-	return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->timestamp_set;
+		*out_timestamp = NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->timestamp;
+	return NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->timestamp_set;
 }
 
 /**
  * nm_settings_connection_update_timestamp:
- * @connection: the #NMSettingsConnection
+ * @self: the #NMSettingsConnection
  * @timestamp: timestamp to set into the connection and to store into
  * the timestamps database
  * @flush_to_disk: if %TRUE, commit timestamp update to persistent storage
@@ -1844,18 +1855,18 @@ nm_settings_connection_get_timestamp (NMSettingsConnection *connection,
  * Updates the connection and timestamps database with the provided timestamp.
  **/
 void
-nm_settings_connection_update_timestamp (NMSettingsConnection *connection,
+nm_settings_connection_update_timestamp (NMSettingsConnection *self,
                                          guint64 timestamp,
                                          gboolean flush_to_disk)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 	const char *connection_uuid;
 	GKeyFile *timestamps_file;
 	char *data, *tmp;
 	gsize len;
 	GError *error = NULL;
 
-	g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection));
+	g_return_if_fail (NM_IS_SETTINGS_CONNECTION (self));
 
 	/* Update timestamp in private storage */
 	priv->timestamp = timestamp;
@@ -1868,11 +1879,11 @@ nm_settings_connection_update_timestamp (NMSettingsConnection *connection,
 	timestamps_file = g_key_file_new ();
 	if (!g_key_file_load_from_file (timestamps_file, SETTINGS_TIMESTAMPS_FILE, G_KEY_FILE_KEEP_COMMENTS, &error)) {
 		if (!(error->domain == G_FILE_ERROR && error->code == G_FILE_ERROR_NOENT))
-			nm_log_warn (LOGD_SETTINGS, "error parsing timestamps file '%s': %s", SETTINGS_TIMESTAMPS_FILE, error->message);
+			_LOGW ("error parsing timestamps file '%s': %s", SETTINGS_TIMESTAMPS_FILE, error->message);
 		g_clear_error (&error);
 	}
 
-	connection_uuid = nm_connection_get_uuid (NM_CONNECTION (connection));
+	connection_uuid = nm_connection_get_uuid (NM_CONNECTION (self));
 	tmp = g_strdup_printf ("%" G_GUINT64_FORMAT, timestamp);
 	g_key_file_set_value (timestamps_file, "timestamps", connection_uuid, tmp);
 	g_free (tmp);
@@ -1883,7 +1894,7 @@ nm_settings_connection_update_timestamp (NMSettingsConnection *connection,
 		g_free (data);
 	}
 	if (error) {
-		nm_log_warn (LOGD_SETTINGS, "error saving timestamp to file '%s': %s", SETTINGS_TIMESTAMPS_FILE, error->message);
+		_LOGW ("error saving timestamp to file '%s': %s", SETTINGS_TIMESTAMPS_FILE, error->message);
 		g_error_free (error);
 	}
 	g_key_file_free (timestamps_file);
@@ -1891,27 +1902,27 @@ nm_settings_connection_update_timestamp (NMSettingsConnection *connection,
 
 /**
  * nm_settings_connection_read_and_fill_timestamp:
- * @connection: the #NMSettingsConnection
+ * @self: the #NMSettingsConnection
  *
  * Retrieves timestamp of the connection's last usage from database file and
  * stores it into the connection private data.
  **/
 void
-nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *connection)
+nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *self)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 	const char *connection_uuid;
 	guint64 timestamp = 0;
 	GKeyFile *timestamps_file;
 	GError *err = NULL;
 	char *tmp_str;
 
-	g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection));
+	g_return_if_fail (NM_IS_SETTINGS_CONNECTION (self));
 
 	/* Get timestamp from database file */
 	timestamps_file = g_key_file_new ();
 	g_key_file_load_from_file (timestamps_file, SETTINGS_TIMESTAMPS_FILE, G_KEY_FILE_KEEP_COMMENTS, NULL);
-	connection_uuid = nm_connection_get_uuid (NM_CONNECTION (connection));
+	connection_uuid = nm_connection_get_uuid (NM_CONNECTION (self));
 	tmp_str = g_key_file_get_value (timestamps_file, "timestamps", connection_uuid, &err);
 	if (tmp_str) {
 		timestamp = g_ascii_strtoull (tmp_str, NULL, 10);
@@ -1923,8 +1934,8 @@ nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *connection
 		priv->timestamp = timestamp;
 		priv->timestamp_set = TRUE;
 	} else {
-		nm_log_dbg (LOGD_SETTINGS, "failed to read connection timestamp for '%s': (%d) %s",
-		            connection_uuid, err->code, err->message);
+		_LOGD ("failed to read connection timestamp: (%d) %s",
+		       err->code, err->message);
 		g_clear_error (&err);
 	}
 	g_key_file_free (timestamps_file);
@@ -1932,7 +1943,7 @@ nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *connection
 
 /**
  * nm_settings_connection_get_seen_bssids:
- * @connection: the #NMSettingsConnection
+ * @self: the #NMSettingsConnection
  *
  * Returns current list of seen BSSIDs for the connection.
  *
@@ -1940,14 +1951,14 @@ nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *connection
  * The caller is responsible for freeing the list, but not the content.
  **/
 char **
-nm_settings_connection_get_seen_bssids (NMSettingsConnection *connection)
+nm_settings_connection_get_seen_bssids (NMSettingsConnection *self)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 	GHashTableIter iter;
 	char **bssids, *bssid;
 	int i;
 
-	g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), NULL);
+	g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (self), NULL);
 
 	bssids = g_new (char *, g_hash_table_size (priv->seen_bssids) + 1);
 
@@ -1962,34 +1973,34 @@ nm_settings_connection_get_seen_bssids (NMSettingsConnection *connection)
 
 /**
  * nm_settings_connection_has_seen_bssid:
- * @connection: the #NMSettingsConnection
+ * @self: the #NMSettingsConnection
  * @bssid: the BSSID to check the seen BSSID list for
  *
  * Returns: %TRUE if the given @bssid is in the seen BSSIDs list
  **/
 gboolean
-nm_settings_connection_has_seen_bssid (NMSettingsConnection *connection,
+nm_settings_connection_has_seen_bssid (NMSettingsConnection *self,
                                        const char *bssid)
 {
-	g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), FALSE);
+	g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (self), FALSE);
 	g_return_val_if_fail (bssid != NULL, FALSE);
 
-	return !!g_hash_table_lookup (NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->seen_bssids, bssid);
+	return !!g_hash_table_lookup (NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->seen_bssids, bssid);
 }
 
 /**
  * nm_settings_connection_add_seen_bssid:
- * @connection: the #NMSettingsConnection
+ * @self: the #NMSettingsConnection
  * @seen_bssid: BSSID to set into the connection and to store into
  * the seen-bssids database
  *
  * Updates the connection and seen-bssids database with the provided BSSID.
  **/
 void
-nm_settings_connection_add_seen_bssid (NMSettingsConnection *connection,
+nm_settings_connection_add_seen_bssid (NMSettingsConnection *self,
                                        const char *seen_bssid)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 	const char *connection_uuid;
 	GKeyFile *seen_bssids_file;
 	char *data, *bssid_str;
@@ -2020,13 +2031,13 @@ nm_settings_connection_add_seen_bssid (NMSettingsConnection *connection,
 	g_key_file_set_list_separator (seen_bssids_file, ',');
 	if (!g_key_file_load_from_file (seen_bssids_file, SETTINGS_SEEN_BSSIDS_FILE, G_KEY_FILE_KEEP_COMMENTS, &error)) {
 		if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
-			nm_log_warn (LOGD_SETTINGS, "error parsing seen-bssids file '%s': %s",
-			             SETTINGS_SEEN_BSSIDS_FILE, error->message);
+			_LOGW ("error parsing seen-bssids file '%s': %s",
+			       SETTINGS_SEEN_BSSIDS_FILE, error->message);
 		}
 		g_clear_error (&error);
 	}
 
-	connection_uuid = nm_connection_get_uuid (NM_CONNECTION (connection));
+	connection_uuid = nm_connection_get_uuid (NM_CONNECTION (self));
 	g_key_file_set_string_list (seen_bssids_file, "seen-bssids", connection_uuid, list, n);
 	g_free (list);
 
@@ -2038,23 +2049,23 @@ nm_settings_connection_add_seen_bssid (NMSettingsConnection *connection,
 	g_key_file_free (seen_bssids_file);
 
 	if (error) {
-		nm_log_warn (LOGD_SETTINGS, "error saving seen-bssids to file '%s': %s",
-		             SETTINGS_SEEN_BSSIDS_FILE, error->message);
+		_LOGW ("error saving seen-bssids to file '%s': %s",
+		       SETTINGS_SEEN_BSSIDS_FILE, error->message);
 		g_error_free (error);
 	}
 }
 
 /**
  * nm_settings_connection_read_and_fill_seen_bssids:
- * @connection: the #NMSettingsConnection
+ * @self: the #NMSettingsConnection
  *
  * Retrieves seen BSSIDs of the connection from database file and stores then into the
  * connection private data.
  **/
 void
-nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnection *connection)
+nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnection *self)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 	const char *connection_uuid;
 	GKeyFile *seen_bssids_file;
 	char **tmp_strv = NULL;
@@ -2065,7 +2076,7 @@ nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnection *connecti
 	seen_bssids_file = g_key_file_new ();
 	g_key_file_set_list_separator (seen_bssids_file, ',');
 	if (g_key_file_load_from_file (seen_bssids_file, SETTINGS_SEEN_BSSIDS_FILE, G_KEY_FILE_KEEP_COMMENTS, NULL)) {
-		connection_uuid = nm_connection_get_uuid (NM_CONNECTION (connection));
+		connection_uuid = nm_connection_get_uuid (NM_CONNECTION (self));
 		tmp_strv = g_key_file_get_string_list (seen_bssids_file, "seen-bssids", connection_uuid, &len, NULL);
 	}
 	g_key_file_free (seen_bssids_file);
@@ -2082,7 +2093,7 @@ nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnection *connecti
 		 * seen-bssids list from the deprecated seen-bssids property of the
 		 * wifi setting.
 		 */
-		s_wifi = nm_connection_get_setting_wireless (NM_CONNECTION (connection));
+		s_wifi = nm_connection_get_setting_wireless (NM_CONNECTION (self));
 		if (s_wifi) {
 			len = nm_setting_wireless_get_num_seen_bssids (s_wifi);
 			for (i = 0; i < len; i++) {
@@ -2098,16 +2109,16 @@ nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnection *connecti
 #define AUTOCONNECT_RESET_RETRIES_TIMER 300
 
 int
-nm_settings_connection_get_autoconnect_retries (NMSettingsConnection *connection)
+nm_settings_connection_get_autoconnect_retries (NMSettingsConnection *self)
 {
-	return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->autoconnect_retries;
+	return NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->autoconnect_retries;
 }
 
 void
-nm_settings_connection_set_autoconnect_retries (NMSettingsConnection *connection,
+nm_settings_connection_set_autoconnect_retries (NMSettingsConnection *self,
                                                 int retries)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 
 	priv->autoconnect_retries = retries;
 	if (retries)
@@ -2117,34 +2128,34 @@ nm_settings_connection_set_autoconnect_retries (NMSettingsConnection *connection
 }
 
 void
-nm_settings_connection_reset_autoconnect_retries (NMSettingsConnection *connection)
+nm_settings_connection_reset_autoconnect_retries (NMSettingsConnection *self)
 {
-	nm_settings_connection_set_autoconnect_retries (connection, AUTOCONNECT_RETRIES_DEFAULT);
+	nm_settings_connection_set_autoconnect_retries (self, AUTOCONNECT_RETRIES_DEFAULT);
 }
 
 gint32
-nm_settings_connection_get_autoconnect_retry_time (NMSettingsConnection *connection)
+nm_settings_connection_get_autoconnect_retry_time (NMSettingsConnection *self)
 {
-	return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->autoconnect_retry_time;
+	return NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->autoconnect_retry_time;
 }
 
 NMDeviceStateReason
-nm_settings_connection_get_autoconnect_blocked_reason (NMSettingsConnection *connection)
+nm_settings_connection_get_autoconnect_blocked_reason (NMSettingsConnection *self)
 {
-	return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->autoconnect_blocked_reason;
+	return NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->autoconnect_blocked_reason;
 }
 
 void
-nm_settings_connection_set_autoconnect_blocked_reason (NMSettingsConnection *connection,
+nm_settings_connection_set_autoconnect_blocked_reason (NMSettingsConnection *self,
                                                        NMDeviceStateReason reason)
 {
-	NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->autoconnect_blocked_reason = reason;
+	NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->autoconnect_blocked_reason = reason;
 }
 
 gboolean
-nm_settings_connection_can_autoconnect (NMSettingsConnection *connection)
+nm_settings_connection_can_autoconnect (NMSettingsConnection *self)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 	NMSettingConnection *s_con;
 	const char *permission;
 
@@ -2153,13 +2164,13 @@ nm_settings_connection_can_autoconnect (NMSettingsConnection *connection)
 	    || priv->autoconnect_blocked_reason != NM_DEVICE_STATE_REASON_NONE)
 		return FALSE;
 
-	s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
+	s_con = nm_connection_get_setting_connection (NM_CONNECTION (self));
 	if (!nm_setting_connection_get_autoconnect (s_con))
 		return FALSE;
 
-	permission = nm_utils_get_shared_wifi_permission (NM_CONNECTION (connection));
+	permission = nm_utils_get_shared_wifi_permission (NM_CONNECTION (self));
 	if (permission) {
-		if (nm_settings_connection_check_permission (connection, permission) == FALSE)
+		if (nm_settings_connection_check_permission (self, permission) == FALSE)
 			return FALSE;
 	}
 
@@ -2168,89 +2179,89 @@ nm_settings_connection_can_autoconnect (NMSettingsConnection *connection)
 
 /**
  * nm_settings_connection_get_nm_generated:
- * @connection: an #NMSettingsConnection
+ * @self: an #NMSettingsConnection
  *
- * Gets the "nm-generated" flag on @connection.
+ * Gets the "nm-generated" flag on @self.
  *
  * A connection is "nm-generated" if it was generated by
  * nm_device_generate_connection() and has not been modified or
  * saved by the user since then.
  */
 gboolean
-nm_settings_connection_get_nm_generated (NMSettingsConnection *connection)
+nm_settings_connection_get_nm_generated (NMSettingsConnection *self)
 {
-	return NM_FLAGS_HAS (nm_settings_connection_get_flags (connection), NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED);
+	return NM_FLAGS_HAS (nm_settings_connection_get_flags (self), NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED);
 }
 
 /**
  * nm_settings_connection_get_nm_generated_assumed:
- * @connection: an #NMSettingsConnection
+ * @self: an #NMSettingsConnection
  *
- * Gets the "nm-generated-assumed" flag on @connection.
+ * Gets the "nm-generated-assumed" flag on @self.
  *
  * The connection is a generated connection especially
  * generated for connection assumption.
  */
 gboolean
-nm_settings_connection_get_nm_generated_assumed (NMSettingsConnection *connection)
+nm_settings_connection_get_nm_generated_assumed (NMSettingsConnection *self)
 {
-	return NM_FLAGS_HAS (nm_settings_connection_get_flags (connection), NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED);
+	return NM_FLAGS_HAS (nm_settings_connection_get_flags (self), NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED);
 }
 
 gboolean
-nm_settings_connection_get_ready (NMSettingsConnection *connection)
+nm_settings_connection_get_ready (NMSettingsConnection *self)
 {
-	return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->ready;
+	return NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->ready;
 }
 
 void
-nm_settings_connection_set_ready (NMSettingsConnection *connection,
+nm_settings_connection_set_ready (NMSettingsConnection *self,
                                   gboolean ready)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 
 	ready = !!ready;
 	if (priv->ready != ready) {
 		priv->ready = ready;
-		g_object_notify (G_OBJECT (connection), NM_SETTINGS_CONNECTION_READY);
+		g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_READY);
 	}
 }
 
 /**
  * nm_settings_connection_set_filename:
- * @connection: an #NMSettingsConnection
- * @filename: @connection's filename
+ * @self: an #NMSettingsConnection
+ * @filename: @self's filename
  *
- * Called by a backend to sets the filename that @connection is read
+ * Called by a backend to sets the filename that @self is read
  * from/written to.
  */
 void
-nm_settings_connection_set_filename (NMSettingsConnection *connection,
+nm_settings_connection_set_filename (NMSettingsConnection *self,
                                      const char *filename)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 
 	if (g_strcmp0 (filename, priv->filename) != 0) {
 		g_free (priv->filename);
 		priv->filename = g_strdup (filename);
-		g_object_notify (G_OBJECT (connection), NM_SETTINGS_CONNECTION_FILENAME);
+		g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_FILENAME);
 	}
 }
 
 /**
  * nm_settings_connection_get_filename:
- * @connection: an #NMSettingsConnection
+ * @self: an #NMSettingsConnection
  *
- * Gets the filename that @connection was read from/written to.  This may be
- * %NULL if @connection is unsaved, or if it is associated with a backend that
+ * Gets the filename that @self was read from/written to.  This may be
+ * %NULL if @self is unsaved, or if it is associated with a backend that
  * does not store each connection in a separate file.
  *
- * Returns: @connection's filename.
+ * Returns: @self's filename.
  */
 const char *
-nm_settings_connection_get_filename (NMSettingsConnection *connection)
+nm_settings_connection_get_filename (NMSettingsConnection *self)
 {
-	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
+	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 
 	return priv->filename;
 }
@@ -2283,12 +2294,24 @@ nm_settings_connection_init (NMSettingsConnection *self)
 }
 
 static void
+constructed (GObject *object)
+{
+	NMSettingsConnection *self = NM_SETTINGS_CONNECTION (object);
+
+	_LOGD ("constructed (%s)", G_OBJECT_TYPE_NAME (self));
+
+	G_OBJECT_CLASS (nm_settings_connection_parent_class)->constructed (object);
+}
+
+static void
 dispose (GObject *object)
 {
 	NMSettingsConnection *self = NM_SETTINGS_CONNECTION (object);
 	NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
 	GSList *iter;
 
+	_LOGD ("disposing");
+
 	if (priv->updated_idle_id) {
 		g_source_remove (priv->updated_idle_id);
 		priv->updated_idle_id = 0;
@@ -2389,6 +2412,7 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class)
 	g_type_class_add_private (class, sizeof (NMSettingsConnectionPrivate));
 
 	/* Virtual methods */
+	object_class->constructed = constructed;
 	object_class->dispose = dispose;
 	object_class->get_property = get_property;
 	object_class->set_property = set_property;
@@ -2439,7 +2463,7 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class)
 	/* Signals */
 
 	/* Emitted when the connection is changed for any reason */
-	signals[UPDATED] = 
+	signals[UPDATED] =
 		g_signal_new (NM_SETTINGS_CONNECTION_UPDATED,
 		              G_TYPE_FROM_CLASS (class),
 		              G_SIGNAL_RUN_FIRST,
diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h
index 49661f38..512112f0 100644
--- a/src/settings/nm-settings-connection.h
+++ b/src/settings/nm-settings-connection.h
@@ -81,11 +81,11 @@ typedef enum
 
 typedef struct _NMSettingsConnectionClass NMSettingsConnectionClass;
 
-typedef void (*NMSettingsConnectionCommitFunc) (NMSettingsConnection *connection,
+typedef void (*NMSettingsConnectionCommitFunc) (NMSettingsConnection *self,
                                                 GError *error,
                                                 gpointer user_data);
 
-typedef void (*NMSettingsConnectionDeleteFunc) (NMSettingsConnection *connection,
+typedef void (*NMSettingsConnectionDeleteFunc) (NMSettingsConnection *self,
                                                 GError *error,
                                                 gpointer user_data);
 
@@ -97,26 +97,26 @@ struct _NMSettingsConnectionClass {
 	GObjectClass parent;
 
 	/* virtual methods */
-	void (*replace_and_commit) (NMSettingsConnection *connection,
+	void (*replace_and_commit) (NMSettingsConnection *self,
 	                            NMConnection *new_connection,
 	                            NMSettingsConnectionCommitFunc callback,
 	                            gpointer user_data);
 
-	void (*commit_changes) (NMSettingsConnection *connection,
+	void (*commit_changes) (NMSettingsConnection *self,
 	                        NMSettingsConnectionCommitFunc callback,
 	                        gpointer user_data);
 
-	void (*delete) (NMSettingsConnection *connection,
+	void (*delete) (NMSettingsConnection *self,
 	                NMSettingsConnectionDeleteFunc callback,
 	                gpointer user_data);
 
-	gboolean (*supports_secrets) (NMSettingsConnection *connection,
+	gboolean (*supports_secrets) (NMSettingsConnection *self,
 	                              const char *setting_name);
 };
 
 GType nm_settings_connection_get_type (void);
 
-void nm_settings_connection_commit_changes (NMSettingsConnection *connection,
+void nm_settings_connection_commit_changes (NMSettingsConnection *self,
                                             NMSettingsConnectionCommitFunc callback,
                                             gpointer user_data);
 
@@ -131,18 +131,18 @@ void nm_settings_connection_replace_and_commit (NMSettingsConnection *self,
                                                 NMSettingsConnectionCommitFunc callback,
                                                 gpointer user_data);
 
-void nm_settings_connection_delete (NMSettingsConnection *connection,
+void nm_settings_connection_delete (NMSettingsConnection *self,
                                     NMSettingsConnectionDeleteFunc callback,
                                     gpointer user_data);
 
-typedef void (*NMSettingsConnectionSecretsFunc) (NMSettingsConnection *connection,
+typedef void (*NMSettingsConnectionSecretsFunc) (NMSettingsConnection *self,
                                                  guint32 call_id,
                                                  const char *agent_username,
                                                  const char *setting_name,
                                                  GError *error,
                                                  gpointer user_data);
 
-guint32 nm_settings_connection_get_secrets (NMSettingsConnection *connection,
+guint32 nm_settings_connection_get_secrets (NMSettingsConnection *self,
                                             NMAuthSubject *subject,
                                             const char *setting_name,
                                             NMSecretAgentGetSecretsFlags flags,
@@ -151,7 +151,7 @@ guint32 nm_settings_connection_get_secrets (NMSettingsConnection *connection,
                                             gpointer callback_data,
                                             GError **error);
 
-void nm_settings_connection_cancel_secrets (NMSettingsConnection *connection,
+void nm_settings_connection_cancel_secrets (NMSettingsConnection *self,
                                             guint32 call_id);
 
 gboolean nm_settings_connection_is_visible (NMSettingsConnection *self);
@@ -165,52 +165,52 @@ void nm_settings_connection_signal_remove (NMSettingsConnection *self);
 
 gboolean nm_settings_connection_get_unsaved (NMSettingsConnection *self);
 
-NMSettingsConnectionFlags nm_settings_connection_get_flags (NMSettingsConnection *connection);
-NMSettingsConnectionFlags nm_settings_connection_set_flags (NMSettingsConnection *connection, NMSettingsConnectionFlags flags, gboolean set);
-NMSettingsConnectionFlags nm_settings_connection_set_flags_all (NMSettingsConnection *connection, NMSettingsConnectionFlags flags);
+NMSettingsConnectionFlags nm_settings_connection_get_flags (NMSettingsConnection *self);
+NMSettingsConnectionFlags nm_settings_connection_set_flags (NMSettingsConnection *self, NMSettingsConnectionFlags flags, gboolean set);
+NMSettingsConnectionFlags nm_settings_connection_set_flags_all (NMSettingsConnection *self, NMSettingsConnectionFlags flags);
 
-gboolean nm_settings_connection_get_timestamp (NMSettingsConnection *connection,
+gboolean nm_settings_connection_get_timestamp (NMSettingsConnection *self,
                                                guint64 *out_timestamp);
 
-void nm_settings_connection_update_timestamp (NMSettingsConnection *connection,
+void nm_settings_connection_update_timestamp (NMSettingsConnection *self,
                                               guint64 timestamp,
                                               gboolean flush_to_disk);
 
-void nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *connection);
+void nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *self);
 
-char **nm_settings_connection_get_seen_bssids (NMSettingsConnection *connection);
+char **nm_settings_connection_get_seen_bssids (NMSettingsConnection *self);
 
-gboolean nm_settings_connection_has_seen_bssid (NMSettingsConnection *connection,
+gboolean nm_settings_connection_has_seen_bssid (NMSettingsConnection *self,
                                                 const char *bssid);
 
-void nm_settings_connection_add_seen_bssid (NMSettingsConnection *connection,
+void nm_settings_connection_add_seen_bssid (NMSettingsConnection *self,
                                             const char *seen_bssid);
 
-void nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnection *connection);
+void nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnection *self);
 
-int nm_settings_connection_get_autoconnect_retries (NMSettingsConnection *connection);
-void nm_settings_connection_set_autoconnect_retries (NMSettingsConnection *connection,
+int nm_settings_connection_get_autoconnect_retries (NMSettingsConnection *self);
+void nm_settings_connection_set_autoconnect_retries (NMSettingsConnection *self,
                                                      int retries);
-void nm_settings_connection_reset_autoconnect_retries (NMSettingsConnection *connection);
+void nm_settings_connection_reset_autoconnect_retries (NMSettingsConnection *self);
 
-gint32 nm_settings_connection_get_autoconnect_retry_time (NMSettingsConnection *connection);
+gint32 nm_settings_connection_get_autoconnect_retry_time (NMSettingsConnection *self);
 
-NMDeviceStateReason nm_settings_connection_get_autoconnect_blocked_reason (NMSettingsConnection *connection);
-void nm_settings_connection_set_autoconnect_blocked_reason (NMSettingsConnection *connection,
+NMDeviceStateReason nm_settings_connection_get_autoconnect_blocked_reason (NMSettingsConnection *self);
+void nm_settings_connection_set_autoconnect_blocked_reason (NMSettingsConnection *self,
                                                             NMDeviceStateReason reason);
 
-gboolean nm_settings_connection_can_autoconnect (NMSettingsConnection *connection);
+gboolean nm_settings_connection_can_autoconnect (NMSettingsConnection *self);
 
-gboolean nm_settings_connection_get_nm_generated (NMSettingsConnection *connection);
-gboolean nm_settings_connection_get_nm_generated_assumed (NMSettingsConnection *connection);
+gboolean nm_settings_connection_get_nm_generated (NMSettingsConnection *self);
+gboolean nm_settings_connection_get_nm_generated_assumed (NMSettingsConnection *self);
 
-gboolean nm_settings_connection_get_ready (NMSettingsConnection *connection);
-void     nm_settings_connection_set_ready (NMSettingsConnection *connection,
+gboolean nm_settings_connection_get_ready (NMSettingsConnection *self);
+void     nm_settings_connection_set_ready (NMSettingsConnection *self,
                                            gboolean ready);
 
-void        nm_settings_connection_set_filename (NMSettingsConnection *connection,
+void        nm_settings_connection_set_filename (NMSettingsConnection *self,
                                                  const char *filename);
-const char *nm_settings_connection_get_filename (NMSettingsConnection *connection);
+const char *nm_settings_connection_get_filename (NMSettingsConnection *self);
 
 G_END_DECLS
 
diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
index a18920c6..9499d8ce 100644
--- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
+++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
@@ -67,6 +67,8 @@ typedef struct {
 
 	gulong devtimeout_link_changed_handler;
 	guint devtimeout_timeout_id;
+
+	NMInotifyHelper *inotify_helper;
 } NMIfcfgConnectionPrivate;
 
 enum {
@@ -84,6 +86,14 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
+static NMInotifyHelper *
+_get_inotify_helper (NMIfcfgConnectionPrivate *priv)
+{
+	if (!priv->inotify_helper)
+		priv->inotify_helper = g_object_ref (nm_inotify_helper_get ());
+	return priv->inotify_helper;
+}
+
 static gboolean
 devtimeout_ready (gpointer user_data)
 {
@@ -149,6 +159,7 @@ nm_ifcfg_connection_check_devtimeout (NMIfcfgConnection *self)
 	const char *ifname;
 	const char *filename;
 	guint devtimeout;
+	const NMPlatformLink *pllink;
 
 	s_con = nm_connection_get_setting_connection (NM_CONNECTION (self));
 
@@ -160,11 +171,13 @@ nm_ifcfg_connection_check_devtimeout (NMIfcfgConnection *self)
 	filename = nm_settings_connection_get_filename (NM_SETTINGS_CONNECTION (self));
 	if (!filename)
 		return;
-	devtimeout = devtimeout_from_file (filename);
-	if (!devtimeout)
+
+	pllink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, ifname);
+	if (pllink && pllink->initialized)
 		return;
 
-	if (nm_platform_link_get_ifindex (NM_PLATFORM_GET, ifname) != 0)
+	devtimeout = devtimeout_from_file (filename);
+	if (!devtimeout)
 		return;
 
 	/* ONBOOT=yes, DEVICE and DEVTIMEOUT are set, but device is not present */
@@ -261,7 +274,7 @@ path_watch_stop (NMIfcfgConnection *self)
 	NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (self);
 	NMInotifyHelper *ih;
 
-	ih = nm_inotify_helper_get ();
+	ih = _get_inotify_helper (priv);
 
 	if (priv->ih_event_id) {
 		g_signal_handler_disconnect (ih, priv->ih_event_id);
@@ -315,7 +328,9 @@ filename_changed (GObject *object,
 	priv->route6file = utils_get_route6_path (ifcfg_path);
 
 	if (nm_config_get_monitor_connection_files (nm_config_get ())) {
-		NMInotifyHelper *ih = nm_inotify_helper_get ();
+		NMInotifyHelper *ih;
+
+		ih = _get_inotify_helper (priv);
 
 		priv->ih_event_id = g_signal_connect (ih, "event", G_CALLBACK (files_changed_cb), self);
 		priv->file_wd = nm_inotify_helper_add_watch (ih, ifcfg_path);
@@ -509,6 +524,8 @@ dispose (GObject *object)
 		priv->devtimeout_timeout_id = 0;
 	}
 
+	g_clear_object (&priv->inotify_helper);
+
 	G_OBJECT_CLASS (nm_ifcfg_connection_parent_class)->dispose (object);
 }
 
diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c
index 1a3f791a..526cdafe 100644
--- a/src/settings/plugins/ifcfg-rh/plugin.c
+++ b/src/settings/plugins/ifcfg-rh/plugin.c
@@ -42,7 +42,7 @@
 #include <selinux/selinux.h>
 #endif
 
-#include <nm-setting-connection.h>
+#include "nm-setting-connection.h"
 
 #include "common.h"
 #include "nm-dbus-glib-types.h"
@@ -64,22 +64,15 @@
 #define DBUS_OBJECT_PATH "/com/redhat/ifcfgrh1"
 
 
-#define _LOG_DEFAULT_DOMAIN  LOGD_SETTINGS
-
-#define _LOG(level, domain, ...) \
+#define _NMLOG_DOMAIN  LOGD_SETTINGS
+#define _NMLOG(level, ...) \
     G_STMT_START { \
-        nm_log ((level), (domain), \
+        nm_log ((level), (_NMLOG_DOMAIN), \
                 "%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
                 "ifcfg-rh: " \
                 _NM_UTILS_MACRO_REST(__VA_ARGS__)); \
     } G_STMT_END
 
-#define _LOGT(...)      _LOG (LOGL_TRACE, _LOG_DEFAULT_DOMAIN, __VA_ARGS__)
-#define _LOGD(...)      _LOG (LOGL_DEBUG, _LOG_DEFAULT_DOMAIN, __VA_ARGS__)
-#define _LOGI(...)      _LOG (LOGL_INFO,  _LOG_DEFAULT_DOMAIN, __VA_ARGS__)
-#define _LOGW(...)      _LOG (LOGL_WARN,  _LOG_DEFAULT_DOMAIN, __VA_ARGS__)
-#define _LOGE(...)      _LOG (LOGL_ERR,   _LOG_DEFAULT_DOMAIN, __VA_ARGS__)
-
 #define ERR_GET_MSG(err) (((err) && (err)->message) ? (err)->message : "(unknown)")
 
 
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index ec874167..72123e66 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -250,6 +250,15 @@ make_connection_setting (const char *file,
 		g_free (value);
 	}
 
+	switch (svTrueValue (ifcfg, "CONNECTION_METERED", -1)) {
+	case TRUE:
+		g_object_set (s_con, NM_SETTING_CONNECTION_METERED, NM_METERED_YES, NULL);
+		break;
+	case FALSE:
+		g_object_set (s_con, NM_SETTING_CONNECTION_METERED, NM_METERED_NO, NULL);
+		break;
+	}
+
 	return NM_SETTING (s_con);
 }
 
@@ -3492,6 +3501,80 @@ wireless_connection_from_ifcfg (const char *file,
 	return connection;
 }
 
+static void
+parse_ethtool_options (shvarFile *ifcfg, NMSettingWired *s_wired, char *value)
+{
+	NMSettingWiredWakeOnLan wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
+	gboolean use_password = FALSE;
+	char **words, **iter, *flag;
+
+	if (!value || !value[0])
+		return;
+
+	words = g_strsplit_set (value, " ", 0);
+	iter = words;
+
+	while (iter[0]) {
+		if (g_str_equal (iter[0], "wol") && iter[1] && *iter[1]) {
+			for (flag = iter[1]; *flag; flag++) {
+				switch (*flag) {
+				case 'p':
+					wol_flags |= NM_SETTING_WIRED_WAKE_ON_LAN_PHY;
+					break;
+				case 'u':
+					wol_flags |= NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST;
+					break;
+				case 'm':
+					wol_flags |= NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST;
+					break;
+				case 'b':
+					wol_flags |= NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST;
+					break;
+				case 'a':
+					wol_flags |= NM_SETTING_WIRED_WAKE_ON_LAN_ARP;
+					break;
+				case 'g':
+					wol_flags |= NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC;
+					break;
+				case 's':
+					use_password = TRUE;
+					break;
+				case 'd':
+					wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
+					use_password = FALSE;
+					break;
+				default:
+					PARSE_WARNING ("unrecognized Wake-on-LAN option '%c'", *flag);
+				}
+			}
+
+			if (!NM_FLAGS_HAS (wol_flags, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC))
+				use_password = FALSE;
+
+			g_object_set (s_wired, NM_SETTING_WIRED_WAKE_ON_LAN, wol_flags, NULL);
+			iter += 2;
+			continue;
+		}
+
+		if (g_str_equal (iter[0], "sopass") && iter[1] && *iter[1]) {
+			if (use_password) {
+				if (nm_utils_hwaddr_valid (iter[1], ETH_ALEN))
+					g_object_set (s_wired, NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD, iter[1], NULL);
+				else
+					PARSE_WARNING ("Wake-on-LAN password '%s' is invalid", iter[1]);
+			} else
+				PARSE_WARNING ("Wake-on-LAN password not expected");
+			iter += 2;
+			continue;
+		}
+
+		/* Silently skip unknown options */
+		iter++;
+	}
+
+	g_strfreev (words);
+}
+
 static NMSetting *
 make_wired_setting (shvarFile *ifcfg,
                     const char *file,
@@ -3627,6 +3710,10 @@ make_wired_setting (shvarFile *ifcfg,
 		g_free (value);
 	}
 
+	value = svGetValue (ifcfg, "ETHTOOL_OPTS", FALSE);
+	parse_ethtool_options (ifcfg, s_wired, value);
+	g_free (value);
+
 	return (NMSetting *) s_wired;
 
 error:
diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c
index 4a5ca1d1..283aa826 100644
--- a/src/settings/plugins/ifcfg-rh/shvar.c
+++ b/src/settings/plugins/ifcfg-rh/shvar.c
@@ -303,11 +303,11 @@ svGetValueFull (shvarFile *s, const char *key, gboolean verbatim)
  * return FALSE if <key> resolves to any non-truth value (e.g. "no", "n", "false")
  * return <default> otherwise
  */
-gboolean
-svTrueValue (shvarFile *s, const char *key, gboolean def)
+gint
+svTrueValue (shvarFile *s, const char *key, gint def)
 {
 	char *tmp;
-	gboolean returnValue = def;
+	gint returnValue = def;
 
 	tmp = svGetValue (s, key, FALSE);
 	if (!tmp)
diff --git a/src/settings/plugins/ifcfg-rh/shvar.h b/src/settings/plugins/ifcfg-rh/shvar.h
index 4902541b..de7a3585 100644
--- a/src/settings/plugins/ifcfg-rh/shvar.h
+++ b/src/settings/plugins/ifcfg-rh/shvar.h
@@ -62,7 +62,7 @@ char *svGetValueFull (shvarFile *s, const char *key, gboolean verbatim);
  * return FALSE if <key> resolves to any non-truth value (e.g. "no", "n", "false")
  * return <def> otherwise
  */
-gboolean svTrueValue (shvarFile *s, const char *key, gboolean def);
+gint svTrueValue (shvarFile *s, const char *key, gint def);
 
 gint64 svGetValueInt64 (shvarFile *s, const char *key, guint base, gint64 min, gint64 max, gint64 fallback);
 
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
index a20a78d9..7b5aaf17 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
@@ -123,7 +123,8 @@ EXTRA_DIST = \
 	ifcfg-test-team-master \
 	ifcfg-test-team-port \
 	ifcfg-test-team-port-empty-config \
-	ifcfg-test-vlan-trailing-spaces
+	ifcfg-test-vlan-trailing-spaces \
+	ifcfg-test-wired-wake-on-lan
 
 # make target dependencies can't have colons in their names, which ends up
 # meaning that we can't add the alias files to EXTRA_DIST
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in
index ef06c5ef..2435434d 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in
@@ -518,7 +518,8 @@ EXTRA_DIST = \
 	ifcfg-test-team-master \
 	ifcfg-test-team-port \
 	ifcfg-test-team-port-empty-config \
-	ifcfg-test-vlan-trailing-spaces
+	ifcfg-test-vlan-trailing-spaces \
+	ifcfg-test-wired-wake-on-lan
 
 
 # make target dependencies can't have colons in their names, which ends up
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-wake-on-lan b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-wake-on-lan
new file mode 100644
index 00000000..1dfc9a43
--- /dev/null
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-wake-on-lan
@@ -0,0 +1,22 @@
+# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile)
+TYPE=Ethernet
+DEVICE=eth0
+HWADDR=00:11:22:33:44:ee
+BOOTPROTO=none
+ONBOOT=yes
+USERCTL=yes
+MTU=1492
+NM_CONTROLLED=yes
+DNS1=4.2.2.1
+DNS2=4.2.2.2
+IPADDR=192.168.1.5
+NETMASK=255.255.255.0
+GATEWAY=192.168.1.1
+IPV6INIT=yes
+IPV6_AUTOCONF=no
+IPV6ADDR=dead:beaf::1
+IPV6ADDR_SECONDARIES="dead:beaf::2/56"
+DNS3=1:2:3:4::a
+DNS4=1:2:3:4::b
+RES_OPTIONS=
+ETHTOOL_OPTS="speed 100 duplex full wol apgs sopass 00:11:22:33:44:55 autoneg off"
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index d2fb6867..f2f85d3c 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -5104,6 +5104,43 @@ test_read_wifi_wep_eap_ttls_chap (void)
 }
 
 static void
+test_read_wired_wake_on_lan (void)
+{
+	NMConnection *connection;
+	NMSettingConnection *s_con;
+	NMSettingWired *s_wired;
+	gboolean success;
+	GError *error = NULL;
+
+	connection = connection_from_file_test (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-wake-on-lan",
+	                                        NULL, TYPE_WIRELESS, NULL, &error);
+	g_assert_no_error (error);
+	g_assert (connection);
+
+	success = nm_connection_verify (connection, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	s_con = nm_connection_get_setting_connection (connection);
+	g_assert (s_con);
+	g_assert_cmpstr (nm_setting_connection_get_connection_type (s_con), ==, NM_SETTING_WIRED_SETTING_NAME);
+
+	s_wired = nm_connection_get_setting_wired (connection);
+	g_assert (s_wired);
+	g_assert_cmpint (nm_setting_wired_get_wake_on_lan (s_wired),
+	                 ==,
+	                 NM_SETTING_WIRED_WAKE_ON_LAN_ARP |
+	                 NM_SETTING_WIRED_WAKE_ON_LAN_PHY |
+	                 NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC);
+
+	g_assert_cmpstr (nm_setting_wired_get_wake_on_lan_password (s_wired),
+	                 ==,
+	                 "00:11:22:33:44:55");
+
+	g_object_unref (connection);
+}
+
+static void
 test_read_wifi_hidden (void)
 {
 	NMConnection *connection;
@@ -5218,6 +5255,90 @@ test_write_wifi_hidden (void)
 }
 
 static void
+test_write_wired_wake_on_lan (void)
+{
+	NMConnection *connection, *reread;
+	NMSettingConnection *s_con;
+	NMSettingWired *s_wired;
+	NMSettingWiredWakeOnLan wol;
+	char *uuid, *testfile = NULL, *val;
+	gboolean success;
+	GError *error = NULL;
+	shvarFile *f;
+
+	connection = nm_simple_connection_new ();
+
+	/* Connection setting */
+	s_con = (NMSettingConnection *) nm_setting_connection_new ();
+	nm_connection_add_setting (connection, NM_SETTING (s_con));
+
+	uuid = nm_utils_uuid_generate ();
+	g_object_set (s_con,
+	              NM_SETTING_CONNECTION_ID, "Test Write Wired Wake-on-LAN",
+	              NM_SETTING_CONNECTION_UUID, uuid,
+	              NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME,
+	              NULL);
+	g_free (uuid);
+
+	/* Wired setting */
+	s_wired = (NMSettingWired *) nm_setting_wired_new ();
+	nm_connection_add_setting (connection, NM_SETTING (s_wired));
+
+	wol = NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST |
+	      NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST |
+	      NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC;
+
+	g_object_set (s_wired,
+	              NM_SETTING_WIRED_WAKE_ON_LAN, wol,
+	              NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD, "00:00:00:11:22:33",
+	              NULL);
+
+	success = nm_connection_verify (connection, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	/* Save the ifcfg */
+	success = writer_new_connection (connection,
+	                                 TEST_SCRATCH_DIR "/network-scripts/",
+	                                 &testfile,
+	                                 &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	f = svOpenFile (testfile, &error);
+	g_assert_no_error (error);
+	g_assert (f);
+
+	/* re-read the file to check that the key was written. */
+	val = svGetValue (f, "ETHTOOL_OPTS", FALSE);
+	g_assert (val);
+	g_assert (strstr (val, "wol"));
+	g_assert (strstr (val, "sopass 00:00:00:11:22:33"));
+	g_free (val);
+	svCloseFile (f);
+
+	/* reread will be normalized, so we must normalize connection too. */
+	nm_connection_normalize (connection, NULL, NULL, NULL);
+
+	/* re-read the connection for comparison */
+	reread = connection_from_file_test (testfile, NULL, TYPE_ETHERNET,
+	                                    NULL, &error);
+	unlink (testfile);
+	g_assert_no_error (error);
+	g_assert (reread);
+
+	success = nm_connection_verify (reread, &error);
+	g_assert_no_error (error);
+	g_assert (success);
+
+	g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT));
+
+	g_free (testfile);
+	g_object_unref (connection);
+	g_object_unref (reread);
+}
+
+static void
 test_read_wifi_band_a (void)
 {
 	NMConnection *connection;
@@ -6405,7 +6526,7 @@ test_write_wired_static_ip6_only_gw (gconstpointer user_data)
 	g_assert (addr6);
 
 	/* assert that the gateway was written and reloaded as expected */
-	if (!gateway6 || !strcmp (gateway6, "::")) {
+	if (!gateway6) {
 		g_assert (nm_setting_ip_config_get_gateway (s_ip6) == NULL);
 		g_assert (written_ifcfg_gateway == NULL);
 	} else {
@@ -12551,6 +12672,7 @@ int main (int argc, char **argv)
 	test_read_vlan_only_vlan_id ();
 	test_read_vlan_only_device ();
 	g_test_add_func (TPATH "vlan/physdev", test_read_vlan_physdev);
+	g_test_add_func (TPATH "wired/read-wake-on-lan", test_read_wired_wake_on_lan);
 
 	test_write_wired_static ();
 	test_write_wired_static_ip6_only ();
@@ -12565,6 +12687,7 @@ int main (int argc, char **argv)
 	test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_BLOB, NM_SETTING_SECRET_FLAG_NONE);
 	test_write_wired_aliases ();
 	g_test_add_func (TPATH "ipv4/write-static-addresses-GATEWAY", test_write_gateway);
+	g_test_add_func (TPATH "wired/write-wake-on-lan", test_write_wired_wake_on_lan);
 	test_write_wifi_open ();
 	test_write_wifi_open_hex_ssid ();
 	test_write_wifi_wep ();
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index 52bf51d1..69b7d64a 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -42,6 +42,8 @@
 #include <nm-setting-team-port.h>
 #include "nm-core-internal.h"
 #include <nm-utils.h>
+#include "nm-core-internal.h"
+#include "nm-macros-internal.h"
 
 #include "nm-logging.h"
 #include "gsystem-local-alloc.h"
@@ -1048,6 +1050,8 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
 	const char *const *s390_subchannels;
 	GString *str;
 	const char * const *macaddr_blacklist;
+	NMSettingWiredWakeOnLan wol;
+	const char *wol_password;
 
 	s_wired = nm_connection_get_setting_wired (connection);
 	if (!s_wired) {
@@ -1131,6 +1135,37 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
 		g_string_free (str, TRUE);
 	}
 
+	wol = nm_setting_wired_get_wake_on_lan (s_wired);
+	wol_password = nm_setting_wired_get_wake_on_lan_password (s_wired);
+	if (wol == NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT)
+		svSetValue (ifcfg, "ETHTOOL_OPTS", NULL, FALSE);
+	else {
+		str = g_string_sized_new (30);
+		g_string_append (str, "wol ");
+
+		if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_PHY))
+			g_string_append (str, "p");
+		if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST))
+			g_string_append (str, "u");
+		if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST))
+			g_string_append (str, "m");
+		if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST))
+			g_string_append (str, "b");
+		if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_ARP))
+			g_string_append (str, "a");
+		if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC))
+			g_string_append (str, "g");
+
+		if (!NM_FLAGS_ANY (wol, NM_SETTING_WIRED_WAKE_ON_LAN_ALL))
+			g_string_append (str, "d");
+
+		if (wol_password && NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC))
+			g_string_append_printf (str, "s sopass %s", wol_password);
+
+		svSetValue (ifcfg, "ETHTOOL_OPTS", str->str, FALSE);
+		g_string_free (str, TRUE);
+	}
+
 	svSetValue (ifcfg, "TYPE", TYPE_ETHERNET, FALSE);
 
 	return TRUE;
@@ -1159,11 +1194,42 @@ vlan_priority_maplist_to_stringlist (NMSettingVlan *s_vlan, NMVlanPriorityMap ma
 }
 
 static gboolean
+write_wired_for_virtual (NMConnection *connection, shvarFile *ifcfg)
+{
+	NMSettingWired *s_wired;
+	gboolean has_wired = FALSE;
+
+	s_wired = nm_connection_get_setting_wired (connection);
+	if (s_wired) {
+		const char *device_mac, *cloned_mac;
+		char *tmp;
+		guint32 mtu;
+
+		has_wired = TRUE;
+
+		device_mac = nm_setting_wired_get_mac_address (s_wired);
+		if (device_mac)
+			svSetValue (ifcfg, "HWADDR", device_mac, FALSE);
+
+		cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
+		if (cloned_mac)
+			svSetValue (ifcfg, "MACADDR", cloned_mac, FALSE);
+
+		mtu = nm_setting_wired_get_mtu (s_wired);
+		if (mtu) {
+			tmp = g_strdup_printf ("%u", mtu);
+			svSetValue (ifcfg, "MTU", tmp, FALSE);
+			g_free (tmp);
+		}
+	}
+	return has_wired;
+}
+
+static gboolean
 write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, GError **error)
 {
 	NMSettingVlan *s_vlan;
 	NMSettingConnection *s_con;
-	NMSettingWired *s_wired;
 	char *tmp;
 	guint32 vlan_flags = 0;
 
@@ -1217,34 +1283,13 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired,
 	svSetValue (ifcfg, "MACADDR", NULL, FALSE);
 	svSetValue (ifcfg, "MTU", NULL, FALSE);
 
-	s_wired = nm_connection_get_setting_wired (connection);
-	if (s_wired) {
-		const char *device_mac, *cloned_mac;
-		guint32 mtu;
-
-		*wired = TRUE;
-
-		device_mac = nm_setting_wired_get_mac_address (s_wired);
-		if (device_mac)
-			svSetValue (ifcfg, "HWADDR", device_mac, FALSE);
-
-		cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
-		if (cloned_mac)
-			svSetValue (ifcfg, "MACADDR", cloned_mac, FALSE);
-
-		mtu = nm_setting_wired_get_mtu (s_wired);
-		if (mtu) {
-			tmp = g_strdup_printf ("%u", mtu);
-			svSetValue (ifcfg, "MTU", tmp, FALSE);
-			g_free (tmp);
-		}
-	}
+	*wired = write_wired_for_virtual (connection, ifcfg);
 
 	return TRUE;
 }
 
 static gboolean
-write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
+write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, GError **error)
 {
 	NMSettingBond *s_bond;
 	const char *iface;
@@ -1292,11 +1337,13 @@ write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, GError **erro
 	svSetValue (ifcfg, "TYPE", TYPE_BOND, FALSE);
 	svSetValue (ifcfg, "BONDING_MASTER", "yes", FALSE);
 
+	*wired = write_wired_for_virtual (connection, ifcfg);
+
 	return TRUE;
 }
 
 static gboolean
-write_team_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
+write_team_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, GError **error)
 {
 	NMSettingTeam *s_team;
 	const char *iface;
@@ -1321,6 +1368,8 @@ write_team_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
 	svSetValue (ifcfg, "TEAM_CONFIG", config, FALSE);
 	svSetValue (ifcfg, "DEVICETYPE", TYPE_TEAM, FALSE);
 
+	*wired = write_wired_for_virtual (connection, ifcfg);
+
 	return TRUE;
 }
 
@@ -1764,6 +1813,17 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
 		svSetValue (ifcfg, "GATEWAY_PING_TIMEOUT", tmp, FALSE);
 		g_free (tmp);
 	}
+
+	switch (nm_setting_connection_get_metered (s_con)) {
+	case NM_METERED_YES:
+		svSetValue (ifcfg, "CONNECTION_METERED", "yes", FALSE);
+		break;
+	case NM_METERED_NO:
+		svSetValue (ifcfg, "CONNECTION_METERED", "no", FALSE);
+		break;
+	default:
+		svSetValue (ifcfg, "CONNECTION_METERED", NULL, FALSE);
+	}
 }
 
 static gboolean
@@ -2564,10 +2624,10 @@ write_connection (NMConnection *connection,
 		if (!write_infiniband_setting (connection, ifcfg, error))
 			goto out;
 	} else if (!strcmp (type, NM_SETTING_BOND_SETTING_NAME)) {
-		if (!write_bonding_setting (connection, ifcfg, error))
+		if (!write_bonding_setting (connection, ifcfg, &wired, error))
 			goto out;
 	} else if (!strcmp (type, NM_SETTING_TEAM_SETTING_NAME)) {
-		if (!write_team_setting (connection, ifcfg, error))
+		if (!write_team_setting (connection, ifcfg, &wired, error))
 			goto out;
 	} else if (!strcmp (type, NM_SETTING_BRIDGE_SETTING_NAME)) {
 		if (!write_bridge_setting (connection, ifcfg, error))