summary refs log tree commit diff
path: root/src/settings
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-03-30 00:56:30 +0200
committerMichael Biebl <biebl@debian.org>2016-03-30 00:56:30 +0200
commitd9c99a29a0d3384c9c3d2adce430f5cb1134ab6a (patch)
treefa41baf72753961e71dd8d5bdbe2b89c9109e4f1 /src/settings
parentc2de0d98ba39e0a1a970d066fd19be786092f376 (diff)
Imported Upstream version 1.1.92 upstream/1.1.92
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/nm-agent-manager.c9
-rw-r--r--src/settings/nm-settings-connection.c28
-rw-r--r--src/settings/nm-settings-plugin.c2
-rw-r--r--src/settings/nm-settings.c156
-rw-r--r--src/settings/nm-settings.h7
-rw-r--r--src/settings/plugins/ibft/tests/test-ibft.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/nm-ifcfg-rh.xml20
-rw-r--r--src/settings/plugins/ifcfg-rh/plugin.c6
-rw-r--r--src/settings/plugins/ifcfg-rh/reader.c64
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am1
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in1
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-sit-ignore12
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c56
-rw-r--r--src/settings/plugins/ifcfg-rh/utils.h2
-rw-r--r--src/settings/plugins/ifcfg-rh/writer.c7
-rw-r--r--src/settings/plugins/ifnet/connection_parser.c166
-rw-r--r--src/settings/plugins/ifnet/net_parser.c64
-rw-r--r--src/settings/plugins/ifnet/net_utils.c17
-rw-r--r--src/settings/plugins/ifnet/nm-ifnet-connection.c15
-rw-r--r--src/settings/plugins/ifnet/tests/test-ifnet.c18
-rw-r--r--src/settings/plugins/ifnet/wpa_parser.c45
-rw-r--r--src/settings/plugins/ifupdown/interface_parser.c49
-rw-r--r--src/settings/plugins/ifupdown/interface_parser.h2
-rw-r--r--src/settings/plugins/ifupdown/nm-ifupdown-connection.c117
-rw-r--r--src/settings/plugins/ifupdown/nm-ifupdown-connection.h4
-rw-r--r--src/settings/plugins/ifupdown/parser.c41
-rw-r--r--src/settings/plugins/ifupdown/parser.h2
-rw-r--r--src/settings/plugins/ifupdown/plugin.c36
-rw-r--r--src/settings/plugins/ifupdown/plugin.h2
-rw-r--r--src/settings/plugins/keyfile/plugin.c5
-rw-r--r--src/settings/plugins/keyfile/tests/test-keyfile.c146
-rw-r--r--src/settings/plugins/keyfile/utils.h2
32 files changed, 581 insertions, 523 deletions
diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c
index bc09e031..48a7da7b 100644
--- a/src/settings/nm-agent-manager.c
+++ b/src/settings/nm-agent-manager.c
@@ -263,8 +263,8 @@ agent_register_permissions_done (NMAuthChain *chain,
 	if (error) {
 		local = g_error_new (NM_AGENT_MANAGER_ERROR,
 		                     NM_AGENT_MANAGER_ERROR_PERMISSION_DENIED,
-		                     "Failed to request agent permissions: (%d) %s",
-		                     error->code, error->message);
+		                     "Failed to request agent permissions: %s",
+		                     error->message);
 		g_dbus_method_invocation_take_error (context, local);
 	} else {
 		agent = nm_auth_chain_steal_data (chain, "agent");
@@ -930,6 +930,7 @@ set_secrets_not_required (NMConnection *connection, GVariant *dict)
 				g_variant_unref (val);
 			}
 		}
+		g_variant_unref (setting_dict);
 	}
 }
 
@@ -987,9 +988,9 @@ _con_get_request_start_validated (NMAuthChain *chain,
 	req->con.chain = NULL;
 
 	if (error) {
-		_LOGD (req->current, "agent "LOG_REQ_FMT" MODIFY check error: (%d) %s",
+		_LOGD (req->current, "agent "LOG_REQ_FMT" MODIFY check error: %s",
 		       LOG_REQ_ARG (req),
-		       error->code, error->message ? error->message : "(unknown)");
+		       error->message);
 		/* Try the next agent */
 		request_next_agent (req);
 	} else {
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index a1695b34..6bed3fe5 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -883,10 +883,8 @@ new_secrets_commit_cb (NMSettingsConnection *self,
                        GError *error,
                        gpointer user_data)
 {
-	if (error) {
-		_LOGW ("Error saving new secrets to backing storage: (%d) %s",
-		       error->code, error->message ? error->message : "(unknown)");
-	}
+	if (error)
+		_LOGW ("Error saving new secrets to backing storage: %s", error->message);
 }
 
 static void
@@ -1086,19 +1084,17 @@ get_secrets_done_cb (NMAgentManager *manager,
 			}
 
 		} else {
-			_LOGD ("(%s:%p) failed to update with agent secrets: (%d) %s",
+			_LOGD ("(%s:%p) failed to update with agent secrets: %s",
 			       setting_name,
 			       info,
-			       local ? local->code : -1,
-			       (local && local->message) ? local->message : "(unknown)");
+			       local->message);
 		}
 		g_variant_unref (filtered_secrets);
 	} else {
-		_LOGD ("(%s:%p) failed to update with existing secrets: (%d) %s",
+		_LOGD ("(%s:%p) failed to update with existing secrets: %s",
 		       setting_name,
 		       info,
-		       local ? local->code : -1,
-		       (local && local->message) ? local->message : "(unknown)");
+		       local->message);
 	}
 
 	applied_connection = info->applied_connection;
@@ -1739,7 +1735,10 @@ settings_connection_update_helper (NMSettingsConnection *self,
 
 	/* Check if the settings are valid first */
 	if (new_settings) {
-		tmp = nm_simple_connection_new_from_dbus (new_settings, &error);
+		tmp = _nm_simple_connection_new_from_dbus (new_settings,
+		                                             NM_SETTING_PARSE_FLAGS_STRICT
+		                                           | NM_SETTING_PARSE_FLAGS_NORMALIZE,
+		                                           &error);
 		if (!tmp)
 			goto error;
 	}
@@ -2163,7 +2162,7 @@ nm_settings_connection_update_timestamp (NMSettingsConnection *self,
 	/* Save timestamp to timestamps database file */
 	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))
+		if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
 			_LOGW ("error parsing timestamps file '%s': %s", SETTINGS_TIMESTAMPS_FILE, error->message);
 		g_clear_error (&error);
 	}
@@ -2172,7 +2171,7 @@ nm_settings_connection_update_timestamp (NMSettingsConnection *self,
 	tmp = g_strdup_printf ("%" G_GUINT64_FORMAT, timestamp);
 	g_key_file_set_value (timestamps_file, "timestamps", connection_uuid, tmp);
 	g_free (tmp);
- 
+
 	data = g_key_file_to_data (timestamps_file, &len, &error);
 	if (data) {
 		g_file_set_contents (SETTINGS_TIMESTAMPS_FILE, data, len, &error);
@@ -2219,8 +2218,7 @@ nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *self)
 		priv->timestamp = timestamp;
 		priv->timestamp_set = TRUE;
 	} else {
-		_LOGD ("failed to read connection timestamp: (%d) %s",
-		       err->code, err->message);
+		_LOGD ("failed to read connection timestamp: %s", err->message);
 		g_clear_error (&err);
 	}
 	g_key_file_free (timestamps_file);
diff --git a/src/settings/nm-settings-plugin.c b/src/settings/nm-settings-plugin.c
index 2023bc17..7de7e597 100644
--- a/src/settings/nm-settings-plugin.c
+++ b/src/settings/nm-settings-plugin.c
@@ -175,5 +175,7 @@ nm_settings_plugin_add_connection (NMSettingsPlugin *config,
 	if (NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->add_connection)
 		return NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->add_connection (config, connection, save_to_disk, error);
 
+	g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_NOT_SUPPORTED,
+	                     "Plugin does not support adding connections");
 	return NULL;
 }
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index ee48e711..77e45f49 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -76,12 +76,15 @@
 
 #include "nmdbus-settings.h"
 
-#define LOG(level, ...) \
-	G_STMT_START { \
-		nm_log ((level), LOGD_CORE, \
-		        "settings: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__) \
-		        _NM_UTILS_MACRO_REST(__VA_ARGS__)); \
-	} G_STMT_END
+#define _NMLOG_DOMAIN         LOGD_SETTINGS
+#define _NMLOG_PREFIX_NAME    "settings"
+#define _NMLOG(level, ...) \
+    G_STMT_START { \
+        nm_log ((level), _NMLOG_DOMAIN, \
+                "%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
+                _NMLOG_PREFIX_NAME": " \
+                _NM_UTILS_MACRO_REST(__VA_ARGS__)); \
+    } G_STMT_END
 
 /* LINKER CRACKROCK */
 #define EXPORT(sym) void * __export_##sym = &sym;
@@ -652,8 +655,8 @@ add_plugin (NMSettings *self, NMSettingsPlugin *plugin)
 
 	path = g_object_get_data (G_OBJECT (plugin), PLUGIN_MODULE_PATH);
 
-	nm_log_info (LOGD_SETTINGS, "Loaded settings plugin %s: %s%s%s%s", pname, pinfo,
-	             NM_PRINT_FMT_QUOTED (path, " (", path, ")", ""));
+	_LOGI ("loaded plugin %s: %s%s%s%s", pname, pinfo,
+	       NM_PRINT_FMT_QUOTED (path, " (", path, ")", ""));
 	g_free (pname);
 	g_free (pinfo);
 
@@ -719,12 +722,12 @@ load_plugins (NMSettings *self, const char **plugins, GError **error)
 		GObject *obj;
 
 		if (!*pname || strchr (pname, '/')) {
-			LOG (LOGL_WARN, "ignore invalid plugin \"%s\"", pname);
+			_LOGW ("ignore invalid plugin \"%s\"", pname);
 			continue;
 		}
 
 		if (!strcmp (pname, "ifcfg-suse")) {
-			LOG (LOGL_WARN, "skipping deprecated plugin ifcfg-suse");
+			_LOGW ("skipping deprecated plugin ifcfg-suse");
 			continue;
 		}
 
@@ -767,25 +770,25 @@ load_plugin:
 
 			if (stat (path, &st) != 0) {
 				errsv = errno;
-				LOG (LOGL_WARN, "Could not load plugin '%s' from file '%s': %s", pname, path, strerror (errsv));
+				_LOGW ("could not load plugin '%s' from file '%s': %s", pname, path, strerror (errsv));
 				goto next;
 			}
 			if (!S_ISREG (st.st_mode)) {
-				LOG (LOGL_WARN, "Could not load plugin '%s' from file '%s': not a file", pname, path);
+				_LOGW ("could not load plugin '%s' from file '%s': not a file", pname, path);
 				goto next;
 			}
 			if (st.st_uid != 0) {
-				LOG (LOGL_WARN, "Could not load plugin '%s' from file '%s': file must be owned by root", pname, path);
+				_LOGW ("could not load plugin '%s' from file '%s': file must be owned by root", pname, path);
 				goto next;
 			}
 			if (st.st_mode & (S_IWGRP | S_IWOTH | S_ISUID)) {
-				LOG (LOGL_WARN, "Could not load plugin '%s' from file '%s': invalid file permissions", pname, path);
+				_LOGW ("could not load plugin '%s' from file '%s': invalid file permissions", pname, path);
 				goto next;
 			}
 
 			plugin = g_module_open (path, G_MODULE_BIND_LOCAL);
 			if (!plugin) {
-				LOG (LOGL_WARN, "Could not load plugin '%s' from file '%s': %s",
+				_LOGW ("could not load plugin '%s' from file '%s': %s",
 				     pname, path, g_module_error ());
 				goto next;
 			}
@@ -985,8 +988,7 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection)
 	}
 
 	if (!nm_connection_normalize (NM_CONNECTION (connection), NULL, NULL, &error)) {
-		nm_log_warn (LOGD_SETTINGS, "plugin provided invalid connection: %s",
-		             error->message);
+		_LOGW ("plugin provided invalid connection: %s", error->message);
 		g_error_free (error);
 		return;
 	}
@@ -1003,8 +1005,8 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection)
 		 * without the individual plugins being aware. Don't handle that at all, just
 		 * error out. That should not happen unless the admin misconfigured the system
 		 * to create conflicting connections. */
-		nm_log_warn (LOGD_SETTINGS, "plugin provided duplicate connection with UUID %s",
-		             nm_settings_connection_get_uuid (connection));
+		_LOGW ("plugin provided duplicate connection with UUID %s",
+		       nm_settings_connection_get_uuid (connection));
 		return;
 	}
 
@@ -1117,10 +1119,10 @@ nm_settings_add_connection (NMSettings *self,
 			claim_connection (self, added);
 			return added;
 		}
-		nm_log_dbg (LOGD_SETTINGS, "Failed to add %s/'%s': %s",
-		            nm_connection_get_uuid (connection),
-		            nm_connection_get_id (connection),
-		            add_error ? add_error->message : "(unknown)");
+		_LOGD ("Failed to add %s/'%s': %s",
+		       nm_connection_get_uuid (connection),
+		       nm_connection_get_id (connection),
+		       add_error->message);
 		g_clear_error (&add_error);
 	}
 
@@ -1211,7 +1213,7 @@ pk_add_cb (NMAuthChain *chain,
 		error = g_error_new (NM_SETTINGS_ERROR,
 		                     NM_SETTINGS_ERROR_FAILED,
 		                     "Error checking authorization: %s",
-		                     chain_error->message ? chain_error->message : "(unknown)");
+		                     chain_error->message);
 	} else if (result != NM_AUTH_CALL_RESULT_YES) {
 		error = g_error_new_literal (NM_SETTINGS_ERROR,
 		                             NM_SETTINGS_ERROR_PERMISSION_DENIED,
@@ -1294,7 +1296,7 @@ nm_settings_add_connection_dbus (NMSettings *self,
 		error = g_error_new (NM_SETTINGS_ERROR,
 		                     NM_SETTINGS_ERROR_INVALID_CONNECTION,
 		                     "The connection was invalid: %s",
-		                     tmp_error ? tmp_error->message : "(unknown)");
+		                     tmp_error->message);
 		g_error_free (tmp_error);
 		goto done;
 	}
@@ -1405,7 +1407,10 @@ impl_settings_add_connection_helper (NMSettings *self,
 	NMConnection *connection;
 	GError *error = NULL;
 
-	connection = nm_simple_connection_new_from_dbus (settings, &error);
+	connection = _nm_simple_connection_new_from_dbus (settings,
+	                                                    NM_SETTING_PARSE_FLAGS_STRICT
+	                                                  | NM_SETTING_PARSE_FLAGS_NORMALIZE,
+	                                                  &error);
 
 	if (connection) {
 		if (!nm_connection_verify_secrets (connection, &error))
@@ -1492,7 +1497,7 @@ impl_settings_load_connections (NMSettings *self,
 
 		if (!iter) {
 			if (!g_path_is_absolute (filenames[i]))
-				nm_log_warn (LOGD_SETTINGS, "Connection filename '%s' is not an absolute path", filenames[i]);
+				_LOGW ("connection filename '%s' is not an absolute path", filenames[i]);
 			g_ptr_array_add (failures, (char *) filenames[i]);
 		}
 	}
@@ -1525,6 +1530,65 @@ impl_settings_reload_connections (NMSettings *self,
 	g_dbus_method_invocation_return_value (context, g_variant_new ("(b)", TRUE));
 }
 
+typedef struct {
+	char *hostname;
+	NMSettingsSetHostnameCb cb;
+	gpointer user_data;
+} SetHostnameInfo;
+
+static void
+set_transient_hostname_done (GObject *object,
+                             GAsyncResult *res,
+                             gpointer user_data)
+{
+	GDBusProxy *proxy = G_DBUS_PROXY (object);
+	gs_free SetHostnameInfo *info = user_data;
+	gs_unref_variant GVariant *result = NULL;
+	gs_free_error GError *error = NULL;
+
+	result = g_dbus_proxy_call_finish (proxy, res, &error);
+
+	if (error) {
+		_LOGW ("couldn't set the system hostname to '%s' using hostnamed: %s",
+		       info->hostname, error->message);
+	}
+
+	info->cb (info->hostname, !error, info->user_data);
+	g_free (info->hostname);
+}
+
+void
+nm_settings_set_transient_hostname (NMSettings *self,
+                                    const char *hostname,
+                                    NMSettingsSetHostnameCb cb,
+                                    gpointer user_data)
+{
+	NMSettingsPrivate *priv;
+	SetHostnameInfo *info;
+
+	g_return_if_fail (NM_IS_SETTINGS (self));
+	priv = NM_SETTINGS_GET_PRIVATE (self);
+
+	if (!priv->hostname.hostnamed_proxy) {
+		cb (hostname, FALSE, user_data);
+		return;
+	}
+
+	info = g_new0 (SetHostnameInfo, 1);
+	info->hostname = g_strdup (hostname);
+	info->cb = cb;
+	info->user_data = user_data;
+
+	g_dbus_proxy_call (priv->hostname.hostnamed_proxy,
+	                   "SetHostname",
+	                   g_variant_new ("(sb)", hostname, FALSE),
+	                   G_DBUS_CALL_FLAGS_NONE,
+	                   -1,
+	                   NULL,
+	                   set_transient_hostname_done,
+	                   info);
+}
+
 static gboolean
 write_hostname (NMSettingsPrivate *priv, const char *hostname)
 {
@@ -1549,7 +1613,7 @@ write_hostname (NMSettingsPrivate *priv, const char *hostname)
 		                              NULL,
 		                              &error);
 		if (error)
-			nm_log_warn (LOGD_SETTINGS, "Could not set hostname: %s", error->message);
+			_LOGW ("could not set hostname: %s", error->message);
 
 		return !error;
 	}
@@ -1595,7 +1659,7 @@ write_hostname (NMSettingsPrivate *priv, const char *hostname)
 	g_free (hostname_eol);
 
 	if (!ret) {
-		nm_log_warn (LOGD_SETTINGS, "Could not save hostname to %s: %s", file, error->message);
+		_LOGW ("could not save hostname to %s: %s", file, error->message);
 		return FALSE;
 	}
 
@@ -1625,7 +1689,7 @@ pk_hostname_cb (NMAuthChain *chain,
 		error = g_error_new (NM_SETTINGS_ERROR,
 		                     NM_SETTINGS_ERROR_FAILED,
 		                     "Error checking authorization: %s",
-		                     chain_error->message ? chain_error->message : "(unknown)");
+		                     chain_error->message);
 	} else if (result != NM_AUTH_CALL_RESULT_YES) {
 		error = g_error_new_literal (NM_SETTINGS_ERROR,
 		                             NM_SETTINGS_ERROR_PERMISSION_DENIED,
@@ -1721,9 +1785,9 @@ hostname_maybe_changed (NMSettings *settings)
 	    || (!new_hostname && priv->hostname.value)
 	    || (priv->hostname.value && new_hostname && strcmp (priv->hostname.value, new_hostname))) {
 
-		nm_log_info (LOGD_SETTINGS, "hostname changed from %s%s%s to %s%s%s",
-		             NM_PRINT_FMT_QUOTED (priv->hostname.value, "\"", priv->hostname.value, "\"", "(none)"),
-		             NM_PRINT_FMT_QUOTED (new_hostname, "\"", new_hostname, "\"", "(none)"));
+		_LOGI ("hostname changed from %s%s%s to %s%s%s",
+		       NM_PRINT_FMT_QUOTED (priv->hostname.value, "\"", priv->hostname.value, "\"", "(none)"),
+		       NM_PRINT_FMT_QUOTED (new_hostname, "\"", new_hostname, "\"", "(none)"));
 		g_free (priv->hostname.value);
 		priv->hostname.value = new_hostname;
 		g_object_notify (G_OBJECT (settings), NM_SETTINGS_HOSTNAME);
@@ -1894,9 +1958,9 @@ device_realized (NMDevice *device, GParamSpec *pspec, NMSettings *self)
 	g_object_unref (connection);
 
 	if (!added) {
-		nm_log_warn (LOGD_SETTINGS, "(%s) couldn't create default wired connection: %s",
-		             nm_device_get_iface (device),
-		             (error && error->message) ? error->message : "(unknown)");
+		_LOGW ("(%s) couldn't create default wired connection: %s",
+		       nm_device_get_iface (device),
+		       error->message);
 		g_clear_error (&error);
 		return;
 	}
@@ -1909,9 +1973,9 @@ device_realized (NMDevice *device, GParamSpec *pspec, NMSettings *self)
 	g_signal_connect (added, NM_SETTINGS_CONNECTION_REMOVED,
 	                  G_CALLBACK (default_wired_connection_removed_cb), self);
 
-	nm_log_info (LOGD_SETTINGS, "(%s): created default wired connection '%s'",
-	             nm_device_get_iface (device),
-	             nm_settings_connection_get_id (added));
+	_LOGI ("(%s): created default wired connection '%s'",
+	       nm_device_get_iface (device),
+	       nm_settings_connection_get_id (added));
 }
 
 void
@@ -2080,9 +2144,9 @@ hostnamed_properties_changed (GDBusProxy *proxy,
 	hostname = g_variant_get_string (v_hostname, NULL);
 
 	if (g_strcmp0 (priv->hostname.value, hostname) != 0) {
-		nm_log_info (LOGD_SETTINGS, "hostname changed from %s%s%s to %s%s%s",
-		             NM_PRINT_FMT_QUOTED (priv->hostname.value, "\"", priv->hostname.value, "\"", "(none)"),
-		             NM_PRINT_FMT_QUOTED (hostname, "\"", hostname, "\"", "(none)"));
+		_LOGI ("hostname changed from %s%s%s to %s%s%s",
+		       NM_PRINT_FMT_QUOTED (priv->hostname.value, "\"", priv->hostname.value, "\"", "(none)"),
+		       NM_PRINT_FMT_QUOTED (hostname, "\"", hostname, "\"", "(none)"));
 		g_free (priv->hostname.value);
 		priv->hostname.value = g_strdup (hostname);
 		g_object_notify (G_OBJECT (user_data), NM_SETTINGS_HOSTNAME);
@@ -2170,19 +2234,19 @@ nm_settings_start (NMSettings *self, GError **error)
 	if (proxy) {
 		variant = g_dbus_proxy_get_cached_property (proxy, "StaticHostname");
 		if (variant) {
-			nm_log_info (LOGD_SETTINGS, "hostname: using hostnamed");
+			_LOGI ("hostname: using hostnamed");
 			priv->hostname.hostnamed_proxy = proxy;
 			g_signal_connect (proxy, "g-properties-changed",
 			                  G_CALLBACK (hostnamed_properties_changed), self);
 			hostnamed_properties_changed (proxy, NULL, NULL, self);
 			g_variant_unref (variant);
 		} else {
-			nm_log_info (LOGD_SETTINGS, "hostname: couldn't get property from hostnamed");
+			_LOGI ("hostname: couldn't get property from hostnamed");
 			g_object_unref (proxy);
 		}
 	} else {
-		nm_log_info (LOGD_SETTINGS, "hostname: hostnamed not used as proxy creation failed with: %s",
-		             local_error->message);
+		_LOGI ("hostname: hostnamed not used as proxy creation failed with: %s",
+		       local_error->message);
 		g_clear_error (&local_error);
 	}
 
diff --git a/src/settings/nm-settings.h b/src/settings/nm-settings.h
index 923b164b..051c2094 100644
--- a/src/settings/nm-settings.h
+++ b/src/settings/nm-settings.h
@@ -71,6 +71,8 @@ typedef struct {
 	void (*agent_registered) (NMSettings *self, NMSecretAgent *agent);
 } NMSettingsClass;
 
+typedef void (*NMSettingsSetHostnameCb) (const char *name, gboolean result, gpointer user_data);
+
 GType nm_settings_get_type (void);
 
 NMSettings *nm_settings_new (void);
@@ -127,4 +129,9 @@ gint nm_settings_sort_connections (gconstpointer a, gconstpointer b);
 
 gboolean nm_settings_get_startup_complete (NMSettings *self);
 
+void nm_settings_set_transient_hostname (NMSettings *self,
+                                         const char *hostname,
+                                         NMSettingsSetHostnameCb cb,
+                                         gpointer user_data);
+
 #endif  /* __NM_SETTINGS_H__ */
diff --git a/src/settings/plugins/ibft/tests/test-ibft.c b/src/settings/plugins/ibft/tests/test-ibft.c
index a9085478..9c98d891 100644
--- a/src/settings/plugins/ibft/tests/test-ibft.c
+++ b/src/settings/plugins/ibft/tests/test-ibft.c
@@ -181,7 +181,7 @@ test_read_ibft_malformed (gconstpointer user_data)
 
 	g_assert (g_file_test (iscsiadm_path, G_FILE_TEST_EXISTS));
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING, "*malformed iscsiadm record*");
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE, "*malformed iscsiadm record*");
 
 	success = read_ibft_blocks (iscsiadm_path, &blocks, &error);
 	g_assert_no_error (error);
diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-rh.xml b/src/settings/plugins/ifcfg-rh/nm-ifcfg-rh.xml
index 1f308dd4..c2a6cb34 100644
--- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-rh.xml
+++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-rh.xml
@@ -2,28 +2,28 @@
 
 <node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
     <interface name="com.redhat.ifcfgrh1">
-      <tp:docstring>
+      <annotation name="org.gtk.GDBus.DocString" value="
           Utility methods for handling NM integration with standard Red Hat ifcfg files.
-      </tp:docstring>
+      " />
 
       <method name="GetIfcfgDetails">
-        <tp:docstring>
+        <annotation name="org.gtk.GDBus.DocString" value="
           Given an ifcfg file, return various internal information about it.
-        </tp:docstring>
+        " />
         <arg name="ifcfg" type="s" direction="in">
-          <tp:docstring>
+          <annotation name="org.gtk.GDBus.DocString" value="
             The full path to an ifcfg file.
-          </tp:docstring>
+          " />
         </arg>
         <arg name="uuid" type="s" direction="out">
-          <tp:docstring>
+          <annotation name="org.gtk.GDBus.DocString" value="
             The UUID of the NM connection backed by this ifcfg file.  If the ifcfg file does not contain a UUID tag, this UUID is generated by NM, otherwise the UUID from the ifcfg file is used.
-          </tp:docstring>
+          " />
         </arg>
         <arg name="path" type="o" direction="out">
-          <tp:docstring>
+          <annotation name="org.gtk.GDBus.DocString" value="
             The object path of the NM connected backed by this ifcfg file.
-          </tp:docstring>
+          " />
         </arg>
       </method>
     </interface>
diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c
index d28e3bf6..1fb6b789 100644
--- a/src/settings/plugins/ifcfg-rh/plugin.c
+++ b/src/settings/plugins/ifcfg-rh/plugin.c
@@ -207,8 +207,10 @@ update_connection (SettingsPluginIfcfg *self,
 		    && !protect_existing_connection
 		    && (!protected_connections || !g_hash_table_contains (protected_connections, connection)))
 			remove_connection (self, connection);
-		if (!source && !ignore_error)
-			_LOGW ("loading \"%s\" fails: %s", full_path, local ? local->message : "(unknown reason)");
+		if (!source) {
+			_NMLOG (ignore_error ? LOGL_DEBUG : LOGL_WARN,
+			        "loading \"%s\" fails: %s", full_path, local ? local->message : "(unknown reason)");
+		}
 		g_propagate_error (error, local);
 		return NULL;
 	}
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index ca512fc6..41ffa27d 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -3076,6 +3076,13 @@ fill_8021x (shvarFile *ifcfg,
 	read_8021x_list_value (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES",
 	                       s_8021x, NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
 
+	value = svGetValue (ifcfg, "IEEE_8021X_DOMAIN_SUFFIX_MATCH", FALSE);
+	g_object_set (s_8021x, NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, value, NULL);
+	g_free (value);
+	value = svGetValue (ifcfg, "IEEE_8021X_PHASE2_DOMAIN_SUFFIX_MATCH", FALSE);
+	g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_DOMAIN_SUFFIX_MATCH, value, NULL);
+	g_free (value);
+
 	if (list)
 		g_strfreev (list);
 	if (keys)
@@ -4993,14 +5000,24 @@ connection_from_file_full (const char *filename,
 		type = svGetValue (parsed, "TYPE", FALSE);
 
 	if (!type) {
+		gs_free char *tmp = NULL;
 		char *device;
 
+		if ((tmp = svGetValue (parsed, "IPV6TUNNELIPV4", FALSE))) {
+			if (out_ignore_error)
+				*out_ignore_error = TRUE;
+			g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
+			             "Ignoring unsupported connection due to IPV6TUNNELIPV4");
+			goto done;
+		}
+
 		device = svGetValue (parsed, "DEVICE", FALSE);
 		if (!device) {
 			g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 			             "File '%s' had neither TYPE nor DEVICE keys.", filename);
 			goto done;
 		}
+		g_assert (device[0]);
 
 		if (!strcmp (device, "lo")) {
 			if (out_ignore_error)
@@ -5018,8 +5035,51 @@ connection_from_file_full (const char *filename,
 				type = g_strdup (TYPE_VLAN);
 			else if (is_wifi_device (device, parsed))
 				type = g_strdup (TYPE_WIRELESS);
-			else
-				type = g_strdup (TYPE_ETHERNET);
+			else {
+				gs_free char *p_path = NULL;
+				char *p_device;
+				gsize i;
+
+				/* network-functions detects DEVICETYPE based on the ifcfg-* name and the existence
+				 * of a ifup script:
+				 *    [ -z "$DEVICETYPE" ] && DEVICETYPE=$(echo ${DEVICE} | sed "s/[0-9]*$//")
+				 * later...
+				 *    OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${DEVICETYPE}"
+				 * */
+#define IFUP_PATH_PREFIX "/etc/sysconfig/network-scripts/ifup-"
+				i = strlen (device);
+				p_path = g_malloc (NM_STRLEN (IFUP_PATH_PREFIX) + i + 1);
+				p_device = &p_path[NM_STRLEN (IFUP_PATH_PREFIX)];
+				memcpy (p_device, device, i + 1);
+
+				/* strip trailing numbers */
+				while (i >= 1) {
+					i--;
+					if (p_device[i] < '0' || p_device[i] > '9')
+						break;
+					p_device[i] = '\0';
+				}
+
+				if (nm_streq (p_device, "eth"))
+					type = g_strdup (TYPE_ETHERNET);
+				else if (nm_streq (p_device, "wireless"))
+					type = g_strdup (TYPE_WIRELESS);
+				else if (p_device[0]) {
+					memcpy (p_path, IFUP_PATH_PREFIX, NM_STRLEN (IFUP_PATH_PREFIX));
+					if (access (p_path, X_OK) == 0) {
+						/* for all other types, this is not something we want to handle. */
+						if (out_ignore_error)
+							*out_ignore_error = TRUE;
+						g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
+						             "Ignore script for unknown device type which has a matching %s script",
+						             p_path);
+						goto done;
+					}
+				}
+
+				if (!type)
+					type = g_strdup (TYPE_ETHERNET);
+			}
 		} else {
 			/* For the unit tests, there won't necessarily be any
 			 * adapters of the connection's type in the system so the
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 36e52af4..fc759e6d 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
@@ -77,6 +77,7 @@ EXTRA_DIST = \
 	ifcfg-test-ibft \
 	ifcfg-test-static-routes-legacy \
 	route-test-static-routes-legacy \
+	ifcfg-test-sit-ignore \
 	ifcfg-test-wired-static-routes \
 	route-test-wired-static-routes \
 	ifcfg-test-wired-static-routes-legacy \
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 2152961c..e98ea93c 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in
@@ -473,6 +473,7 @@ EXTRA_DIST = \
 	ifcfg-test-ibft \
 	ifcfg-test-static-routes-legacy \
 	route-test-static-routes-legacy \
+	ifcfg-test-sit-ignore \
 	ifcfg-test-wired-static-routes \
 	route-test-wired-static-routes \
 	ifcfg-test-wired-static-routes-legacy \
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-sit-ignore b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-sit-ignore
new file mode 100644
index 00000000..a2581db6
--- /dev/null
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-sit-ignore
@@ -0,0 +1,12 @@
+# this ifcfg-file represents a "sit" type without explicit TYPE.
+# Such connection types are not supported by NetworkManager and
+# the connection should be ignored based on the presence of
+# IPV6TUNNELIPV4.
+
+DEVICE=sit1
+BOOTPROTO=none
+ONBOOT=yes
+IPV6INIT=yes
+IPV6TUNNELIPV4=5.4.3.6
+IPV6TUNNELIPV4LOCAL=172.17.1.9
+IPV6ADDR=2001:470:2:3:4::2/64
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 8ca5c8bb..5ed25fda 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -310,7 +310,7 @@ test_read_miscellaneous_variables (void)
 	int mac_blacklist_num, i;
 	guint64 expected_timestamp = 0;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*invalid MAC in HWADDR_BLACKLIST 'XX:aa:invalid'*");
 	connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-misc-variables",
 	                                    NULL, TYPE_ETHERNET, NULL);
@@ -563,7 +563,7 @@ test_read_wired_static_no_prefix (gconstpointer user_data)
 	file = g_strdup_printf (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wired-static-no-prefix-%u", expected_prefix);
 	expected_id = g_strdup_printf ("System test-wired-static-no-prefix-%u", expected_prefix);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*missing PREFIX, assuming*");
 	connection = _connection_from_file (file, NULL, TYPE_ETHERNET, NULL);
 	g_test_assert_expected_messages ();
@@ -785,7 +785,7 @@ test_read_wired_global_gateway_ignore (void)
 	NMSettingIPConfig *s_ip4;
 	char *unmanaged = NULL;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*ignoring GATEWAY (/etc/sysconfig/network) for * because the connection has no static addresses");
 	connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-global-gateway-ignore",
 	                                    TEST_IFCFG_DIR"/network-scripts/network-test-wired-global-gateway-ignore",
@@ -1120,7 +1120,7 @@ test_read_wired_ipv6_manual (void)
 	NMIPAddress *ip6_addr;
 	NMIPRoute *ip6_route;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*ignoring manual default route*");
 	connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv6-manual",
 	                                    NULL, TYPE_ETHERNET, &unmanaged);
@@ -1492,7 +1492,7 @@ test_read_write_802_1X_subj_matches (void)
 	NMSetting8021x *s_8021x;
 	char *written = NULL;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*missing IEEE_8021X_CA_CERT*peap*");
 	connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-802-1X-subj-matches",
 	                                    NULL, TYPE_ETHERNET, NULL);
@@ -1518,7 +1518,7 @@ test_read_write_802_1X_subj_matches (void)
 	                        TEST_SCRATCH_DIR "/network-scripts/",
 	                        &written);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*missing IEEE_8021X_CA_CERT*peap*");
 	reread = _connection_from_file (written, NULL, TYPE_ETHERNET, NULL);
 	g_test_assert_expected_messages ();
@@ -1683,7 +1683,7 @@ test_read_wired_aliases_bad (const char *base, const char *expected_id)
 static void
 test_read_wired_aliases_bad_1 (void)
 {
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*aliasem1:1*has no DEVICE*");
 	test_read_wired_aliases_bad (TEST_IFCFG_DIR "/network-scripts/ifcfg-aliasem1", "System aliasem1");
 }
@@ -1691,7 +1691,7 @@ test_read_wired_aliases_bad_1 (void)
 static void
 test_read_wired_aliases_bad_2 (void)
 {
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*aliasem2:1*has invalid DEVICE*");
 	test_read_wired_aliases_bad (TEST_IFCFG_DIR "/network-scripts/ifcfg-aliasem2", "System aliasem2");
 }
@@ -3560,9 +3560,6 @@ test_write_wired_static (void)
 	                        TEST_SCRATCH_DIR "/network-scripts/",
 	                        &testfile);
 
-	/* reread will be normalized, so we must normalize connection too. */
-	nm_connection_normalize (connection, NULL, NULL, NULL);
-
 	reread = _connection_from_file (testfile, NULL, TYPE_ETHERNET, NULL);
 	unlink (testfile);
 
@@ -7329,7 +7326,7 @@ test_read_vlan_reorder_hdr_1 (void)
 	NMConnection *connection;
 	NMSettingVlan *s_vlan;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*REORDER_HDR key is deprecated, use VLAN_FLAGS*");
 	connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-reorder-hdr-1",
 	                                        NULL, TYPE_ETHERNET, NULL);
@@ -8167,7 +8164,7 @@ test_read_dcb_bad_booleans (void)
 {
 	gs_free_error GError *error = NULL;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*invalid DCB_PG_STRICT value*not all 0s and 1s*");
 	_connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-bad-booleans",
 	                            NULL, TYPE_ETHERNET, &error);
@@ -8182,7 +8179,7 @@ test_read_dcb_short_booleans (void)
 {
 	gs_free_error GError *error = NULL;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*DCB_PG_STRICT value*8 characters*");
 	_connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-short-booleans",
 	                            NULL, TYPE_ETHERNET, &error);
@@ -8197,7 +8194,7 @@ test_read_dcb_bad_uints (void)
 {
 	gs_free_error GError *error = NULL;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*invalid DCB_PG_UP2TC value*not 0 - 7*");
 	_connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-bad-uints",
 	                            NULL, TYPE_ETHERNET, &error);
@@ -8212,7 +8209,7 @@ test_read_dcb_short_uints (void)
 {
 	gs_free_error GError *error = NULL;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*DCB_PG_UP2TC value*8 characters*");
 	_connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-short-uints",
 	                            NULL, TYPE_ETHERNET, &error);
@@ -8227,7 +8224,7 @@ test_read_dcb_bad_percent (void)
 {
 	gs_free_error GError *error = NULL;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*invalid DCB_PG_PCT percentage value*");
 	_connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-bad-percent",
 	                            NULL, TYPE_ETHERNET, &error);
@@ -8242,7 +8239,7 @@ test_read_dcb_short_percent (void)
 {
 	gs_free_error GError *error = NULL;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*invalid DCB_PG_PCT percentage list value*");
 	_connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-short-percent",
 	                            NULL, TYPE_ETHERNET, &error);
@@ -8257,7 +8254,7 @@ test_read_dcb_pgpct_not_100 (void)
 {
 	gs_free_error GError *error = NULL;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*DCB_PG_PCT percentages do not equal 100*");
 	_connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-dcb-pgpct-not-100",
 	                            NULL, TYPE_ETHERNET, &error);
@@ -8738,6 +8735,20 @@ test_read_vlan_trailing_spaces (void)
 	g_object_unref (connection);
 }
 
+/*****************************************************************************/
+
+static void
+test_sit_read_ignore (void)
+{
+	gs_free_error GError *error = NULL;
+
+	_connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-sit-ignore",
+	                            NULL, TYPE_ETHERNET, &error);
+	nmtst_assert_error (error, 0, 0, "*Ignoring unsupported connection due to IPV6TUNNELIPV4*");
+}
+
+/*****************************************************************************/
+
 
 #define TPATH "/settings/plugins/ifcfg-rh/"
 
@@ -8937,10 +8948,8 @@ int main (int argc, char **argv)
 	g_test_add_func (TPATH "wired/write-missing-ipv6", test_write_ethernet_missing_ipv6);
 	g_test_add_func (TPATH "write-dns-options", test_write_dns_options);
 
-	/* iSCSI / ibft */
 	g_test_add_func (TPATH "ibft/ignored", test_read_ibft_ignored);
 
-	/* Data Center Bridging (DCB) */
 	g_test_add_func (TPATH "dcb/read-basic", test_read_dcb_basic);
 	g_test_add_func (TPATH "dcb/write-basic", test_write_dcb_basic);
 	g_test_add_func (TPATH "dcb/default-app-priorities", test_read_dcb_default_app_priorities);
@@ -8956,7 +8965,6 @@ int main (int argc, char **argv)
 	g_test_add_data_func (TPATH "fcoe/write-fabric", (gpointer) NM_SETTING_DCB_FCOE_MODE_FABRIC, test_write_fcoe_mode);
 	g_test_add_data_func (TPATH "fcoe/write-vn2vn", (gpointer) NM_SETTING_DCB_FCOE_MODE_VN2VN, test_write_fcoe_mode);
 
-	/* bonding */
 	g_test_add_func (TPATH "bond/read-master", test_read_bond_main);
 	g_test_add_func (TPATH "bond/read-slave", test_read_bond_slave);
 	g_test_add_func (TPATH "bond/read-slave-ib", test_read_bond_slave_ib);
@@ -8965,20 +8973,20 @@ int main (int argc, char **argv)
 	g_test_add_func (TPATH "bond/write-slave-ib", test_write_bond_slave_ib);
 	g_test_add_func (TPATH "bond/bonding-opts-numeric-mode", test_read_bond_opts_mode_numeric);
 
-	/* bridging */
 	g_test_add_func (TPATH "bridge/read-master", test_read_bridge_main);
 	g_test_add_func (TPATH "bridge/write-master", test_write_bridge_main);
 	g_test_add_func (TPATH "bridge/read-component", test_read_bridge_component);
 	g_test_add_func (TPATH "bridge/write-component", test_write_bridge_component);
 	g_test_add_func (TPATH "bridge/read-missing-stp", test_read_bridge_missing_stp);
 
-	/* Team */
 	g_test_add_func (TPATH "team/read-master", test_read_team_master);
 	g_test_add_func (TPATH "team/write-master", test_write_team_master);
 	g_test_add_func (TPATH "team/read-port", test_read_team_port);
 	g_test_add_func (TPATH "team/write-port", test_write_team_port);
 	g_test_add_func (TPATH "team/read-port-empty-config", test_read_team_port_empty_config);
 
+	g_test_add_func (TPATH "sit/read/ignore", test_sit_read_ignore);
+
 	/* Stuff we expect to fail for now */
 	g_test_add_func (TPATH "pppoe/write-wired", test_write_wired_pppoe);
 	g_test_add_func (TPATH "vpn/write", test_write_vpn);
diff --git a/src/settings/plugins/ifcfg-rh/utils.h b/src/settings/plugins/ifcfg-rh/utils.h
index 329f4547..752d08a6 100644
--- a/src/settings/plugins/ifcfg-rh/utils.h
+++ b/src/settings/plugins/ifcfg-rh/utils.h
@@ -26,7 +26,7 @@
 #include "shvar.h"
 #include "common.h"
 
-#define NM_IFCFG_CONNECTION_LOG_PATH(path)  str_if_set (path,"in-memory")
+#define NM_IFCFG_CONNECTION_LOG_PATH(path)  ((path) ?: "in-memory")
 #define NM_IFCFG_CONNECTION_LOG_FMT         "%s (%s,\"%s\")"
 #define NM_IFCFG_CONNECTION_LOG_ARG(con)    NM_IFCFG_CONNECTION_LOG_PATH (nm_settings_connection_get_filename ((NMSettingsConnection *) (con))), nm_connection_get_uuid ((NMConnection *) (con)), nm_connection_get_id ((NMConnection *) (con))
 #define NM_IFCFG_CONNECTION_LOG_FMTD        "%s (%s,\"%s\",%p)"
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index e7d64379..c17824d6 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -582,6 +582,13 @@ write_8021x_setting (NMConnection *connection,
 		svSetValue (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES", str->str, FALSE);
 	g_string_free (str, TRUE);
 
+	svSetValue (ifcfg, "IEEE_8021X_DOMAIN_SUFFIX_MATCH",
+	            nm_setting_802_1x_get_domain_suffix_match (s_8021x),
+	            FALSE);
+	svSetValue (ifcfg, "IEEE_8021X_PHASE2_DOMAIN_SUFFIX_MATCH",
+	            nm_setting_802_1x_get_phase2_domain_suffix_match (s_8021x),
+	            FALSE);
+
 	success = write_8021x_certs (s_8021x, FALSE, ifcfg, error);
 	if (success) {
 		/* phase2/inner certs */
diff --git a/src/settings/plugins/ifnet/connection_parser.c b/src/settings/plugins/ifnet/connection_parser.c
index bf8b9a42..d9ff97dc 100644
--- a/src/settings/plugins/ifnet/connection_parser.c
+++ b/src/settings/plugins/ifnet/connection_parser.c
@@ -362,11 +362,17 @@ eap_peap_reader (const char *eap_method,
 		}
 
 		pos = strchr (*iter, '=');
-		pos++;
-		lower = g_ascii_strdown (pos, -1);
-		g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, lower,
-			      NULL);
-		g_free (lower);
+		if (pos && *pos) {
+			pos++;
+			lower = g_ascii_strdown (pos, -1);
+			g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, lower,
+				      NULL);
+			g_free (lower);
+		} else {
+			g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
+				     "No IEEE_8021X_INNER_AUTH_METHOD.");
+			goto done;
+		}
 		break;
 	}
 
@@ -513,7 +519,7 @@ read_mac_address (const char *conn_name, const char **mac, GError **error)
 	return TRUE;
 }
 
-static void
+static gboolean
 make_wired_connection_setting (NMConnection *connection,
                                const char *conn_name,
                                GError **error)
@@ -538,22 +544,21 @@ make_wired_connection_setting (NMConnection *connection,
 				      (guint32) mtu, NULL);
 	}
 
-	if (read_mac_address (conn_name, &mac, error)) {
-		if (mac) {
-			g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS,
-				      mac, NULL);
-		}
-	} else {
+	if (!read_mac_address (conn_name, &mac, error)) {
 		g_object_unref (s_wired);
-		s_wired = NULL;
+		return FALSE;
 	}
-	if (s_wired)
-		nm_connection_add_setting (connection, NM_SETTING (s_wired));
+
+	if (mac)
+		g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, mac, NULL);
+	nm_connection_add_setting (connection, NM_SETTING (s_wired));
+
+	return TRUE;
 }
 
 /* add NM_SETTING_IP_CONFIG_DHCP_HOSTNAME,
  * NM_SETTING_IP_CONFIG_DHCP_CLIENT_ID in future*/
-static void
+static gboolean
 make_ip4_setting (NMConnection *connection,
                   const char *conn_name,
                   GError **error)
@@ -578,7 +583,7 @@ make_ip4_setting (NMConnection *connection,
 			g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 						 "Unknown config for %s", conn_name);
 			g_object_unref (ip4_setting);
-			return;
+			return FALSE;
 		}
 		if (strstr (method, "dhcp"))
 			g_object_set (ip4_setting,
@@ -591,19 +596,19 @@ make_ip4_setting (NMConnection *connection,
 						  NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
 						  NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL);
 			nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
-			return;
+			return TRUE;
 		} else if (strstr (method, "shared")) {
 			g_object_set (ip4_setting,
 						  NM_SETTING_IP_CONFIG_METHOD,
 						  NM_SETTING_IP4_CONFIG_METHOD_SHARED,
 						  NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL);
 			nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
-			return;
+			return TRUE;
 		} else {
 			g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 						 "Unknown config for %s", conn_name);
 			g_object_unref (ip4_setting);
-			return;
+			return FALSE;
 		}
 		nm_log_info (LOGD_SETTINGS, "Using %s method for %s", method, conn_name);
 	}else {
@@ -613,7 +618,7 @@ make_ip4_setting (NMConnection *connection,
 				     "Ifnet plugin: can't aquire ip configuration for %s",
 				     conn_name);
 			g_object_unref (ip4_setting);
-			return;
+			return FALSE;
 		}
 		/************** add all ip settings to the connection**********/
 		while (iblock) {
@@ -735,9 +740,11 @@ make_ip4_setting (NMConnection *connection,
 
 	/* Finally add setting to connection */
 	nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
+
+	return TRUE;
 }
 
-static void
+static gboolean
 make_ip6_setting (NMConnection *connection,
                   const char *conn_name,
                   GError **error)
@@ -875,12 +882,12 @@ make_ip6_setting (NMConnection *connection,
 
 done:
 	nm_connection_add_setting (connection, NM_SETTING (s_ip6));
-	return;
+	return TRUE;
 
 error:
 	g_object_unref (s_ip6);
 	nm_log_warn (LOGD_SETTINGS, "    Ignore IPv6 for %s", conn_name);
-	return;
+	return FALSE;
 }
 
 static NMSetting *
@@ -1018,14 +1025,6 @@ make_leap_setting (const char *ssid, GError **error)
 	wsec =
 	    NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ());
 
-	value = wpa_get_value (ssid, "key_mgmt");
-	if (!value || strcmp (value, "IEEE8021X"))
-		goto error;	/* Not LEAP */
-
-	value = wpa_get_value (ssid, "eap");
-	if (!value || strcasecmp (value, "LEAP"))
-		goto error;	/* Not LEAP */
-
 	value = wpa_get_value (ssid, "password");
 	if (value && strlen (value))
 		g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD,
@@ -1444,12 +1443,6 @@ make_wpa_setting (const char *ssid,
 	if (value)
 		adhoc = strcmp (value, "1") == 0 ? TRUE : FALSE;
 
-	value = wpa_get_value (ssid, "key_mgmt");
-	/* Not WPA or Dynamic WEP */
-	if (!value)
-		goto error;
-	if (strcmp (value, "WPA-PSK") && strcmp (value, "WPA-EAP"))
-		goto error;
 	/* Pairwise and Group ciphers */
 	fill_wpa_ciphers (ssid, wsec, FALSE, adhoc);
 	fill_wpa_ciphers (ssid, wsec, TRUE, adhoc);
@@ -1464,6 +1457,7 @@ make_wpa_setting (const char *ssid,
 
 	}
 
+	value = wpa_get_value (ssid, "key_mgmt");
 	if (!strcmp (value, "WPA-PSK")) {
 		char *psk = parse_wpa_psk (wpa_get_value (ssid, "psk"), error);
 
@@ -1522,8 +1516,6 @@ make_wireless_security_setting (const char *conn_name,
 	g_return_val_if_fail (conn_name != NULL
 			      && strcmp (ifnet_get_data (conn_name, "type"),
 					 "ppp") != 0, NULL);
-	if (!wpa_get_value (conn_name, "ssid"))
-		return NULL;
 	nm_log_info (LOGD_SETTINGS, "updating wireless security settings (%s).", conn_name);
 
 	ssid = conn_name;
@@ -1531,19 +1523,22 @@ make_wireless_security_setting (const char *conn_name,
 	if (value)
 		adhoc = strcmp (value, "1") == 0 ? TRUE : FALSE;
 
-	if (!adhoc) {
-		wsec = make_leap_setting (ssid, error);
-		if (error && *error)
-			goto error;
-	}
-	if (!wsec) {
+	value = wpa_get_value (ssid, "key_mgmt");
+	if (!adhoc && g_strcmp0 (value, "IEEE8021X") == 0) {
+		value = wpa_get_value (ssid, "eap");
+		if (value && strcasecmp (value, "LEAP") == 0) {
+			wsec = make_leap_setting (ssid, error);
+			if (wsec == NULL)
+				goto error;
+		}
+	} else if (g_strcmp0 (value, "WPA-PSK") == 0 || g_strcmp0 (value, "WPA-EAP") == 0) {
 		wsec = make_wpa_setting (ssid, basepath, s_8021x, error);
-		if (error && *error)
+		if (wsec == NULL)
 			goto error;
 	}
 	if (!wsec) {
 		wsec = make_wep_setting (ssid, error);
-		if (error && *error)
+		if (wsec == NULL)
 			goto error;
 	}
 
@@ -1559,7 +1554,7 @@ error:
 }
 
 /* Currently only support username and password */
-static void
+static gboolean
 make_pppoe_connection_setting (NMConnection *connection,
                                const char *conn_name,
                                GError **error)
@@ -1575,7 +1570,7 @@ make_pppoe_connection_setting (NMConnection *connection,
 	if (!value) {
 		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 			     "ppp requires at lease a username");
-		return;
+		return FALSE;
 	}
 	g_object_set (s_pppoe, NM_SETTING_PPPOE_USERNAME, value, NULL);
 
@@ -1591,6 +1586,8 @@ make_pppoe_connection_setting (NMConnection *connection,
 	/* PPP setting */
 	s_ppp = (NMSettingPpp *) nm_setting_ppp_new ();
 	nm_connection_add_setting (connection, NM_SETTING (s_ppp));
+
+	return TRUE;
 }
 
 NMConnection *
@@ -1644,18 +1641,13 @@ ifnet_update_connection_from_config_block (const char *conn_name,
 	if (!strcmp (NM_SETTING_WIRED_SETTING_NAME, type)
 	    || !strcmp (NM_SETTING_PPPOE_SETTING_NAME, type)) {
 		/* wired setting */
-		make_wired_connection_setting (connection, conn_name, error);
-		if (error && *error) {
-			nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
+		if (!make_wired_connection_setting (connection, conn_name, error))
 			goto error;
-		}
+
 		/* pppoe setting */
-		if (!strcmp (NM_SETTING_PPPOE_SETTING_NAME, type))
-			make_pppoe_connection_setting (connection, conn_name,
-						       error);
-		if (error && *error) {
-			nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
-			goto error;
+		if (!strcmp (NM_SETTING_PPPOE_SETTING_NAME, type)) {
+			if (!make_pppoe_connection_setting (connection, conn_name, error))
+				goto error;
 		}
 	} else if (!strcmp (NM_SETTING_WIRELESS_SETTING_NAME, type)) {
 		/* wireless setting */
@@ -1666,50 +1658,33 @@ ifnet_update_connection_from_config_block (const char *conn_name,
 			goto error;
 		nm_connection_add_setting (connection, wireless_setting);
 
-		if (error && *error) {
-			nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
-			goto error;
-		}
-
 		/* wireless security setting */
-		wsec = make_wireless_security_setting (conn_name, basepath, &s_8021x, error);
-		if (wsec) {
+		if (wpa_get_value (conn_name, "ssid")) {
+			wsec = make_wireless_security_setting (conn_name, basepath, &s_8021x, error);
+			if (!wsec)
+				goto error;
 			nm_connection_add_setting (connection, NM_SETTING (wsec));
 			if (s_8021x)
 				nm_connection_add_setting (connection, NM_SETTING (s_8021x));
 		}
-
-		if (error && *error) {
-			nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
-			goto error;
-		}
-
 	} else
 		goto error;
 
 	/* IPv4 setting */
-	make_ip4_setting (connection, conn_name, error);
-	if (error && *error) {
-		nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
+	if (!make_ip4_setting (connection, conn_name, error))
 		goto error;
-	}
 
 	/* IPv6 setting */
-	make_ip6_setting (connection, conn_name, error);
-	if (error && *error) {
-		nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
+	if (!make_ip6_setting (connection, conn_name, error))
 		goto error;
-	}
 
-	success = nm_connection_verify (connection, error);
-	if (error && *error)
-		nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
-	else
+	if (nm_connection_verify (connection, error)) {
 		nm_log_info (LOGD_SETTINGS, "Connection verified %s:%d", conn_name, success);
-	if (!success)
+	} else {
 		goto error;
-	return connection;
+	}
 
+	return connection;
 error:
 	g_object_unref (connection);
 	return NULL;
@@ -2493,8 +2468,8 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
 	return success;
 }
 
-static gboolean
-write_route6_file (NMSettingIPConfig *s_ip6, const char *conn_name, GError **error)
+static void
+write_route6_file (NMSettingIPConfig *s_ip6, const char *conn_name)
 {
 	NMIPRoute *route;
 	const char *next_hop;
@@ -2502,11 +2477,10 @@ write_route6_file (NMSettingIPConfig *s_ip6, const char *conn_name, GError **err
 	GString *routes_string;
 	const char *old_routes;
 
-	g_return_val_if_fail (s_ip6 != NULL, FALSE);
+	g_return_if_fail (s_ip6 != NULL);
 	num = nm_setting_ip_config_get_num_routes (s_ip6);
-	if (num == 0) {
-		return TRUE;
-	}
+	if (num == 0)
+		return;
 
 	old_routes = ifnet_get_data (conn_name, "routes");
 	routes_string = g_string_new (old_routes);
@@ -2527,8 +2501,6 @@ write_route6_file (NMSettingIPConfig *s_ip6, const char *conn_name, GError **err
 	if (num > 0)
 		ifnet_set_data (conn_name, "routes", routes_string->str);
 	g_string_free (routes_string, TRUE);
-
-	return TRUE;
 }
 
 static gboolean
@@ -2645,9 +2617,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
 		g_string_free (searches, TRUE);
 	}
 
-	write_route6_file (s_ip6, conn_name, error);
-	if (error && *error)
-		return FALSE;
+	write_route6_file (s_ip6, conn_name);
 	return TRUE;
 }
 
diff --git a/src/settings/plugins/ifnet/net_parser.c b/src/settings/plugins/ifnet/net_parser.c
index cad34f06..6e1061c6 100644
--- a/src/settings/plugins/ifnet/net_parser.c
+++ b/src/settings/plugins/ifnet/net_parser.c
@@ -552,7 +552,7 @@ gboolean
 ifnet_flush_to_file (const char *config_file, gchar **out_backup)
 {
 	GIOChannel *channel;
-	GError **error = NULL;
+	GError *error = NULL;
 	gpointer key, value, name, network;
 	GHashTableIter iter, iter_network;
 	GList *list_iter;
@@ -579,32 +579,36 @@ ifnet_flush_to_file (const char *config_file, gchar **out_backup)
 	g_io_channel_write_chars (channel,
 				  "#Generated by NetworkManager\n"
 				  "###### Global Configuration ######\n",
-				  -1, &bytes_written, error);
+				  -1, &bytes_written, &error);
+	if (error)
+		goto done;
+
 	/* Writing global data */
 	while (g_hash_table_iter_next (&iter, &key, &value)) {
 		out_line =
 		    g_strdup_printf ("%s=\"%s\"\n", (gchar *) key, (gchar *) value);
 		g_io_channel_write_chars (channel, out_line, -1,
-					  &bytes_written, error);
-		if (bytes_written == 0 || (error && *error))
-			break;
+					  &bytes_written, &error);
+		if (bytes_written == 0 || error)
+			goto done;
 		g_free (out_line);
 	}
-	if (error && *error) {
-		nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
-		goto done;
-	}
 
 	/* Writing connection data */
 	g_io_channel_write_chars (channel,
 				  "\n###### Connection Configuration ######\n",
-				  -1, &bytes_written, error);
+				  -1, &bytes_written, &error);
+	if (error)
+		goto done;
+
 	g_hash_table_iter_init (&iter, conn_table);
 	while (g_hash_table_iter_next (&iter, &name, &network)) {
 		g_hash_table_iter_init (&iter_network, (GHashTable *) network);
 		g_io_channel_write_chars (channel,
 					  "#----------------------------------\n",
-					  -1, &bytes_written, error);
+					  -1, &bytes_written, &error);
+		if (error)
+			goto done;
 
 		while (g_hash_table_iter_next (&iter_network, &key, &value)) {
 			if (!g_str_has_prefix ((gchar *) key, "name")
@@ -627,51 +631,47 @@ ifnet_flush_to_file (const char *config_file, gchar **out_backup)
 					    ("%s_%s=\"%s\"\n",
 					     (gchar *) key,
 					     (gchar *) name, (gchar *) value);
-				g_io_channel_write_chars
-				    (channel, out_line, -1,
-				     &bytes_written, error);
-				if (bytes_written == 0 || (error && *error))
-					break;
+				g_io_channel_write_chars (channel, out_line, -1, &bytes_written, &error);
+				if (bytes_written == 0 || error)
+					goto done;
 				g_free (out_line);
 			}
 		}
 	}
-	if (error && *error) {
-		nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
-		goto done;
-	}
 
 	/* Writing reserved functions */
 	if (functions_list) {
 		g_io_channel_write_chars (channel,
 					  "\n###### Reserved Functions ######\n",
-					  -1, &bytes_written, error);
+					  -1, &bytes_written, &error);
+		if (error)
+			goto done;
+
 		/* Writing functions */
 		for (list_iter = functions_list; list_iter;
 		     list_iter = g_list_next (list_iter)) {
 			out_line =
 			    g_strdup_printf ("%s\n", (gchar *) list_iter->data);
 			g_io_channel_write_chars (channel, out_line, -1,
-						  &bytes_written, error);
-			if (bytes_written == 0 || (error && *error))
-				break;
+						  &bytes_written, &error);
+			if (bytes_written == 0 || error)
+				goto done;
 			g_free (out_line);
 		}
-		if (error && *error) {
-			nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
-			goto done;
-		}
 	}
 
-	g_io_channel_flush (channel, error);
-	if (error && *error) {
-		nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
+	g_io_channel_flush (channel, &error);
+	if (error)
 		goto done;
-	}
 	result = TRUE;
 	net_parser_data_changed = FALSE;
 
 done:
+	if (error) {
+		nm_log_warn (LOGD_SETTINGS, "Error writing the configuration file: %s", error->message);
+		g_error_free (error);
+	}
+
 	if (result && out_backup)
 		*out_backup = backup;
 	else
diff --git a/src/settings/plugins/ifnet/net_utils.c b/src/settings/plugins/ifnet/net_utils.c
index 1944e478..bd5d65d5 100644
--- a/src/settings/plugins/ifnet/net_utils.c
+++ b/src/settings/plugins/ifnet/net_utils.c
@@ -800,18 +800,27 @@ gchar *backup_file (const gchar* target)
 {
 	GFile *source, *backup;
 	gchar* backup_path;
-	GError **error = NULL;
+	GError *error = NULL;
 
 	source = g_file_new_for_path (target);
+
+	if (!g_file_query_exists (source, NULL)) {
+		g_object_unref (source);
+		return NULL;
+	}
+
 	backup_path = g_strdup_printf ("%s.bak", target);
 	backup = g_file_new_for_path (backup_path);
 
-	g_file_copy (source, backup, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, error);
-	if (error && *error) {
-		nm_log_warn (LOGD_SETTINGS, "Backup failed: %s", (*error)->message);
+	if (!g_file_copy (source, backup, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error)) {
+		nm_log_warn (LOGD_SETTINGS, "Backup failed: %s", error->message);
 		g_free (backup_path);
 		backup_path = NULL;
+		g_error_free (error);
 	}
 
+	g_object_unref (source);
+	g_object_unref (backup);
+
 	return backup_path;
 }
diff --git a/src/settings/plugins/ifnet/nm-ifnet-connection.c b/src/settings/plugins/ifnet/nm-ifnet-connection.c
index 84515519..b661b03e 100644
--- a/src/settings/plugins/ifnet/nm-ifnet-connection.c
+++ b/src/settings/plugins/ifnet/nm-ifnet-connection.c
@@ -68,6 +68,8 @@ nm_ifnet_connection_new (NMConnection *source, const char *conn_name)
 	else {
 		tmp = ifnet_update_connection_from_config_block (conn_name, NULL, &error);
 		if (!tmp) {
+			nm_log_warn (LOGD_SETTINGS, "Could not read connection '%s': %s",
+			             conn_name, error->message);
 			g_error_free (error);
 			return NULL;
 		}
@@ -79,11 +81,14 @@ nm_ifnet_connection_new (NMConnection *source, const char *conn_name)
 	object = (GObject *) g_object_new (NM_TYPE_IFNET_CONNECTION, NULL);
 	g_assert (object);
 	NM_IFNET_CONNECTION_GET_PRIVATE (object)->conn_name = g_strdup (conn_name);
-	nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object),
-	                                         tmp,
-	                                         update_unsaved,
-	                                         NULL,
-	                                         NULL);
+	if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object),
+	                                              tmp,
+	                                              update_unsaved,
+	                                              NULL,
+	                                              NULL)) {
+		g_object_unref (object);
+		return NULL;
+	}
 	g_object_unref (tmp);
 
 	return NM_IFNET_CONNECTION (object);
diff --git a/src/settings/plugins/ifnet/tests/test-ifnet.c b/src/settings/plugins/ifnet/tests/test-ifnet.c
index c870152b..3035fdb1 100644
--- a/src/settings/plugins/ifnet/tests/test-ifnet.c
+++ b/src/settings/plugins/ifnet/tests/test-ifnet.c
@@ -134,7 +134,7 @@ test_convert_ipv4_config_block (void)
 	check_ip_block (iblock, "192.168.4.121", 24, "202.117.16.1");
 	destroy_ip_block (iblock);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*Can't handle IPv4 address*202.117.16.1211*");
 	iblock = convert_ip4_config_block ("eth2");
 	g_test_assert_expected_messages ();
@@ -142,7 +142,7 @@ test_convert_ipv4_config_block (void)
 	check_ip_block (iblock, "192.168.4.121", 24, NULL);
 	destroy_ip_block (iblock);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*missing netmask or prefix*");
 	iblock = convert_ip4_config_block ("eth3");
 	g_assert (iblock == NULL);
@@ -216,9 +216,9 @@ test_new_connection (void)
 	GError *error = NULL;
 	NMConnection *connection;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*Can't handle IPv4 address*202.117.16.1211*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*Can't handle IPv6 address*202.117.16.1211*");
 	connection = ifnet_update_connection_from_config_block ("eth2", NULL, &error);
 	g_test_assert_expected_messages ();
@@ -245,7 +245,7 @@ test_new_connection (void)
 static void
 kill_backup (char **path)
 {
-	if (path) {
+	if (*path) {
 		unlink (*path);
 		g_free (*path);
 		*path = NULL;
@@ -306,9 +306,9 @@ test_add_connection (void)
 	kill_backup (&backup);
 	g_object_unref (connection);
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*Can't handle ipv4 address: brd, missing netmask or prefix*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*Can't handle ipv4 address: 202.117.16.255, missing netmask or prefix*");
 	connection = ifnet_update_connection_from_config_block ("myxjtu2", basepath, NULL);
 	g_test_assert_expected_messages ();
@@ -349,10 +349,8 @@ test_missing_config (void)
 	GError *error = NULL;
 	NMConnection *connection;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
-	                       "*Unknown config for eth8*");
 	connection = ifnet_update_connection_from_config_block ("eth8", NULL, &error);
-	g_test_assert_expected_messages ();
+	g_assert_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION);
 	g_assert (connection == NULL && error != NULL);
 }
 
diff --git a/src/settings/plugins/ifnet/wpa_parser.c b/src/settings/plugins/ifnet/wpa_parser.c
index 501bca7a..8e2559b3 100644
--- a/src/settings/plugins/ifnet/wpa_parser.c
+++ b/src/settings/plugins/ifnet/wpa_parser.c
@@ -365,7 +365,7 @@ gboolean
 wpa_flush_to_file (const char *config_file)
 {
 	GIOChannel *channel;
-	GError **error = NULL;
+	GError *error = NULL;
 	gpointer key, value, ssid, security;
 	GHashTableIter iter, iter_security;
 	gchar *out_line;
@@ -389,25 +389,27 @@ wpa_flush_to_file (const char *config_file)
 	g_io_channel_write_chars (channel,
 				  "#Generated by NetworkManager\n"
 				  "###### Global Configuration ######\n",
-				  -1, &bytes_written, error);
+				  -1, &bytes_written, &error);
+	if (error)
+		goto done;
 
 	/* Writing global information */
 	while (g_hash_table_iter_next (&iter, &key, &value)) {
 		out_line =
 		    g_strdup_printf ("%s=%s\n", (gchar *) key, (gchar *) value);
 		g_io_channel_write_chars (channel, out_line, -1, &bytes_written,
-					  error);
-		if (bytes_written == 0 || (error && *error))
+					  &error);
+		if (bytes_written == 0 || error)
 			break;
 		g_free (out_line);
 	}
-	if (error && *error) {
-		nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
+	if (error)
 		goto done;
-	}
 	g_io_channel_write_chars (channel,
 				  "\n###### Security Configuration ######\n",
-				  -1, &bytes_written, error);
+				  -1, &bytes_written, &error);
+	if (error)
+		goto done;
 
 	g_hash_table_iter_init (&iter, wsec_table);
 	/* Writing security */
@@ -415,35 +417,34 @@ wpa_flush_to_file (const char *config_file)
 		g_hash_table_iter_init (&iter_security,
 					(GHashTable *) security);
 		g_io_channel_write_chars (channel, "network={\n", -1,
-					  &bytes_written, error);
+					  &bytes_written, &error);
+		if (error)
+			goto done;
 		while (g_hash_table_iter_next (&iter_security, &key, &value)) {
 			out_line =
 			    g_strdup_printf (need_quote ((gchar *) key) ?
 					     "\t%s=\"%s\"\n" : "\t%s=%s\n",
 					     (gchar *) key, (gchar *) value);
 			g_io_channel_write_chars (channel, out_line, -1,
-						  &bytes_written, error);
-			if (bytes_written == 0 || (error && *error))
-				break;
+						  &bytes_written, &error);
+			if (bytes_written == 0 || error)
+				goto done;
 			g_free (out_line);
 		}
-		g_io_channel_write_chars (channel,
-					  "}\n\n", -1, &bytes_written, error);
+		g_io_channel_write_chars (channel, "}\n\n", -1, &bytes_written, &error);
 
 	}
-	if (error && *error) {
-		nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
+	g_io_channel_flush (channel, &error);
+	if (error)
 		goto done;
-	}
-	g_io_channel_flush (channel, error);
 
-	if (error && *error) {
-		nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message);
-		goto done;
-	}
 	wpa_parser_data_changed = FALSE;
 	result = TRUE;
 done:
+	if (error) {
+		nm_log_warn (LOGD_SETTINGS, "Error writing WPA configuration: %s", error->message);
+		g_error_free (error);
+	}
 	g_io_channel_shutdown (channel, FALSE, NULL);
 	g_io_channel_unref (channel);
 	return result;
diff --git a/src/settings/plugins/ifupdown/interface_parser.c b/src/settings/plugins/ifupdown/interface_parser.c
index be7d387d..d342501b 100644
--- a/src/settings/plugins/ifupdown/interface_parser.c
+++ b/src/settings/plugins/ifupdown/interface_parser.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* NetworkManager -- Network link manager
  *
  * Tom Parker <palfrey@tevp.net>
@@ -50,7 +50,6 @@ void add_block(const char *type, const char* name)
 		last = ret;
 	}
 	last_data = NULL;
-	//printf("added block '%s' with type '%s'\n",name,type);
 }
 
 void add_data(const char *key,const char *data)
@@ -58,14 +57,15 @@ void add_data(const char *key,const char *data)
 	if_data *ret;
 	char *idx;
 
-	// Check if there is a block where we can attach our data
+	/* Check if there is a block where we can attach our data */
 	if (first == NULL)
 		return;
 
 	ret = (if_data*) calloc(1,sizeof(struct _if_data));
 	ret->key = g_strdup(key);
-	// Normalize keys. Convert '_' to '-', as ifupdown accepts both variants.
-	// When querying keys via ifparser_getkey(), use '-'.
+
+	/* Normalize keys. Convert '_' to '-', as ifupdown accepts both variants.
+	 * When querying keys via ifparser_getkey(), use '-'. */
 	while ((idx = strrchr(ret->key, '_'))) {
 		*idx = '-';
 	}
@@ -81,10 +81,9 @@ void add_data(const char *key,const char *data)
 		last_data->next = ret;
 		last_data = last_data->next;
 	}
-	//printf("added data '%s' with key '%s'\n",data,key);
 }
 
