1 |
qiaomuf 12/01/05 01:56:32 |
2 |
|
3 |
Added: |
4 |
networkmanager-0.9.2.0-ifnet-ignore-user-connections.patch |
5 |
networkmanager-0.9.2.0-ifnet-remove-system-prefix.patch |
6 |
Log: |
7 |
Make ifnet ignore user connections (bug #392409) |
8 |
|
9 |
Thanks to David Narvaez for his great help on this problem. |
10 |
|
11 |
(Portage version: 2.1.10.43/cvs/Linux x86_64) |
12 |
|
13 |
Revision Changes Path |
14 |
1.1 net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-ignore-user-connections.patch |
15 |
|
16 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-ignore-user-connections.patch?rev=1.1&view=markup |
17 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-ignore-user-connections.patch?rev=1.1&content-type=text/plain |
18 |
|
19 |
Index: networkmanager-0.9.2.0-ifnet-ignore-user-connections.patch |
20 |
=================================================================== |
21 |
From 022508394484dd1c66a57be565a2f9aa791f7a2f Mon Sep 17 00:00:00 2001 |
22 |
From: Mu Qiao <qiaomuf@g.o> |
23 |
Date: Thu, 15 Dec 2011 10:01:50 +0800 |
24 |
Subject: [PATCH 3/3] ifnet: ignore per-user connections |
25 |
|
26 |
--- |
27 |
src/settings/plugins/ifnet/plugin.c | 46 +++++++++++++++++++++++++++++++---- |
28 |
1 files changed, 41 insertions(+), 5 deletions(-) |
29 |
|
30 |
diff --git a/src/settings/plugins/ifnet/plugin.c b/src/settings/plugins/ifnet/plugin.c |
31 |
index 5908368..14f2a90 100644 |
32 |
--- a/src/settings/plugins/ifnet/plugin.c |
33 |
+++ b/src/settings/plugins/ifnet/plugin.c |
34 |
@@ -180,7 +180,7 @@ monitor_file_changes (const char *filename, |
35 |
/* Callback for nm_settings_connection_replace_and_commit. Report any errors |
36 |
* encountered when commiting connection settings updates. */ |
37 |
static void |
38 |
-commit_cb (NMSettingsConnection *connection, GError *error, gpointer unused) |
39 |
+commit_cb (NMSettingsConnection *connection, GError *error, gpointer unused) |
40 |
{ |
41 |
if (error) { |
42 |
PLUGIN_WARN (IFNET_PLUGIN_NAME, " error updating: %s", |
43 |
@@ -317,6 +317,26 @@ reload_connections (gpointer config) |
44 |
g_list_free (conn_names); |
45 |
} |
46 |
|
47 |
+static void |
48 |
+check_flagged_secrets (NMSetting *setting, |
49 |
+ const char *key, |
50 |
+ const GValue *value, |
51 |
+ GParamFlags flags, |
52 |
+ gpointer user_data) |
53 |
+{ |
54 |
+ gboolean *is_system_secret = user_data; |
55 |
+ |
56 |
+ if (flags & NM_SETTING_PARAM_SECRET) { |
57 |
+ NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE; |
58 |
+ |
59 |
+ nm_setting_get_secret_flags (setting, key, &secret_flags, NULL); |
60 |
+ |
61 |
+ if (secret_flags != NM_SETTING_SECRET_FLAG_NONE) { |
62 |
+ *is_system_secret = TRUE; |
63 |
+ } |
64 |
+ } |
65 |
+} |
66 |
+ |
67 |
static NMSettingsConnection * |
68 |
add_connection (NMSystemConfigInterface *config, |
69 |
NMConnection *source, |
70 |
@@ -324,11 +344,27 @@ add_connection (NMSystemConfigInterface *config, |
71 |
{ |
72 |
NMIfnetConnection *connection = NULL; |
73 |
char *conn_name; |
74 |
+ gboolean has_flagged_secrets = FALSE; |
75 |
+ NMSettingConnection *settings = NM_SETTING_CONNECTION ( |
76 |
+ nm_connection_get_setting (source, NM_TYPE_SETTING_CONNECTION)); |
77 |
+ |
78 |
+ g_assert (settings); |
79 |
+ /* If the connection is not available for all users, ignore |
80 |
+ * it as this plugin only deals with System Connections */ |
81 |
+ if (nm_setting_connection_get_num_permissions (settings)) |
82 |
+ return NULL; |
83 |
+ |
84 |
+ /* If the connection has flagged secrets, ignore |
85 |
+ * it as this plugin does not deal with user agent service */ |
86 |
+ nm_connection_for_each_setting_value (source, check_flagged_secrets, &has_flagged_secrets); |
87 |
+ |
88 |
+ if (!has_flagged_secrets) { |
89 |
+ conn_name = ifnet_add_new_connection (source, CONF_NET_FILE, WPA_SUPPLICANT_CONF, error); |
90 |
+ if (conn_name) |
91 |
+ connection = nm_ifnet_connection_new (conn_name, source); |
92 |
+ reload_connections (config); |
93 |
+ } |
94 |
|
95 |
- conn_name = ifnet_add_new_connection (source, CONF_NET_FILE, WPA_SUPPLICANT_CONF, error); |
96 |
- if (conn_name) |
97 |
- connection = nm_ifnet_connection_new (conn_name, source); |
98 |
- reload_connections (config); |
99 |
return connection ? NM_SETTINGS_CONNECTION (connection) : NULL; |
100 |
} |
101 |
|
102 |
-- |
103 |
1.7.3.4 |
104 |
|
105 |
|
106 |
|
107 |
|
108 |
1.1 net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-remove-system-prefix.patch |
109 |
|
110 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-remove-system-prefix.patch?rev=1.1&view=markup |
111 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-remove-system-prefix.patch?rev=1.1&content-type=text/plain |
112 |
|
113 |
Index: networkmanager-0.9.2.0-ifnet-remove-system-prefix.patch |
114 |
=================================================================== |
115 |
From 145f86d0e98f5525e69a86c15be3f932104b5129 Mon Sep 17 00:00:00 2001 |
116 |
From: Mu Qiao <qiaomuf@g.o> |
117 |
Date: Thu, 22 Dec 2011 09:57:26 +0800 |
118 |
Subject: [PATCH 4/4] ifnet: remove system prefix |
119 |
|
120 |
As all connections are system connection so the prefix is meaningless. |
121 |
Drop it now. |
122 |
--- |
123 |
po/POTFILES.in | 1 - |
124 |
src/settings/plugins/ifnet/connection_parser.c | 12 ++---------- |
125 |
2 files changed, 2 insertions(+), 11 deletions(-) |
126 |
|
127 |
diff --git a/po/POTFILES.in b/po/POTFILES.in |
128 |
index f021275..20b60d3 100644 |
129 |
--- a/po/POTFILES.in |
130 |
+++ b/po/POTFILES.in |
131 |
@@ -26,6 +26,5 @@ src/nm-device-olpc-mesh.c |
132 |
src/nm-manager.c |
133 |
src/nm-netlink-monitor.c |
134 |
src/settings/plugins/ifcfg-rh/reader.c |
135 |
-src/settings/plugins/ifnet/connection_parser.c |
136 |
src/settings/nm-settings-utils.c |
137 |
|
138 |
diff --git a/src/settings/plugins/ifnet/connection_parser.c b/src/settings/plugins/ifnet/connection_parser.c |
139 |
index 66ce318..97bc7ff 100644 |
140 |
--- a/src/settings/plugins/ifnet/connection_parser.c |
141 |
+++ b/src/settings/plugins/ifnet/connection_parser.c |
142 |
@@ -45,12 +45,6 @@ |
143 |
#include "connection_parser.h" |
144 |
#include "nm-ifnet-connection.h" |
145 |
|
146 |
-static const char * |
147 |
-get_prefix (void) |
148 |
-{ |
149 |
- return _("System"); |
150 |
-} |
151 |
- |
152 |
static void |
153 |
update_connection_id (NMConnection *connection, const char *conn_name) |
154 |
{ |
155 |
@@ -62,11 +56,9 @@ update_connection_id (NMConnection *connection, const char *conn_name) |
156 |
|
157 |
name_len = strlen (conn_name); |
158 |
if ((name_len > 2) && (g_str_has_prefix (conn_name, "0x"))) { |
159 |
- gchar * conn_name_printable = utils_hexstr2bin (conn_name + 2, name_len - 2); |
160 |
- idstr = g_strdup_printf ("%s (%s)", get_prefix (), conn_name_printable); |
161 |
- g_free (conn_name_printable); |
162 |
+ idstr = utils_hexstr2bin (conn_name + 2, name_len - 2); |
163 |
} else |
164 |
- idstr = g_strdup_printf ("%s (%s)", get_prefix (), conn_name); |
165 |
+ idstr = g_strdup_printf("%s", conn_name); |
166 |
uuid_base = idstr; |
167 |
uuid = nm_utils_uuid_generate_from_string (uuid_base); |
168 |
setting = |
169 |
-- |
170 |
1.7.3.4 |