about summary refs log tree commit diff
path: root/debian/patches/Read-system-connections-from-run.patch
blob: 69790014c607115e35fe202acaa5c8f8da977195 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Tue, 21 Jun 2016 17:22:12 +0200
Subject: Read system-connections from /run

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=773069
Bug-Ubuntu: https://launchpad.net/bugs/1594551
---
 src/settings/plugins/keyfile/nms-keyfile-plugin.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Index: network-manager-1.12.2/src/settings/plugins/keyfile/nms-keyfile-plugin.c
===================================================================
--- network-manager-1.12.2.orig/src/settings/plugins/keyfile/nms-keyfile-plugin.c
+++ network-manager-1.12.2/src/settings/plugins/keyfile/nms-keyfile-plugin.c
@@ -411,6 +411,8 @@ _sort_paths (const char **f1, const char
 	return strcmp (*f1, *f2);
 }
 
+#define NM_CONFIG_KEYFILE_PATH_RUNTIME "/run/NetworkManager/system-connections"
+
 static void
 read_connections (NMSettingsPlugin *config)
 {
@@ -446,6 +448,22 @@ read_connections (NMSettingsPlugin *conf
 	}
 	g_dir_close (dir);
 
+	/* Now add files from /run too, unless they have a file in /etc */
+	dir = g_dir_open (NM_CONFIG_KEYFILE_PATH_RUNTIME, 0, &error);
+	if (dir) {
+		while ((item = g_dir_read_name (dir))) {
+			g_autofree char *etc_file = g_build_filename (nms_keyfile_utils_get_path (), item, NULL);
+			if (nms_keyfile_utils_should_ignore_file (item) || g_access (etc_file, F_OK) == 0)
+				continue;
+			g_ptr_array_add (filenames, g_build_filename (NM_CONFIG_KEYFILE_PATH_RUNTIME, item, NULL));
+		}
+		g_dir_close (dir);
+	} else {
+		nm_log_dbg (LOGD_SETTINGS, "keyfile: cannot read directory " NM_CONFIG_KEYFILE_PATH_RUNTIME ": %s",
+		            error->message);
+		g_clear_error (&error);
+	}
+
 	/* While reloading, we don't replace connections that we already loaded while
 	 * iterating over the files.
 	 *