-// join values in src with spaces into dst;  dst needs to be large enough
+/* join values in src with spaces into dst;  dst needs to be large enough */
 static char *join_values_with_spaces(char *dst, char **src)
 {
 	if (dst != NULL) {
@@ -112,7 +111,7 @@ _recursive_ifparser (const char *eni_file, int quiet)
 	int skip_long_line = 0;
 	int offs = 0;
 
-	// Check if interfaces file exists and open it
+	/* Check if interfaces file exists and open it */
 	if (!g_file_test (eni_file, G_FILE_TEST_EXISTS)) {
 		if (!quiet)
 			nm_log_warn (LOGD_SETTINGS, "interfaces file %s doesn't exist\n", eni_file);
@@ -130,8 +129,8 @@ _recursive_ifparser (const char *eni_file, int quiet)
 
 	while (!feof(inp))
 	{
-		char *token[128];	// 255 chars can only be split into 127 tokens
-		char value[255];	// large enough to join previously split tokens
+		char *token[128];	/* 255 chars can only be split into 127 tokens */
+		char value[255];	/* large enough to join previously split tokens */
 		char *safeptr;
 		int toknum;
 		int len = 0;
@@ -141,7 +140,7 @@ _recursive_ifparser (const char *eni_file, int quiet)
 			break;
 
 		len = strlen(line);
-		// skip over-long lines
+		/* skip over-long lines */
 		if (!feof(inp) && len > 0 &&  line[len-1] != '\n') {
 			if (!skip_long_line) {
 				if (!quiet)
@@ -151,35 +150,33 @@ _recursive_ifparser (const char *eni_file, int quiet)
 			continue;
 		}
 
-		// trailing '\n' found: remove it & reset offset to 0
+		/* trailing '\n' found: remove it & reset offset to 0 */
 		if (len > 0 && line[len-1] == '\n') {
 			line[--len] = '\0';
 			offs = 0;
 		}
 
-		// if we're in long_line_skip mode, terminate it for real next line
+		/* if we're in long_line_skip mode, terminate it for real next line */
 		if (skip_long_line) {
 			if (len == 0 || line[len-1] != '\\')
 				skip_long_line = 0;
 			continue;
 		}
 
-		// unwrap wrapped lines
+		/* unwrap wrapped lines */
 		if (len > 0 && line[len-1] == '\\') {
 			offs = len - 1;
 			continue;
 		}
 
-		//printf(">>%s<<\n", line);
-
 #define SPACES	" \t"
-		// tokenize input;
+		/* tokenize input; */
 		for (toknum = 0, token[toknum] = strtok_r(line, SPACES, &safeptr);
 		     token[toknum] != NULL;
 		     toknum++, token[toknum] = strtok_r(NULL, SPACES, &safeptr))
 			;
 
-		// ignore comments and empty lines
+		/* ignore comments and empty lines */
 		if (toknum == 0 || *token[0]=='#')
 			continue;
 
@@ -192,11 +189,11 @@ _recursive_ifparser (const char *eni_file, int quiet)
 			continue;
 		}
 
-		// There are five different stanzas:
-		// iface, mapping, auto, allow-* and source.
-		// Create a block for each of them except source.
+		/* There are five different stanzas:
+		 * iface, mapping, auto, allow-* and source.
+		 * Create a block for each of them except source.  */
 
-		// iface stanza takes at least 3 parameters
+		/* iface stanza takes at least 3 parameters */
 		if (strcmp(token[0], "iface") == 0) {
 			if (toknum < 4) {
 				if (!quiet) {
@@ -209,8 +206,8 @@ _recursive_ifparser (const char *eni_file, int quiet)
 			skip_to_block = 0;
 			add_data(token[2], join_values_with_spaces(value, token + 3));
 		}
-		// auto and allow-auto stanzas are equivalent,
-		// both can take multiple interfaces as parameters: add one block for each
+		/* auto and allow-auto stanzas are equivalent,
+		 * both can take multiple interfaces as parameters: add one block for each */
 		else if (strcmp(token[0], "auto") == 0 ||
 			 strcmp(token[0], "allow-auto") == 0) {
 			int i;
@@ -222,14 +219,14 @@ _recursive_ifparser (const char *eni_file, int quiet)
 			add_block(token[0], join_values_with_spaces(value, token + 1));
 			skip_to_block = 0;
 		}
-		// allow-* can take multiple interfaces as parameters: add one block for each
+		/* allow-* can take multiple interfaces as parameters: add one block for each */
 		else if (strncmp(token[0],"allow-",6) == 0) {
 			int i;
 			for (i = 1; i < toknum; i++)
 				add_block(token[0], token[i]);
 			skip_to_block = 0;
 		}
-		// source stanza takes one or more filepaths as parameters
+		/* source stanza takes one or more filepaths as parameters */
 		else if (strcmp(token[0], "source") == 0) {
 			int i;
 			char *en_dir;
diff --git a/src/settings/plugins/ifupdown/interface_parser.h b/src/settings/plugins/ifupdown/interface_parser.h
index 4034d44c..d4bb8515 100644
--- a/src/settings/plugins/ifupdown/interface_parser.h
+++ b/src/settings/plugins/ifupdown/interface_parser.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* NetworkManager -- Network link manager
  *
  * Tom Parker <palfrey@tevp.net>
diff --git a/src/settings/plugins/ifupdown/nm-ifupdown-connection.c b/src/settings/plugins/ifupdown/nm-ifupdown-connection.c
index 19de1db6..34ecf8b9 100644
--- a/src/settings/plugins/ifupdown/nm-ifupdown-connection.c
+++ b/src/settings/plugins/ifupdown/nm-ifupdown-connection.c
@@ -1,5 +1,4 @@
-/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
-
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* NetworkManager system settings service (ifupdown)
  *
  * Alexander Sack <asac@ubuntu.com>
@@ -36,134 +35,46 @@
 
 G_DEFINE_TYPE (NMIfupdownConnection, nm_ifupdown_connection, NM_TYPE_SETTINGS_CONNECTION)
 
-#define NM_IFUPDOWN_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IFUPDOWN_CONNECTION, NMIfupdownConnectionPrivate))
-
-typedef struct {
-	if_block *ifblock;
-} NMIfupdownConnectionPrivate;
-
-enum {
-	PROP_ZERO,
-	PROP_IFBLOCK,
-	_PROP_END,
-};
-
-
 NMIfupdownConnection*
 nm_ifupdown_connection_new (if_block *block)
 {
-	g_return_val_if_fail (block != NULL, NULL);
-
-	return (NMIfupdownConnection *) g_object_new (NM_TYPE_IFUPDOWN_CONNECTION,
-										 NM_IFUPDOWN_CONNECTION_IFBLOCK, block,
-										 NULL);
-}
-
-static gboolean
-supports_secrets (NMSettingsConnection *connection, const char *setting_name)
-{
-	nm_log_info (LOGD_SETTINGS, "supports_secrets() for setting_name: '%s'", setting_name);
-
-	return (strcmp (setting_name, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0);
-}
-
-static void
-nm_ifupdown_connection_init (NMIfupdownConnection *connection)
-{
-}
-
-static GObject *
-constructor (GType type,
-		   guint n_construct_params,
-		   GObjectConstructParam *construct_params)
-{
 	GObject *object;
-	NMIfupdownConnectionPrivate *priv;
 	GError *error = NULL;
 
-	object = G_OBJECT_CLASS (nm_ifupdown_connection_parent_class)->constructor (type, n_construct_params, construct_params);
-	g_return_val_if_fail (object, NULL);
+	g_return_val_if_fail (block != NULL, NULL);
 
-	priv = NM_IFUPDOWN_CONNECTION_GET_PRIVATE (object);
-	if (!priv) {
-		nm_log_warn (LOGD_SETTINGS, "%s.%d - no private instance.", __FILE__, __LINE__);
-		goto err;
-	}
-	if (!priv->ifblock) {
-		nm_log_warn (LOGD_SETTINGS, "(ifupdown) ifblock not provided to constructor.");
-		goto err;
-	}
+	object = g_object_new (NM_TYPE_IFUPDOWN_CONNECTION, NULL);
 
-	if (!ifupdown_update_connection_from_if_block (NM_CONNECTION (object), priv->ifblock, &error)) {
-		nm_log_warn (LOGD_SETTINGS, "%s.%d - invalid connection read from /etc/network/interfaces: (%d) %s",
+	if (!ifupdown_update_connection_from_if_block (NM_CONNECTION (object), block, &error)) {
+		nm_log_warn (LOGD_SETTINGS, "%s.%d - invalid connection read from /etc/network/interfaces: %s",
 		             __FILE__,
 		             __LINE__,
-		             error ? error->code : -1,
-		             error && error->message ? error->message : "(unknown)");
-		goto err;
+		             error->message);
+		g_object_unref (object);
+		return NULL;
 	}
 
-	return object;
-
- err:
-	g_object_unref (object);
-	return NULL;
+	return (NMIfupdownConnection *) object;
 }
 
-static void
-set_property (GObject *object, guint prop_id,
-		    const GValue *value, GParamSpec *pspec)
+static gboolean
+supports_secrets (NMSettingsConnection *connection, const char *setting_name)
 {
-	NMIfupdownConnectionPrivate *priv = NM_IFUPDOWN_CONNECTION_GET_PRIVATE (object);
-	g_return_if_fail (priv);
+	nm_log_info (LOGD_SETTINGS, "supports_secrets() for setting_name: '%s'", setting_name);
 
-	switch (prop_id) {
-	case PROP_IFBLOCK:
-		priv->ifblock = g_value_get_pointer (value);
-		break;
-	default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-		break;
-	}
+	return (strcmp (setting_name, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) == 0);
 }
 
 static void
-get_property (GObject *object, guint prop_id,
-		    GValue *value, GParamSpec *pspec)
+nm_ifupdown_connection_init (NMIfupdownConnection *connection)
 {
-	NMIfupdownConnectionPrivate *priv = NM_IFUPDOWN_CONNECTION_GET_PRIVATE (object);
-	g_return_if_fail (priv);
-
-	switch (prop_id) {
-	case PROP_IFBLOCK:
-		g_value_set_pointer (value, priv->ifblock);
-		break;
-	default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-		break;
-	}
 }
 
 static void
 nm_ifupdown_connection_class_init (NMIfupdownConnectionClass *ifupdown_connection_class)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (ifupdown_connection_class);
 	NMSettingsConnectionClass *connection_class = NM_SETTINGS_CONNECTION_CLASS (ifupdown_connection_class);
 
-	g_type_class_add_private (ifupdown_connection_class, sizeof (NMIfupdownConnectionPrivate));
-
-	/* Virtual methods */
-	object_class->constructor  = constructor;
-	object_class->set_property = set_property;
-	object_class->get_property = get_property;
-
 	connection_class->supports_secrets = supports_secrets;
-
-	/* Properties */
-	g_object_class_install_property
-		(object_class, PROP_IFBLOCK,
-		 g_param_spec_pointer (NM_IFUPDOWN_CONNECTION_IFBLOCK, "", "",
-		                       G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
-		                       G_PARAM_STATIC_STRINGS));
 }
 
diff --git a/src/settings/plugins/ifupdown/nm-ifupdown-connection.h b/src/settings/plugins/ifupdown/nm-ifupdown-connection.h
index 54c219f4..8085b831 100644
--- a/src/settings/plugins/ifupdown/nm-ifupdown-connection.h
+++ b/src/settings/plugins/ifupdown/nm-ifupdown-connection.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 
 /* NetworkManager system settings service (ifupdown)
  *
@@ -37,8 +37,6 @@ G_BEGIN_DECLS
 #define NM_IS_IFUPDOWN_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IFUPDOWN_CONNECTION))
 #define NM_IFUPDOWN_CONNECTION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IFUPDOWN_CONNECTION, NMIfupdownConnectionClass))
 
-#define NM_IFUPDOWN_CONNECTION_IFBLOCK "ifblock"
-
 typedef struct {
 	NMSettingsConnection parent;
 } NMIfupdownConnection;
diff --git a/src/settings/plugins/ifupdown/parser.c b/src/settings/plugins/ifupdown/parser.c
index bd200cd5..109018dd 100644
--- a/src/settings/plugins/ifupdown/parser.c
+++ b/src/settings/plugins/ifupdown/parser.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 
 /* NetworkManager system settings service (ifupdown)
  *
@@ -94,6 +94,8 @@ update_wireless_setting_from_if_block(NMConnection *connection,
 	const gchar* value = ifparser_getkey (block, "inet");
 	struct _Mapping mapping[] = {
 		{"ssid", "ssid"},
+		{"essid", "ssid"},
+		{"mode", "mode"},
 		{ NULL, NULL}
 	};
 
@@ -112,14 +114,22 @@ update_wireless_setting_from_if_block(NMConnection *connection,
 			const gchar* newkey = map_by_mapping(mapping, curr->key+wireless_l);
 			nm_log_info (LOGD_SETTINGS, "wireless setting key: %s='%s'", newkey, curr->data);
 			if(newkey && !strcmp("ssid", newkey)) {
-				GByteArray *ssid;
+				GBytes *ssid;
 				gint len = strlen(curr->data);
 
-				ssid = g_byte_array_sized_new (len);
-				g_byte_array_append (ssid, (const guint8 *) curr->data, len);
+				ssid = g_bytes_new (curr->data, len);
 				g_object_set (wireless_setting, NM_SETTING_WIRELESS_SSID, ssid, NULL);
-				g_byte_array_free (ssid, TRUE);
+				g_bytes_unref (ssid);
 				nm_log_info (LOGD_SETTINGS, "setting wireless ssid = %d", len);
+			} else if(newkey && !strcmp("mode", newkey)) {
+				if (!g_ascii_strcasecmp (curr->data, "Managed") || !g_ascii_strcasecmp (curr->data, "Auto"))
+					g_object_set (wireless_setting, NM_SETTING_WIRELESS_MODE, NM_SETTING_WIRELESS_MODE_INFRA, NULL);
+				else if (!g_ascii_strcasecmp (curr->data, "Ad-Hoc"))
+					g_object_set (wireless_setting, NM_SETTING_WIRELESS_MODE, NM_SETTING_WIRELESS_MODE_ADHOC, NULL);
+				else if (!g_ascii_strcasecmp (curr->data, "Master"))
+					g_object_set (wireless_setting, NM_SETTING_WIRELESS_MODE, NM_SETTING_WIRELESS_MODE_AP, NULL);
+				else
+					nm_log_warn (LOGD_SETTINGS, "Invalid mode '%s' (not 'Ad-Hoc', 'Ap', 'Managed', or 'Auto')", curr->data);
 			} else {
 				g_object_set(wireless_setting,
 					   newkey, curr->data,
@@ -130,13 +140,12 @@ update_wireless_setting_from_if_block(NMConnection *connection,
 			const gchar* newkey = map_by_mapping(mapping, curr->key+wpa_l);
 
 			if(newkey && !strcmp("ssid", newkey)) {
-				GByteArray *ssid;
+				GBytes *ssid;
 				gint len = strlen(curr->data);
 
-				ssid = g_byte_array_sized_new (len);
-				g_byte_array_append (ssid, (const guint8 *) curr->data, len);
+				ssid = g_bytes_new (curr->data, len);
 				g_object_set (wireless_setting, NM_SETTING_WIRELESS_SSID, ssid, NULL);
-				g_byte_array_free (ssid, TRUE);
+				g_bytes_unref (ssid);
 				nm_log_info (LOGD_SETTINGS, "setting wpa ssid = %d", len);
 			} else if(newkey) {
 
@@ -318,11 +327,9 @@ update_wireless_security_setting_from_if_block(NMConnection *connection,
 			IfupdownStrDupeFunc dupe_func = map_by_mapping (dupe_mapping, curr->key+wireless_l);
 			IfupdownStrToTypeFunc type_map_func = map_by_mapping (type_mapping, curr->key+wireless_l);
 			GFreeFunc free_func = map_by_mapping (free_type_mapping, curr->key+wireless_l);
-			if(!newkey || !dupe_func) {
-				nm_log_warn (LOGD_SETTINGS, "no (wireless) mapping found for key: %s",
-				             curr->key);
+			if(!newkey || !dupe_func)
 				goto next;
-			}
+
 			property_value = (*dupe_func) (curr->data, connection);
 			nm_log_info (LOGD_SETTINGS, "setting wireless security key: %s=%s",
 			             newkey, property_value);
@@ -353,15 +360,15 @@ update_wireless_security_setting_from_if_block(NMConnection *connection,
 			IfupdownStrDupeFunc dupe_func = map_by_mapping (dupe_mapping, curr->key+wpa_l);
 			IfupdownStrToTypeFunc type_map_func = map_by_mapping (type_mapping, curr->key+wpa_l);
 			GFreeFunc free_func = map_by_mapping (free_type_mapping, curr->key+wpa_l);
-			if(!newkey || !dupe_func) {
+			if(!newkey || !dupe_func)
 				goto next;
-			}
+
 			property_value = (*dupe_func) (curr->data, connection);
 			nm_log_info (LOGD_SETTINGS, "setting wpa security key: %s=%s",
 			             newkey,
 #ifdef DEBUG_SECRETS
 			             property_value
-#else // DEBUG_SECRETS
+#else /* DEBUG_SECRETS */
 			             !strcmp("key", newkey) ||
 			             !strcmp("leap-password", newkey) ||
 			             !strcmp("pin", newkey) ||
@@ -372,7 +379,7 @@ update_wireless_security_setting_from_if_block(NMConnection *connection,
 			             !strcmp("wep-key3", newkey) ||
 			             NULL ?
 			             "<omitted>" : property_value
-#endif // DEBUG_SECRETS
+#endif /* DEBUG_SECRETS */
 			             );
 
 			if (type_map_func) {
diff --git a/src/settings/plugins/ifupdown/parser.h b/src/settings/plugins/ifupdown/parser.h
index 6aebb8c7..ee88c500 100644
--- a/src/settings/plugins/ifupdown/parser.h
+++ b/src/settings/plugins/ifupdown/parser.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 
 /* NetworkManager system settings service (ifupdown)
  *
diff --git a/src/settings/plugins/ifupdown/plugin.c b/src/settings/plugins/ifupdown/plugin.c
index dbc96eac..b506b2d6 100644
--- a/src/settings/plugins/ifupdown/plugin.c
+++ b/src/settings/plugins/ifupdown/plugin.c
@@ -93,13 +93,13 @@ static void
 settings_plugin_ifupdown_class_init (SettingsPluginIfupdownClass *req_class);
 
 static void
-SettingsPluginIfupdown_init (NMSettingsPlugin *config);
+init (NMSettingsPlugin *config);
 
 /* Returns the plugins currently known list of connections.  The returned
  * list is freed by the system settings service.
  */
 static GSList*
-SettingsPluginIfupdown_get_connections (NMSettingsPlugin *config);
+get_connections (NMSettingsPlugin *config);
 
 /*
  * Return a list of device specifications which NetworkManager should not
@@ -107,27 +107,27 @@ SettingsPluginIfupdown_get_connections (NMSettingsPlugin *config);
  * each element must be allocated using g_malloc() or its variants.
  */
 static GSList*
-SettingsPluginIfupdown_get_unmanaged_specs (NMSettingsPlugin *config);
+get_unmanaged_specs (NMSettingsPlugin *config);
 
 
 /*  GObject */
 static void
-GObject__get_property (GObject *object, guint prop_id,
+get_property (GObject *object, guint prop_id,
 				   GValue *value, GParamSpec *pspec);
 
 static void
-GObject__set_property (GObject *object, guint prop_id,
+set_property (GObject *object, guint prop_id,
 				   const GValue *value, GParamSpec *pspec);
 
 static void
-GObject__dispose (GObject *object);
+dispose (GObject *object);
 
 static void
 settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface)
 {
-	plugin_iface->init = SettingsPluginIfupdown_init;
-	plugin_iface->get_connections = SettingsPluginIfupdown_get_connections;
-	plugin_iface->get_unmanaged_specs = SettingsPluginIfupdown_get_unmanaged_specs;
+	plugin_iface->init = init;
+	plugin_iface->get_connections = get_connections;
+	plugin_iface->get_unmanaged_specs = get_unmanaged_specs;
 }
 
 static void
@@ -137,9 +137,9 @@ settings_plugin_ifupdown_class_init (SettingsPluginIfupdownClass *req_class)
 
 	g_type_class_add_private (req_class, sizeof (SettingsPluginIfupdownPrivate));
 
-	object_class->dispose = GObject__dispose;
-	object_class->get_property = GObject__get_property;
-	object_class->set_property = GObject__set_property;
+	object_class->dispose = dispose;
+	object_class->get_property = get_property;
+	object_class->set_property = set_property;
 
 	g_object_class_override_property (object_class,
 	                                  NM_SETTINGS_PLUGIN_PROP_NAME,
@@ -292,7 +292,7 @@ handle_uevent (GUdevClient *client,
 }
 
 static void
-SettingsPluginIfupdown_init (NMSettingsPlugin *config)
+init (NMSettingsPlugin *config)
 {
 	SettingsPluginIfupdown *self = SETTINGS_PLUGIN_IFUPDOWN (config);
 	SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (self);
@@ -447,7 +447,7 @@ SettingsPluginIfupdown_init (NMSettingsPlugin *config)
  * list is freed by the system settings service.
  */
 static GSList*
-SettingsPluginIfupdown_get_connections (NMSettingsPlugin *config)
+get_connections (NMSettingsPlugin *config)
 {
 	SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (config);
 	GSList *connections;
@@ -471,7 +471,7 @@ SettingsPluginIfupdown_get_connections (NMSettingsPlugin *config)
  * each element must be allocated using g_malloc() or its variants.
  */
 static GSList*
-SettingsPluginIfupdown_get_unmanaged_specs (NMSettingsPlugin *config)
+get_unmanaged_specs (NMSettingsPlugin *config)
 {
 	SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (config);
 	GSList *specs = NULL;
@@ -504,7 +504,7 @@ settings_plugin_ifupdown_init (SettingsPluginIfupdown *plugin)
 }
 
 static void
-GObject__get_property (GObject *object, guint prop_id,
+get_property (GObject *object, guint prop_id,
                        GValue *value, GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -524,7 +524,7 @@ GObject__get_property (GObject *object, guint prop_id,
 }
 
 static void
-GObject__set_property (GObject *object, guint prop_id,
+set_property (GObject *object, guint prop_id,
 				   const GValue *value, GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -535,7 +535,7 @@ GObject__set_property (GObject *object, guint prop_id,
 }
 
 static void
-GObject__dispose (GObject *object)
+dispose (GObject *object)
 {
 	SettingsPluginIfupdown *plugin = SETTINGS_PLUGIN_IFUPDOWN (object);
 	SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (plugin);
diff --git a/src/settings/plugins/ifupdown/plugin.h b/src/settings/plugins/ifupdown/plugin.h
index 090178f2..10ba2287 100644
--- a/src/settings/plugins/ifupdown/plugin.h
+++ b/src/settings/plugins/ifupdown/plugin.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 
 /* NetworkManager system settings service (ifupdown)
  *
diff --git a/src/settings/plugins/keyfile/plugin.c b/src/settings/plugins/keyfile/plugin.c
index 29a1141b..6003c745 100644
--- a/src/settings/plugins/keyfile/plugin.c
+++ b/src/settings/plugins/keyfile/plugin.c
@@ -404,10 +404,9 @@ read_connections (NMSettingsPlugin *config)
 
 	dir = g_dir_open (nm_keyfile_plugin_get_path (), 0, &error);
 	if (!dir) {
-		nm_log_warn (LOGD_SETTINGS, "keyfile: cannot read directory '%s': (%d) %s",
+		nm_log_warn (LOGD_SETTINGS, "keyfile: cannot read directory '%s': %s",
 		             nm_keyfile_plugin_get_path (),
-		             error ? error->code : -1,
-		             error && error->message ? error->message : "(unknown)");
+		             error->message);
 		g_clear_error (&error);
 		return;
 	}
diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/settings/plugins/keyfile/tests/test-keyfile.c
index c1b79ef7..7b66e198 100644
--- a/src/settings/plugins/keyfile/tests/test-keyfile.c
+++ b/src/settings/plugins/keyfile/tests/test-keyfile.c
@@ -88,33 +88,33 @@ test_read_valid_wired_connection (void)
 	char expected_mac_address[ETH_ALEN] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
 	gboolean success;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv4.addresses:*semicolon at the end*addresses1*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv4.addresses:*semicolon at the end*addresses2*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*missing prefix length*address4*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
-	                       "*missing prefix length*address5*");
 	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	                       "*missing prefix length*address5*");
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv4.routes*semicolon at the end*routes2*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv4.routes*semicolon at the end*routes3*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv4.routes*semicolon at the end*routes5*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv4.routes*semicolon at the end*routes8*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
-	                       "*missing prefix length*address4*");
 	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	                       "*missing prefix length*address4*");
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv6.address*semicolon at the end*address5*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
-	                       "*missing prefix length*address5*");
 	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	                       "*missing prefix length*address5*");
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv6.address*semicolon at the end*address7*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv6.routes*semicolon at the end*routes1*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv6.route*semicolon at the end*route6*");
 	connection = nm_keyfile_plugin_connection_from_file (TEST_KEYFILES_DIR "/Test_Wired_Connection", NULL);
 	g_test_assert_expected_messages ();
@@ -537,11 +537,11 @@ test_read_wired_mac_case (void)
 	char expected_mac_address[ETH_ALEN] = { 0x00, 0x11, 0xaa, 0xbb, 0xcc, 0x55 };
 	gboolean success;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv4.addresses*semicolon at the end*addresses1*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv4.addresses*semicolon at the end*addresses2*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO,
 	                       "*ipv6.routes*semicolon at the end*routes1*");
 	connection = nm_keyfile_plugin_connection_from_file (TEST_KEYFILES_DIR "/Test_Wired_Connection_MAC_Case", NULL);
 	g_test_assert_expected_messages ();
@@ -1513,10 +1513,10 @@ test_read_wired_8021x_tls_blob_connection (void)
 	gboolean success;
 	GBytes *blob;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
-	                       "*<warn>  keyfile: 802-1x.client-cert: certificate or key file '/CASA/dcbw/Desktop/certinfra/client.pem' does not exist*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
-	                       "*<warn>  keyfile: 802-1x.private-key: certificate or key file '/CASA/dcbw/Desktop/certinfra/client.pem' does not exist*");
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	                       "*<warn> * keyfile: 802-1x.client-cert: certificate or key file '/CASA/dcbw/Desktop/certinfra/client.pem' does not exist*");
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	                       "*<warn> * keyfile: 802-1x.private-key: certificate or key file '/CASA/dcbw/Desktop/certinfra/client.pem' does not exist*");
 	connection = nm_keyfile_plugin_connection_from_file (TEST_KEYFILES_DIR "/Test_Wired_TLS_Blob", &error);
 	g_assert_no_error (error);
 	g_assert (connection);
@@ -1576,7 +1576,7 @@ test_read_wired_8021x_tls_bad_path_connection (void)
 	char *tmp2;
 	gboolean success;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
 	                       "*does not exist*");
 	connection = nm_keyfile_plugin_connection_from_file (TEST_KEYFILES_DIR "/Test_Wired_TLS_Path_Missing", &error);
 	g_test_assert_expected_messages ();
@@ -1631,12 +1631,12 @@ test_read_wired_8021x_tls_old_connection (void)
 	const char *tmp;
 	gboolean success;
 
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
-	                       "*<warn>  keyfile: 802-1x.ca-cert: certificate or key file '/CASA/dcbw/Desktop/certinfra/CA/eaptest_ca_cert.pem' does not exist*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
-	                       "*<warn>  keyfile: 802-1x.client-cert: certificate or key file '/CASA/dcbw/Desktop/certinfra/client.pem' does not exist*");
-	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
-	                       "*<warn>  keyfile: 802-1x.private-key: certificate or key file '/CASA/dcbw/Desktop/certinfra/client.pem' does not exist*");
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	                       "*<warn> * keyfile: 802-1x.ca-cert: certificate or key file '/CASA/dcbw/Desktop/certinfra/CA/eaptest_ca_cert.pem' does not exist*");
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	                       "*<warn> * keyfile: 802-1x.client-cert: certificate or key file '/CASA/dcbw/Desktop/certinfra/client.pem' does not exist*");
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_MESSAGE,
+	                       "*<warn> * keyfile: 802-1x.private-key: certificate or key file '/CASA/dcbw/Desktop/certinfra/client.pem' does not exist*");
 	connection = nm_keyfile_plugin_connection_from_file (TEST_KEYFILES_DIR "/Test_Wired_TLS_Old", &error);
 	g_assert_no_error (error);
 	g_assert (connection);
@@ -3000,71 +3000,71 @@ int main (int argc, char **argv)
 	nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
 
 	/* The tests */
-	g_test_add_func ("/keyfile/test_read_valid_wired_connection ", test_read_valid_wired_connection);
-	g_test_add_func ("/keyfile/test_write_wired_connection ", test_write_wired_connection);
+	g_test_add_func ("/keyfile/test_read_valid_wired_connection", test_read_valid_wired_connection);
+	g_test_add_func ("/keyfile/test_write_wired_connection", test_write_wired_connection);
 
-	g_test_add_func ("/keyfile/test_read_ip6_wired_connection ", test_read_ip6_wired_connection);
-	g_test_add_func ("/keyfile/test_write_ip6_wired_connection ", test_write_ip6_wired_connection);
+	g_test_add_func ("/keyfile/test_read_ip6_wired_connection", test_read_ip6_wired_connection);
+	g_test_add_func ("/keyfile/test_write_ip6_wired_connection", test_write_ip6_wired_connection);
 
-	g_test_add_func ("/keyfile/test_read_wired_mac_case ", test_read_wired_mac_case);
-	g_test_add_func ("/keyfile/test_read_mac_old_format ", test_read_mac_old_format);
-	g_test_add_func ("/keyfile/test_read_mac_ib_old_format ", test_read_mac_ib_old_format);
+	g_test_add_func ("/keyfile/test_read_wired_mac_case", test_read_wired_mac_case);
+	g_test_add_func ("/keyfile/test_read_mac_old_format", test_read_mac_old_format);
+	g_test_add_func ("/keyfile/test_read_mac_ib_old_format", test_read_mac_ib_old_format);
 
-	g_test_add_func ("/keyfile/test_read_valid_wireless_connection ", test_read_valid_wireless_connection);
-	g_test_add_func ("/keyfile/test_write_wireless_connection ", test_write_wireless_connection);
+	g_test_add_func ("/keyfile/test_read_valid_wireless_connection", test_read_valid_wireless_connection);
+	g_test_add_func ("/keyfile/test_write_wireless_connection", test_write_wireless_connection);
 
-	g_test_add_func ("/keyfile/test_read_string_ssid ", test_read_string_ssid);
-	g_test_add_func ("/keyfile/test_write_string_ssid ", test_write_string_ssid);
+	g_test_add_func ("/keyfile/test_read_string_ssid", test_read_string_ssid);
+	g_test_add_func ("/keyfile/test_write_string_ssid", test_write_string_ssid);
 
-	g_test_add_func ("/keyfile/test_read_intlist_ssid ", test_read_intlist_ssid);
-	g_test_add_func ("/keyfile/test_write_intlist_ssid ", test_write_intlist_ssid);
+	g_test_add_func ("/keyfile/test_read_intlist_ssid", test_read_intlist_ssid);
+	g_test_add_func ("/keyfile/test_write_intlist_ssid", test_write_intlist_ssid);
 
-	g_test_add_func ("/keyfile/test_read_intlike_ssid ", test_read_intlike_ssid);
-	g_test_add_func ("/keyfile/test_write_intlike_ssid ", test_write_intlike_ssid);
+	g_test_add_func ("/keyfile/test_read_intlike_ssid", test_read_intlike_ssid);
+	g_test_add_func ("/keyfile/test_write_intlike_ssid", test_write_intlike_ssid);
 
-	g_test_add_func ("/keyfile/test_read_intlike_ssid_2 ", test_read_intlike_ssid_2);
-	g_test_add_func ("/keyfile/test_write_intlike_ssid_2 ", test_write_intlike_ssid_2);
+	g_test_add_func ("/keyfile/test_read_intlike_ssid_2", test_read_intlike_ssid_2);
+	g_test_add_func ("/keyfile/test_write_intlike_ssid_2", test_write_intlike_ssid_2);
 
-	g_test_add_func ("/keyfile/test_read_bt_dun_connection ", test_read_bt_dun_connection);
-	g_test_add_func ("/keyfile/test_write_bt_dun_connection ", test_write_bt_dun_connection);
+	g_test_add_func ("/keyfile/test_read_bt_dun_connection", test_read_bt_dun_connection);
+	g_test_add_func ("/keyfile/test_write_bt_dun_connection", test_write_bt_dun_connection);
 
-	g_test_add_func ("/keyfile/test_read_gsm_connection ", test_read_gsm_connection);
-	g_test_add_func ("/keyfile/test_write_gsm_connection ", test_write_gsm_connection);
+	g_test_add_func ("/keyfile/test_read_gsm_connection", test_read_gsm_connection);
+	g_test_add_func ("/keyfile/test_write_gsm_connection", test_write_gsm_connection);
 
-	g_test_add_func ("/keyfile/test_read_wired_8021x_tls_blob_connection ", test_read_wired_8021x_tls_blob_connection);
-	g_test_add_func ("/keyfile/test_read_wired_8021x_tls_bad_path_connection ", test_read_wired_8021x_tls_bad_path_connection);
+	g_test_add_func ("/keyfile/test_read_wired_8021x_tls_blob_connection", test_read_wired_8021x_tls_blob_connection);
+	g_test_add_func ("/keyfile/test_read_wired_8021x_tls_bad_path_connection", test_read_wired_8021x_tls_bad_path_connection);
 
-	g_test_add_func ("/keyfile/test_read_wired_8021x_tls_old_connection ", test_read_wired_8021x_tls_old_connection);
-	g_test_add_func ("/keyfile/test_read_wired_8021x_tls_new_connection ", test_read_wired_8021x_tls_new_connection);
-	g_test_add_func ("/keyfile/test_write_wired_8021x_tls_connection_path ", test_write_wired_8021x_tls_connection_path);
-	g_test_add_func ("/keyfile/test_write_wired_8021x_tls_connection_blob ", test_write_wired_8021x_tls_connection_blob);
+	g_test_add_func ("/keyfile/test_read_wired_8021x_tls_old_connection", test_read_wired_8021x_tls_old_connection);
+	g_test_add_func ("/keyfile/test_read_wired_8021x_tls_new_connection", test_read_wired_8021x_tls_new_connection);
+	g_test_add_func ("/keyfile/test_write_wired_8021x_tls_connection_path", test_write_wired_8021x_tls_connection_path);
+	g_test_add_func ("/keyfile/test_write_wired_8021x_tls_connection_blob", test_write_wired_8021x_tls_connection_blob);
 
-	g_test_add_func ("/keyfile/test_read_infiniband_connection ", test_read_infiniband_connection);
-	g_test_add_func ("/keyfile/test_write_infiniband_connection ", test_write_infiniband_connection);
+	g_test_add_func ("/keyfile/test_read_infiniband_connection", test_read_infiniband_connection);
+	g_test_add_func ("/keyfile/test_write_infiniband_connection", test_write_infiniband_connection);
 
-	g_test_add_func ("/keyfile/test_read_bridge_main ", test_read_bridge_main);
-	g_test_add_func ("/keyfile/test_write_bridge_main ", test_write_bridge_main);
-	g_test_add_func ("/keyfile/test_read_bridge_component ", test_read_bridge_component);
-	g_test_add_func ("/keyfile/test_write_bridge_component ", test_write_bridge_component);
+	g_test_add_func ("/keyfile/test_read_bridge_main", test_read_bridge_main);
+	g_test_add_func ("/keyfile/test_write_bridge_main", test_write_bridge_main);
+	g_test_add_func ("/keyfile/test_read_bridge_component", test_read_bridge_component);
+	g_test_add_func ("/keyfile/test_write_bridge_component", test_write_bridge_component);
 
-	g_test_add_func ("/keyfile/test_read_new_wired_group_name ", test_read_new_wired_group_name);
-	g_test_add_func ("/keyfile/test_write_new_wired_group_name ", test_write_new_wired_group_name);
-	g_test_add_func ("/keyfile/test_read_new_wireless_group_names ", test_read_new_wireless_group_names);
-	g_test_add_func ("/keyfile/test_write_new_wireless_group_names ", test_write_new_wireless_group_names);
+	g_test_add_func ("/keyfile/test_read_new_wired_group_name", test_read_new_wired_group_name);
+	g_test_add_func ("/keyfile/test_write_new_wired_group_name", test_write_new_wired_group_name);
+	g_test_add_func ("/keyfile/test_read_new_wireless_group_names", test_read_new_wireless_group_names);
+	g_test_add_func ("/keyfile/test_write_new_wireless_group_names", test_write_new_wireless_group_names);
 
-	g_test_add_func ("/keyfile/test_read_missing_vlan_setting ", test_read_missing_vlan_setting);
-	g_test_add_func ("/keyfile/test_read_missing_vlan_flags ", test_read_missing_vlan_flags);
-	g_test_add_func ("/keyfile/test_read_missing_id_uuid ", test_read_missing_id_uuid);
+	g_test_add_func ("/keyfile/test_read_missing_vlan_setting", test_read_missing_vlan_setting);
+	g_test_add_func ("/keyfile/test_read_missing_vlan_flags", test_read_missing_vlan_flags);
+	g_test_add_func ("/keyfile/test_read_missing_id_uuid", test_read_missing_id_uuid);
 
 	g_test_add_func ("/keyfile/test_read_minimal", test_read_minimal);
 	g_test_add_func ("/keyfile/test_read_minimal_slave", test_read_minimal_slave);
 
-	g_test_add_func ("/keyfile/test_read_enum_property ", test_read_enum_property);
-	g_test_add_func ("/keyfile/test_write_enum_property ", test_write_enum_property);
-	g_test_add_func ("/keyfile/test_read_flags_property ", test_read_flags_property);
-	g_test_add_func ("/keyfile/test_write_flags_property ", test_write_flags_property);
+	g_test_add_func ("/keyfile/test_read_enum_property", test_read_enum_property);
+	g_test_add_func ("/keyfile/test_write_enum_property", test_write_enum_property);
+	g_test_add_func ("/keyfile/test_read_flags_property", test_read_flags_property);
+	g_test_add_func ("/keyfile/test_write_flags_property", test_write_flags_property);
 
-	g_test_add_func ("/keyfile/test_nm_keyfile_plugin_utils_escape_filename ", test_nm_keyfile_plugin_utils_escape_filename);
+	g_test_add_func ("/keyfile/test_nm_keyfile_plugin_utils_escape_filename", test_nm_keyfile_plugin_utils_escape_filename);
 
 	return g_test_run ();
 }
diff --git a/src/settings/plugins/keyfile/utils.h b/src/settings/plugins/keyfile/utils.h
index 0b2b6f4e..c18fb2bc 100644
--- a/src/settings/plugins/keyfile/utils.h
+++ b/src/settings/plugins/keyfile/utils.h
@@ -27,7 +27,7 @@
 #define KEYFILE_PLUGIN_NAME "keyfile"
 #define KEYFILE_PLUGIN_INFO "(c) 2007 - 2015 Red Hat, Inc.  To report bugs please use the NetworkManager mailing list."
 
-#define NM_KEYFILE_CONNECTION_LOG_PATH(path)  str_if_set (path,"in-memory")
+#define NM_KEYFILE_CONNECTION_LOG_PATH(path)  ((path) ?: "in-memory")
 #define NM_KEYFILE_CONNECTION_LOG_FMT         "%s (%s,\"%s\")"
 #define NM_KEYFILE_CONNECTION_LOG_ARG(con)    NM_KEYFILE_CONNECTION_LOG_PATH (nm_settings_connection_get_filename ((NMSettingsConnection *) (con))), nm_connection_get_uuid ((NMConnection *) (con)), nm_connection_get_id ((NMConnection *) (con))
 #define NM_KEYFILE_CONNECTION_LOG_FMTD        "%s (%s,\"%s\",%p)"