public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in net-misc/networkmanager/files: networkmanager-0.8.2-shared-connection.patch
@ 2011-01-24  7:31 Mu Qiao (qiaomuf)
  0 siblings, 0 replies; 2+ messages in thread
From: Mu Qiao (qiaomuf) @ 2011-01-24  7:31 UTC (permalink / raw
  To: gentoo-commits

qiaomuf     11/01/24 07:31:49

  Added:                networkmanager-0.8.2-shared-connection.patch
  Log:
  Revision bump wrt bug #350476
  
  (Portage version: 2.1.9.25/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  net-misc/networkmanager/files/networkmanager-0.8.2-shared-connection.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.8.2-shared-connection.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.8.2-shared-connection.patch?rev=1.1&content-type=text/plain

Index: networkmanager-0.8.2-shared-connection.patch
===================================================================
From 5a67c7a5ad341fa84091287eb6452458c7ee24b0 Mon Sep 17 00:00:00 2001
From: Mu Qiao <qiaomuf@gentoo.org>
Date: Wed, 5 Jan 2011 13:30:08 +0800
Subject: [PATCH] Support shared and link-local method for ipv4
 Signed-off-by: Mu Qiao <qiaomuf@gentoo.org>
 fix flush_to_file, return TRUE when nothing changed
 ssid do not lose quotes anymore
 do not delete old connection when ssid is not changed

Signed-off-by: Mu Qiao <qiaomuf@gentoo.org>
---
 system-settings/plugins/ifnet/connection_parser.c  |   92 ++++++++++++++------
 system-settings/plugins/ifnet/net_parser.c         |   55 +++++++-----
 system-settings/plugins/ifnet/net_parser.h         |    4 +-
 system-settings/plugins/ifnet/net_utils.c          |    4 +
 .../plugins/ifnet/nm-ifnet-connection.c            |    8 +-
 system-settings/plugins/ifnet/wpa_parser.c         |   21 +++--
 6 files changed, 123 insertions(+), 61 deletions(-)

diff --git a/system-settings/plugins/ifnet/connection_parser.c b/system-settings/plugins/ifnet/connection_parser.c
index f9fae51..539f33c 100644
--- a/system-settings/plugins/ifnet/connection_parser.c
+++ b/system-settings/plugins/ifnet/connection_parser.c
@@ -557,7 +557,7 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
 
 	NMSettingIP4Config *ip4_setting =
 	    NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
-	gchar *value;
+	gchar *value, *method = NULL;
 	gboolean is_static_block = is_static_ip4 (conn_name);
 	ip_block *iblock = NULL;
 
@@ -569,12 +569,42 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
 		      && strstr (value, "nogateway") ? TRUE : FALSE, NULL);
 
 	if (!is_static_block) {
-		g_object_set (ip4_setting,
-			      NM_SETTING_IP4_CONFIG_METHOD,
-			      NM_SETTING_IP4_CONFIG_METHOD_AUTO,
-			      NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
-		PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Using DHCP for %s",
-			      conn_name);
+		method = ifnet_get_data (conn_name, "config");
+		if (!method){
+			g_set_error (error, ifnet_plugin_error_quark (), 0,
+						 "Unknown config for %s", conn_name);
+			g_object_unref (ip4_setting);
+			return;
+		}
+		if (!strcmp (method, "dhcp"))
+			g_object_set (ip4_setting,
+						  NM_SETTING_IP4_CONFIG_METHOD,
+						  NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+						  NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
+		else if (!strcmp (method, "autoip")){
+			g_object_set (ip4_setting,
+						  NM_SETTING_IP4_CONFIG_METHOD,
+						  NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
+						  NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
+			nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
+			return;
+		}
+		else if (!strcmp (method, "shared")){
+			g_object_set (ip4_setting,
+						  NM_SETTING_IP4_CONFIG_METHOD,
+						  NM_SETTING_IP4_CONFIG_METHOD_SHARED,
+						  NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
+			nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
+			return;
+		}
+		else {
+			g_set_error (error, ifnet_plugin_error_quark (), 0,
+						 "Unknown config for %s", conn_name);
+			g_object_unref (ip4_setting);
+			return;
+		}
+		PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Using %s method for %s",
+					  method, conn_name);
 	} else {
 		iblock = convert_ip4_config_block (conn_name);
 		if (!iblock) {
@@ -625,7 +655,7 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
 	}
 
 	/* add dhcp hostname and client id */
-	if (!is_static_block) {
+	if (method && !strcmp (method, "dhcp")) {
 		gchar *dhcp_hostname, *client_id;
 
 		get_dhcp_hostname_and_client_id (&dhcp_hostname, &client_id);
@@ -712,7 +742,6 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
 		iblock = iblock->next;
 		destroy_ip_block (current_iblock);
 	}
-
 	/* Finally add setting to connection */
 	nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
 }
@@ -1243,10 +1272,10 @@ parse_wpa_psk (gchar * psk, GError ** error)
 	 * the passphrase contains spaces.
 	 */
 
-	p = psk;
-	if (p[0] == '"' && psk[strlen (psk) - 1] == '"')
+	p = g_strdup (psk);
+	if (p[0] == '"' && p[strlen (p) - 1] == '"')
 		quoted = TRUE;
-	if (!quoted && (strlen (psk) == 64)) {
+	if (!quoted && (strlen (p) == 64)) {
 		/* Verify the hex PSK; 64 digits */
 		if (!is_hex (p)) {
 			g_set_error (error, ifnet_plugin_error_quark (),
@@ -1254,7 +1283,7 @@ parse_wpa_psk (gchar * psk, GError ** error)
 				     "Invalid WPA_PSK (contains non-hexadecimal characters)");
 			goto out;
 		}
-		hashed = g_strdup (psk);
+		hashed = g_strdup (p);
 	} else {
 		strip_string (p, '"');
 
@@ -1276,6 +1305,7 @@ parse_wpa_psk (gchar * psk, GError ** error)
 	}
 
       out:
+	g_free (p);
 	return hashed;
 }
 
@@ -2085,7 +2115,8 @@ write_wireless_security_setting (NMConnection * connection,
 	} else if (!strcmp (key_mgmt, "wpa-eap")) {
 		wpa_set_data (conn_name, "key_mgmt", "WPA-EAP");
 		wpa = TRUE;
-	}
+	} else
+		PLUGIN_WARN (IFNET_PLUGIN_NAME, "Unknown key_mgmt: %s", key_mgmt);
 
 	if (auth_alg) {
 		if (!strcmp (auth_alg, "shared"))
@@ -2180,8 +2211,11 @@ write_wireless_security_setting (NMConnection * connection,
 			g_string_append (quoted, psk);
 			g_string_append_c (quoted, '"');
 		}
-		wpa_set_data (conn_name, "psk",
-			      quoted ? quoted->str : (gchar *) psk);
+		if (psk)
+			wpa_set_data (conn_name, "psk",
+					  quoted ? quoted->str : (gchar *) psk);
+		else
+			PLUGIN_WARN (IFNET_PLUGIN_NAME, "Use WPA, but no psk received from NM");
 		if (quoted)
 			g_string_free (quoted, TRUE);
 	} else
@@ -2190,15 +2224,19 @@ write_wireless_security_setting (NMConnection * connection,
 	return TRUE;
 }
 
-/* remove old ssid and add new one*/
+/* Only remove old config when ssid is changed. 
+ * See bug #350476.
+ * */
 static void
 update_wireless_ssid (NMConnection * connection, gchar * conn_name,
 		      gchar * ssid, gboolean hex)
 {
-	ifnet_delete_network (conn_name);
-	ifnet_add_connection (ssid, "wireless");
+	if (strcmp (conn_name, ssid)){
+		ifnet_delete_network (conn_name);
+		wpa_delete_security (conn_name);
+	}
 
-	wpa_delete_security (conn_name);
+	ifnet_add_network (ssid, "wireless");
 	wpa_add_security (ssid);
 }
 
@@ -2443,8 +2481,12 @@ write_ip4_setting (NMConnection * connection, gchar * conn_name,
 		}
 		ifnet_set_data (conn_name, "config", ips->str);
 		g_string_free (ips, TRUE);
-	} else
-		ifnet_set_data (conn_name, "config", "dhcp");
+	} else if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_SHARED))
+		ifnet_set_data (conn_name, "config", "shared");
+	else if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL))
+		ifnet_set_data (conn_name, "config", "autoip");
+	else
+        ifnet_set_data (conn_name, "config", "dhcp");
 
 	/* DNS Servers */
 	ifnet_set_data (conn_name, "dns_servers", NULL);
