summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2012-01-05 01:56:32 +0000
committerMu Qiao <qiaomuf@gentoo.org>2012-01-05 01:56:32 +0000
commit6e025749423e23271c3480068d3e7b1e5bc2c084 (patch)
tree58c172bdafe5ba04d8401b2d1c2611bc5f336be2 /net-misc/networkmanager
parentFix building with automake-1.11.2 (bug #397411, thanks to Alphat-PC for the p... (diff)
downloadgentoo-2-6e025749423e23271c3480068d3e7b1e5bc2c084.tar.gz
gentoo-2-6e025749423e23271c3480068d3e7b1e5bc2c084.tar.bz2
gentoo-2-6e025749423e23271c3480068d3e7b1e5bc2c084.zip
Make ifnet ignore user connections (bug #392409)
Thanks to David Narvaez for his great help on this problem. (Portage version: 2.1.10.43/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/networkmanager')
-rw-r--r--net-misc/networkmanager/ChangeLog14
-rw-r--r--net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-ignore-user-connections.patch84
-rw-r--r--net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-remove-system-prefix.patch57
-rw-r--r--net-misc/networkmanager/networkmanager-0.9.2.0-r2.ebuild (renamed from net-misc/networkmanager/networkmanager-0.9.2.0-r1.ebuild)8
4 files changed, 159 insertions, 4 deletions
diff --git a/net-misc/networkmanager/ChangeLog b/net-misc/networkmanager/ChangeLog
index 28d514ec5611..e1b7f8105a72 100644
--- a/net-misc/networkmanager/ChangeLog
+++ b/net-misc/networkmanager/ChangeLog
@@ -1,6 +1,16 @@
# ChangeLog for net-misc/networkmanager
-# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/ChangeLog,v 1.123 2011/12/16 20:36:08 tetromino Exp $
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/ChangeLog,v 1.124 2012/01/05 01:56:32 qiaomuf Exp $
+
+*networkmanager-0.9.2.0-r2 (05 Jan 2012)
+
+ 05 Jan 2012; Mu Qiao <qiaomuf@gentoo.org> -networkmanager-0.9.2.0-r1.ebuild,
+ +networkmanager-0.9.2.0-r2.ebuild,
+ +files/networkmanager-0.9.2.0-ifnet-ignore-user-connections.patch,
+ +files/networkmanager-0.9.2.0-ifnet-remove-system-prefix.patch:
+ Make ifnet ignore user connections (bug #392409)
+
+ Thanks to David Narvaez for his great help on this problem.
16 Dec 2011; Alexandre Rostovtsev <tetromino@gentoo.org> metadata.xml:
s/steev/tetromino/ in maintainers. Acked by Nirbheek and Steev.
diff --git a/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-ignore-user-connections.patch b/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-ignore-user-connections.patch
new file mode 100644
index 000000000000..73dc477c5a4c
--- /dev/null
+++ b/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-ignore-user-connections.patch
@@ -0,0 +1,84 @@
+From 022508394484dd1c66a57be565a2f9aa791f7a2f Mon Sep 17 00:00:00 2001
+From: Mu Qiao <qiaomuf@gentoo.org>
+Date: Thu, 15 Dec 2011 10:01:50 +0800
+Subject: [PATCH 3/3] ifnet: ignore per-user connections
+
+---
+ src/settings/plugins/ifnet/plugin.c | 46 +++++++++++++++++++++++++++++++----
+ 1 files changed, 41 insertions(+), 5 deletions(-)
+
+diff --git a/src/settings/plugins/ifnet/plugin.c b/src/settings/plugins/ifnet/plugin.c
+index 5908368..14f2a90 100644
+--- a/src/settings/plugins/ifnet/plugin.c
++++ b/src/settings/plugins/ifnet/plugin.c
+@@ -180,7 +180,7 @@ monitor_file_changes (const char *filename,
+ /* Callback for nm_settings_connection_replace_and_commit. Report any errors
+ * encountered when commiting connection settings updates. */
+ static void
+-commit_cb (NMSettingsConnection *connection, GError *error, gpointer unused)
++commit_cb (NMSettingsConnection *connection, GError *error, gpointer unused)
+ {
+ if (error) {
+ PLUGIN_WARN (IFNET_PLUGIN_NAME, " error updating: %s",
+@@ -317,6 +317,26 @@ reload_connections (gpointer config)
+ g_list_free (conn_names);
+ }
+
++static void
++check_flagged_secrets (NMSetting *setting,
++ const char *key,
++ const GValue *value,
++ GParamFlags flags,
++ gpointer user_data)
++{
++ gboolean *is_system_secret = user_data;
++
++ if (flags & NM_SETTING_PARAM_SECRET) {
++ NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
++
++ nm_setting_get_secret_flags (setting, key, &secret_flags, NULL);
++
++ if (secret_flags != NM_SETTING_SECRET_FLAG_NONE) {
++ *is_system_secret = TRUE;
++ }
++ }
++}
++
+ static NMSettingsConnection *
+ add_connection (NMSystemConfigInterface *config,
+ NMConnection *source,
+@@ -324,11 +344,27 @@ add_connection (NMSystemConfigInterface *config,
+ {
+ NMIfnetConnection *connection = NULL;
+ char *conn_name;
++ gboolean has_flagged_secrets = FALSE;
++ NMSettingConnection *settings = NM_SETTING_CONNECTION (
++ nm_connection_get_setting (source, NM_TYPE_SETTING_CONNECTION));
++
++ g_assert (settings);
++ /* If the connection is not available for all users, ignore
++ * it as this plugin only deals with System Connections */
++ if (nm_setting_connection_get_num_permissions (settings))
++ return NULL;
++
++ /* If the connection has flagged secrets, ignore
++ * it as this plugin does not deal with user agent service */
++ nm_connection_for_each_setting_value (source, check_flagged_secrets, &has_flagged_secrets);
++
++ if (!has_flagged_secrets) {
++ conn_name = ifnet_add_new_connection (source, CONF_NET_FILE, WPA_SUPPLICANT_CONF, error);
++ if (conn_name)
++ connection = nm_ifnet_connection_new (conn_name, source);
++ reload_connections (config);
++ }
+
+- conn_name = ifnet_add_new_connection (source, CONF_NET_FILE, WPA_SUPPLICANT_CONF, error);
+- if (conn_name)
+- connection = nm_ifnet_connection_new (conn_name, source);
+- reload_connections (config);
+ return connection ? NM_SETTINGS_CONNECTION (connection) : NULL;
+ }
+
+--
+1.7.3.4
+
diff --git a/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-remove-system-prefix.patch b/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-remove-system-prefix.patch
new file mode 100644
index 000000000000..1dcab2f6e115
--- /dev/null
+++ b/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-remove-system-prefix.patch
@@ -0,0 +1,57 @@
+From 145f86d0e98f5525e69a86c15be3f932104b5129 Mon Sep 17 00:00:00 2001
+From: Mu Qiao <qiaomuf@gentoo.org>
+Date: Thu, 22 Dec 2011 09:57:26 +0800
+Subject: [PATCH 4/4] ifnet: remove system prefix
+
+As all connections are system connection so the prefix is meaningless.
+Drop it now.
+---
+ po/POTFILES.in | 1 -
+ src/settings/plugins/ifnet/connection_parser.c | 12 ++----------
+ 2 files changed, 2 insertions(+), 11 deletions(-)
+
+diff --git a/po/POTFILES.in b/po/POTFILES.in
+index f021275..20b60d3 100644
+--- a/po/POTFILES.in
++++ b/po/POTFILES.in
+@@ -26,6 +26,5 @@ src/nm-device-olpc-mesh.c
+ src/nm-manager.c
+ src/nm-netlink-monitor.c
+ src/settings/plugins/ifcfg-rh/reader.c
+-src/settings/plugins/ifnet/connection_parser.c
+ src/settings/nm-settings-utils.c
+
+diff --git a/src/settings/plugins/ifnet/connection_parser.c b/src/settings/plugins/ifnet/connection_parser.c
+index 66ce318..97bc7ff 100644
+--- a/src/settings/plugins/ifnet/connection_parser.c
++++ b/src/settings/plugins/ifnet/connection_parser.c
+@@ -45,12 +45,6 @@
+ #include "connection_parser.h"
+ #include "nm-ifnet-connection.h"
+
+-static const char *
+-get_prefix (void)
+-{
+- return _("System");
+-}
+-
+ static void
+ update_connection_id (NMConnection *connection, const char *conn_name)
+ {
+@@ -62,11 +56,9 @@ update_connection_id (NMConnection *connection, const char *conn_name)
+
+ name_len = strlen (conn_name);
+ if ((name_len > 2) && (g_str_has_prefix (conn_name, "0x"))) {
+- gchar * conn_name_printable = utils_hexstr2bin (conn_name + 2, name_len - 2);
+- idstr = g_strdup_printf ("%s (%s)", get_prefix (), conn_name_printable);
+- g_free (conn_name_printable);
++ idstr = utils_hexstr2bin (conn_name + 2, name_len - 2);
+ } else
+- idstr = g_strdup_printf ("%s (%s)", get_prefix (), conn_name);
++ idstr = g_strdup_printf("%s", conn_name);
+ uuid_base = idstr;
+ uuid = nm_utils_uuid_generate_from_string (uuid_base);
+ setting =
+--
+1.7.3.4
+
diff --git a/net-misc/networkmanager/networkmanager-0.9.2.0-r1.ebuild b/net-misc/networkmanager/networkmanager-0.9.2.0-r2.ebuild
index e63c16a003cd..d56319193ce3 100644
--- a/net-misc/networkmanager/networkmanager-0.9.2.0-r1.ebuild
+++ b/net-misc/networkmanager/networkmanager-0.9.2.0-r2.ebuild
@@ -1,6 +1,6 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/networkmanager-0.9.2.0-r1.ebuild,v 1.1 2011/12/07 03:08:53 qiaomuf Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/networkmanager-0.9.2.0-r2.ebuild,v 1.1 2012/01/05 01:56:32 qiaomuf Exp $
EAPI="4"
GNOME_ORG_MODULE="NetworkManager"
@@ -97,6 +97,10 @@ src_prepare() {
epatch "${FILESDIR}/${PN}-0.9.1.95-force-libnl1.1.patch"
# Migrate to openrc style
epatch "${FILESDIR}/${P}-ifnet-openrc-style.patch"
+ # Ignore per-user connections
+ epatch "${FILESDIR}/${P}-ifnet-ignore-user-connections.patch"
+ # Remove system prefix
+ epatch "${FILESDIR}/${P}-ifnet-remove-system-prefix.patch"
eautoreconf
default