@@ -2858,7 +2900,7 @@ get_wired_name ()
 	for (; i < 256; i++) {
 		gchar *conn_name = g_strdup_printf ("eth%d", i);
 
-		if (!ifnet_has_connection (conn_name)) {
+		if (!ifnet_has_network (conn_name)) {
 			return conn_name;
 		} else
 			g_free (conn_name);
@@ -2875,7 +2917,7 @@ get_ppp_name ()
 	for (; i < 256; i++) {
 		gchar *conn_name = g_strdup_printf ("ppp%d", i);
 
-		if (!ifnet_has_connection (conn_name)) {
+		if (!ifnet_has_network (conn_name)) {
 			return conn_name;
 		} else
 			g_free (conn_name);
@@ -2982,7 +3024,7 @@ ifnet_add_new_connection (NMConnection * connection,
 		goto out;
 	}
 
-	if (ifnet_add_connection (new_name, new_type))
+	if (ifnet_add_network (new_name, new_type))
 		success =
 		    ifnet_update_parsers_by_connection (connection, new_name,
 							NULL, config_file,
diff --git a/system-settings/plugins/ifnet/net_parser.c b/system-settings/plugins/ifnet/net_parser.c
index b4a381d..de2db8a 100644
--- a/system-settings/plugins/ifnet/net_parser.c
+++ b/system-settings/plugins/ifnet/net_parser.c
@@ -37,6 +37,9 @@ static GList *functions_list;
 /* Used to decide whether to write changes to file*/
 static gboolean net_parser_data_changed = FALSE;
 
+static void
+destroy_connection_config (GHashTable * conn);
+
 static GHashTable *
 add_new_connection_config (const gchar * type, const gchar * name)
 {
@@ -58,8 +61,10 @@ add_new_connection_config (const gchar * type, const gchar * name)
 }
 
 gboolean
-ifnet_add_connection (gchar * name, gchar * type)
+ifnet_add_network (gchar * name, gchar * type)
 {
+	if (ifnet_has_network (name))
+		return TRUE;
 	if (add_new_connection_config (type, name)) {
 		PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Adding network for %s", name);
 		net_parser_data_changed = TRUE;
@@ -69,11 +74,27 @@ ifnet_add_connection (gchar * name, gchar * type)
 }
 
 gboolean
-ifnet_has_connection (gchar * conn_name)
+ifnet_has_network (gchar * conn_name)
 {
 	return g_hash_table_lookup (conn_table, conn_name) != NULL;
 }
 
+gboolean
+ifnet_delete_network (gchar * conn_name)
+{
+	GHashTable *network = NULL;
+
+	g_return_val_if_fail (conn_table != NULL && conn_name != NULL, FALSE);
+	PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Deleting network for %s", conn_name);
+	network = g_hash_table_lookup (conn_table, conn_name);
+	if (!network)
+		return FALSE;
+	g_hash_table_remove (conn_table, conn_name);
+	destroy_connection_config (network);
+	net_parser_data_changed = TRUE;
+	return TRUE;
+}
+
 static GHashTable *
 get_connection_config (gchar * name)
 {
@@ -377,21 +398,27 @@ ifnet_set_data (gchar * conn_name, gchar * key, gchar * value)
 {
 	gpointer orin_key = NULL, orin_value = NULL;
 	GHashTable *conn = g_hash_table_lookup (conn_table, conn_name);
+	gchar *new_value = NULL;
 
 	if (!conn) {
 		PLUGIN_WARN (IFNET_PLUGIN_NAME,
 			     "%s does not exsit!", conn_name);
 		return;
 	}
+	if (value){
+		new_value = g_strdup (value);
+		strip_string (new_value, '"');
+	}
 	/* Remove existing key value pair */
 	if (g_hash_table_lookup_extended (conn, key, &orin_key, &orin_value)) {
+		if (new_value && !strcmp (orin_value, new_value))
+			return;
 		g_hash_table_remove (conn, orin_key);
 		g_free (orin_key);
 		g_free (orin_value);
 	}
-	if (value)
-		g_hash_table_insert (conn, g_strdup (key),
-				     strip_string (g_strdup (value), '"'));
+	if (new_value)
+		g_hash_table_insert (conn, g_strdup (key), new_value);
 	net_parser_data_changed = TRUE;
 }
 
@@ -467,7 +494,7 @@ ifnet_flush_to_file (gchar * config_file)
 	gboolean result = FALSE;
 
 	if (!net_parser_data_changed)
-		return FALSE;
+		return TRUE;
 	if (!conn_table || !global_settings_table)
 		return FALSE;
 
@@ -583,22 +610,6 @@ ifnet_flush_to_file (gchar * config_file)
 	return result;
 }
 
-gboolean
-ifnet_delete_network (gchar * conn_name)
-{
-	GHashTable *network = NULL;
-
-	g_return_val_if_fail (conn_table != NULL && conn_name != NULL, FALSE);
-	PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Deleting network for %s", conn_name);
-	network = g_hash_table_lookup (conn_table, conn_name);
-	if (!network)
-		return FALSE;
-	g_hash_table_remove (conn_table, conn_name);
-	destroy_connection_config (network);
-	net_parser_data_changed = TRUE;
-	return TRUE;
-}
-
 void
 ifnet_destroy (void)
 {
diff --git a/system-settings/plugins/ifnet/net_parser.h b/system-settings/plugins/ifnet/net_parser.h
index 73a44c8..b71a01f 100644
--- a/system-settings/plugins/ifnet/net_parser.h
+++ b/system-settings/plugins/ifnet/net_parser.h
@@ -36,11 +36,11 @@ GList *ifnet_get_connection_names (void);
 gchar *ifnet_get_data (gchar * conn_name, const gchar * key);
 gchar *ifnet_get_global_data (const gchar * key);
 gchar *ifnet_get_global_setting (gchar * group, gchar * key);
-gboolean ifnet_has_connection (gchar * conn_name);
+gboolean ifnet_has_network (gchar * conn_name);
 
 /* Writer functions */
 gboolean ifnet_flush_to_file (gchar * config_file);
 void ifnet_set_data (gchar * conn_name, gchar * key, gchar * value);
-gboolean ifnet_add_connection (gchar * name, gchar * type);
+gboolean ifnet_add_network (gchar * name, gchar * type);
 gboolean ifnet_delete_network (gchar * conn_name);
 #endif
diff --git a/system-settings/plugins/ifnet/net_utils.c b/system-settings/plugins/ifnet/net_utils.c
index 2dc253c..7e52f10 100644
--- a/system-settings/plugins/ifnet/net_utils.c
+++ b/system-settings/plugins/ifnet/net_utils.c
@@ -278,6 +278,10 @@ is_static_ip4 (gchar * conn_name)
 
 	if (!data)
 		return FALSE;
+	if (!strcmp (data, "shared"))
+		return FALSE;
+	if (!strcmp (data, "autoip"))
+		return FALSE;
 	dhcp6 = strstr (data, "dhcp6");
 	if (dhcp6) {
 		gchar *dhcp4;
diff --git a/system-settings/plugins/ifnet/nm-ifnet-connection.c b/system-settings/plugins/ifnet/nm-ifnet-connection.c
index e47495c..ebe2581 100644
--- a/system-settings/plugins/ifnet/nm-ifnet-connection.c
+++ b/system-settings/plugins/ifnet/nm-ifnet-connection.c
@@ -71,12 +71,14 @@ nm_ifnet_connection_new (gchar * conn_name)
 {
 	NMConnection *tmp;
 	GObject *object;
-	GError **error = NULL;
+	GError *error = NULL;
 
 	g_return_val_if_fail (conn_name != NULL, NULL);
-	tmp = ifnet_update_connection_from_config_block (conn_name, error);
-	if (!tmp)
+	tmp = ifnet_update_connection_from_config_block (conn_name, &error);
+	if (!tmp){
+		g_error_free (error);
 		return NULL;
+	}
 	object = (GObject *) g_object_new (NM_TYPE_IFNET_CONNECTION,
 					   NM_IFNET_CONNECTION_CONN_NAME,
 					   conn_name, NULL);
diff --git a/system-settings/plugins/ifnet/wpa_parser.c b/system-settings/plugins/ifnet/wpa_parser.c
index 5e94108..42c52c3 100644
--- a/system-settings/plugins/ifnet/wpa_parser.c
+++ b/system-settings/plugins/ifnet/wpa_parser.c
@@ -366,7 +366,7 @@ wpa_flush_to_file (gchar * config_file)
 	gboolean result = FALSE;
 
 	if (!wpa_parser_data_changed)
-		return FALSE;
+		return TRUE;
 	if (!wsec_table || !wsec_global_table)
 		return FALSE;
 
@@ -450,26 +450,29 @@ wpa_set_data (gchar * ssid, gchar * key, gchar * value)
 {
 	gpointer orig_key = NULL, orig_value = NULL;
 	GHashTable *security = g_hash_table_lookup (wsec_table, ssid);
+	gchar *new_value = NULL;
 
 	g_return_if_fail (security != NULL);
 
+	if (value){
+		new_value = g_strdup(value);
+		if (strcmp (key, "ssid") != 0 && strcmp (key, "psk") != 0
+			&& !g_str_has_prefix (key, "wep_key"))
+			strip_string (new_value, '"');
+	}
 	/* Remove old key value pairs */
 	if (g_hash_table_lookup_extended
 	    (security, key, &orig_key, &orig_value)) {
+		if (new_value && !strcmp(orig_value, new_value))
+			return;
 		g_hash_table_remove (security, orig_key);
 		g_free (orig_key);
 		g_free (orig_value);
 	}
 
 	/* Add new key value */
-	if (value) {
-		gchar *new_value = g_strdup (value);
-
-		if (strcmp (key, "ssid") != 0 && strcmp (key, "psk") != 0
-		    && !g_str_has_prefix (key, "wep_key"))
-			strip_string (new_value, '"');
+	if (new_value)
 		g_hash_table_insert (security, g_strdup (key), new_value);
-	}
 	wpa_parser_data_changed = TRUE;
 }
 
@@ -483,7 +486,7 @@ gboolean
 wpa_add_security (gchar * ssid)
 {
 	if (wpa_has_security (ssid))
-		return FALSE;
+		return TRUE;
 	else {
 		GHashTable *security =
 		    g_hash_table_new (g_str_hash, g_str_equal);
-- 
1.7.3.4







^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] gentoo-x86 commit in net-misc/networkmanager/files: networkmanager-0.8.2-shared-connection.patch
@ 2011-01-25  2:46 Mu Qiao (qiaomuf)
  0 siblings, 0 replies; 2+ messages in thread
From: Mu Qiao (qiaomuf) @ 2011-01-25  2:46 UTC (permalink / raw
  To: gentoo-commits

qiaomuf     11/01/25 02:46:46

  Modified:             networkmanager-0.8.2-shared-connection.patch
  Log:
  Fix parsing dhclient.conf wrt bug #352638
  
  (Portage version: 2.1.9.25/cvs/Linux x86_64)

Revision  Changes    Path
1.2                  net-misc/networkmanager/files/networkmanager-0.8.2-shared-connection.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.8.2-shared-connection.patch?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.8.2-shared-connection.patch?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.8.2-shared-connection.patch?r1=1.1&r2=1.2

Index: networkmanager-0.8.2-shared-connection.patch
===================================================================
RCS file: /var/cvsroot/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.8.2-shared-connection.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- networkmanager-0.8.2-shared-connection.patch	24 Jan 2011 07:31:49 -0000	1.1
+++ networkmanager-0.8.2-shared-connection.patch	25 Jan 2011 02:46:46 -0000	1.2
@@ -1,24 +1,20 @@
-From 5a67c7a5ad341fa84091287eb6452458c7ee24b0 Mon Sep 17 00:00:00 2001
+From d252fad6aa69aefa17b592111c2db23864f63907 Mon Sep 17 00:00:00 2001
 From: Mu Qiao <qiaomuf@gentoo.org>
-Date: Wed, 5 Jan 2011 13:30:08 +0800
-Subject: [PATCH] Support shared and link-local method for ipv4
- Signed-off-by: Mu Qiao <qiaomuf@gentoo.org>
- fix flush_to_file, return TRUE when nothing changed
- ssid do not lose quotes anymore
- do not delete old connection when ssid is not changed
+Date: Tue, 25 Jan 2011 10:31:53 +0000
+Subject: [PATCH] shared-connection
 
 Signed-off-by: Mu Qiao <qiaomuf@gentoo.org>
 ---
- system-settings/plugins/ifnet/connection_parser.c  |   92 ++++++++++++++------
+ system-settings/plugins/ifnet/connection_parser.c  |   90 ++++++++++++++------
  system-settings/plugins/ifnet/net_parser.c         |   55 +++++++-----
  system-settings/plugins/ifnet/net_parser.h         |    4 +-
- system-settings/plugins/ifnet/net_utils.c          |    4 +
+ system-settings/plugins/ifnet/net_utils.c          |    6 +-
  .../plugins/ifnet/nm-ifnet-connection.c            |    8 +-
  system-settings/plugins/ifnet/wpa_parser.c         |   21 +++--
- 6 files changed, 123 insertions(+), 61 deletions(-)
+ 6 files changed, 122 insertions(+), 62 deletions(-)
 
 diff --git a/system-settings/plugins/ifnet/connection_parser.c b/system-settings/plugins/ifnet/connection_parser.c
-index f9fae51..539f33c 100644
+index f9fae51..9b5ddc1 100644
 --- a/system-settings/plugins/ifnet/connection_parser.c
 +++ b/system-settings/plugins/ifnet/connection_parser.c
 @@ -557,7 +557,7 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
@@ -30,7 +26,7 @@
  	gboolean is_static_block = is_static_ip4 (conn_name);
  	ip_block *iblock = NULL;
  
-@@ -569,12 +569,42 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
+@@ -569,13 +569,41 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
  		      && strstr (value, "nogateway") ? TRUE : FALSE, NULL);
  
  	if (!is_static_block) {
@@ -40,6 +36,7 @@
 -			      NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
 -		PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Using DHCP for %s",
 -			      conn_name);
+-	} else {
 +		method = ifnet_get_data (conn_name, "config");
 +		if (!method){
 +			g_set_error (error, ifnet_plugin_error_quark (), 0,
@@ -59,16 +56,14 @@
 +						  NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
 +			nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
 +			return;
-+		}
-+		else if (!strcmp (method, "shared")){
++		} else if (!strcmp (method, "shared")){
 +			g_object_set (ip4_setting,
 +						  NM_SETTING_IP4_CONFIG_METHOD,
 +						  NM_SETTING_IP4_CONFIG_METHOD_SHARED,
 +						  NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
 +			nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
 +			return;
-+		}
-+		else {
++		} else {
 +			g_set_error (error, ifnet_plugin_error_quark (), 0,
 +						 "Unknown config for %s", conn_name);
 +			g_object_unref (ip4_setting);
@@ -76,10 +71,11 @@
 +		}
 +		PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Using %s method for %s",
 +					  method, conn_name);
- 	} else {
++	}else {
  		iblock = convert_ip4_config_block (conn_name);
  		if (!iblock) {
-@@ -625,7 +655,7 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
+ 			g_set_error (error, ifnet_plugin_error_quark (), 0,
+@@ -625,7 +653,7 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
  	}
  
  	/* add dhcp hostname and client id */
@@ -88,7 +84,7 @@
  		gchar *dhcp_hostname, *client_id;
  
  		get_dhcp_hostname_and_client_id (&dhcp_hostname, &client_id);
-@@ -712,7 +742,6 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
+@@ -712,7 +740,6 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
  		iblock = iblock->next;
  		destroy_ip_block (current_iblock);
  	}
@@ -96,7 +92,7 @@
  	/* Finally add setting to connection */
  	nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
  }
-@@ -1243,10 +1272,10 @@ parse_wpa_psk (gchar * psk, GError ** error)
+@@ -1243,10 +1270,10 @@ parse_wpa_psk (gchar * psk, GError ** error)
  	 * the passphrase contains spaces.
  	 */
  
@@ -110,7 +106,7 @@
  		/* Verify the hex PSK; 64 digits */
  		if (!is_hex (p)) {
  			g_set_error (error, ifnet_plugin_error_quark (),
-@@ -1254,7 +1283,7 @@ parse_wpa_psk (gchar * psk, GError ** error)
+@@ -1254,7 +1281,7 @@ parse_wpa_psk (gchar * psk, GError ** error)
  				     "Invalid WPA_PSK (contains non-hexadecimal characters)");
  			goto out;
  		}
@@ -119,7 +115,7 @@
  	} else {
  		strip_string (p, '"');
  
-@@ -1276,6 +1305,7 @@ parse_wpa_psk (gchar * psk, GError ** error)
+@@ -1276,6 +1303,7 @@ parse_wpa_psk (gchar * psk, GError ** error)
  	}
  
        out:
@@ -127,7 +123,7 @@
  	return hashed;
  }
  
-@@ -2085,7 +2115,8 @@ write_wireless_security_setting (NMConnection * connection,
+@@ -2085,7 +2113,8 @@ write_wireless_security_setting (NMConnection * connection,
  	} else if (!strcmp (key_mgmt, "wpa-eap")) {
  		wpa_set_data (conn_name, "key_mgmt", "WPA-EAP");
  		wpa = TRUE;
@@ -137,7 +133,7 @@
  
  	if (auth_alg) {
  		if (!strcmp (auth_alg, "shared"))
-@@ -2180,8 +2211,11 @@ write_wireless_security_setting (NMConnection * connection,
+@@ -2180,8 +2209,11 @@ write_wireless_security_setting (NMConnection * connection,
  			g_string_append (quoted, psk);
  			g_string_append_c (quoted, '"');
  		}
@@ -151,7 +147,7 @@
  		if (quoted)
  			g_string_free (quoted, TRUE);
  	} else
-@@ -2190,15 +2224,19 @@ write_wireless_security_setting (NMConnection * connection,
+@@ -2190,15 +2222,19 @@ write_wireless_security_setting (NMConnection * connection,
  	return TRUE;
  }
  
@@ -175,22 +171,20 @@
  	wpa_add_security (ssid);
  }
  
-@@ -2443,8 +2481,12 @@ write_ip4_setting (NMConnection * connection, gchar * conn_name,
+@@ -2443,7 +2479,11 @@ write_ip4_setting (NMConnection * connection, gchar * conn_name,
  		}
  		ifnet_set_data (conn_name, "config", ips->str);
  		g_string_free (ips, TRUE);
 -	} else
--		ifnet_set_data (conn_name, "config", "dhcp");
 +	} else if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_SHARED))
 +		ifnet_set_data (conn_name, "config", "shared");
 +	else if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL))
 +		ifnet_set_data (conn_name, "config", "autoip");
 +	else
-+        ifnet_set_data (conn_name, "config", "dhcp");
+ 		ifnet_set_data (conn_name, "config", "dhcp");
  
  	/* DNS Servers */
- 	ifnet_set_data (conn_name, "dns_servers", NULL);
-@@ -2858,7 +2900,7 @@ get_wired_name ()
+@@ -2858,7 +2898,7 @@ get_wired_name ()
  	for (; i < 256; i++) {
  		gchar *conn_name = g_strdup_printf ("eth%d", i);
  
@@ -199,7 +193,7 @@
  			return conn_name;
  		} else
  			g_free (conn_name);
-@@ -2875,7 +2917,7 @@ get_ppp_name ()
+@@ -2875,7 +2915,7 @@ get_ppp_name ()
  	for (; i < 256; i++) {
  		gchar *conn_name = g_strdup_printf ("ppp%d", i);
  
@@ -208,7 +202,7 @@
  			return conn_name;
  		} else
  			g_free (conn_name);
-@@ -2982,7 +3024,7 @@ ifnet_add_new_connection (NMConnection * connection,
+@@ -2982,7 +3022,7 @@ ifnet_add_new_connection (NMConnection * connection,
  		goto out;
  	}
  
@@ -354,7 +348,7 @@
  gboolean ifnet_delete_network (gchar * conn_name);
  #endif
 diff --git a/system-settings/plugins/ifnet/net_utils.c b/system-settings/plugins/ifnet/net_utils.c
-index 2dc253c..7e52f10 100644
+index 2dc253c..83b4325 100644
 --- a/system-settings/plugins/ifnet/net_utils.c
 +++ b/system-settings/plugins/ifnet/net_utils.c
 @@ -278,6 +278,10 @@ is_static_ip4 (gchar * conn_name)
@@ -368,6 +362,16 @@
  	dhcp6 = strstr (data, "dhcp6");
  	if (dhcp6) {
  		gchar *dhcp4;
+@@ -942,8 +946,8 @@ get_dhcp_hostname_and_client_id (char **hostname, char **client_id)
+ 		else if ((tmp = strstr (line, "send host-name")) != NULL) {
+ 			tmp += strlen ("send host-name");
+ 			g_strstrip (tmp);
+-			strip_string (tmp, '"');
+ 			strip_string (tmp, ';');
++			strip_string (tmp, '"');
+ 			if (tmp[0] != '\0')
+ 				*hostname = g_strdup (tmp);
+ 			else
 diff --git a/system-settings/plugins/ifnet/nm-ifnet-connection.c b/system-settings/plugins/ifnet/nm-ifnet-connection.c
 index e47495c..ebe2581 100644
 --- a/system-settings/plugins/ifnet/nm-ifnet-connection.c






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-25  2:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-24  7:31 [gentoo-commits] gentoo-x86 commit in net-misc/networkmanager/files: networkmanager-0.8.2-shared-connection.patch Mu Qiao (qiaomuf)
  -- strict thread matches above, loose matches on Subject: below --
2011-01-25  2:46 Mu Qiao (qiaomuf)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox