/[gentoo-x86]/net-misc/networkmanager/files/networkmanager-0.8.4.0-ifnet-smarter-write.patch
Gentoo

Contents of /net-misc/networkmanager/files/networkmanager-0.8.4.0-ifnet-smarter-write.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Wed May 18 11:20:12 2011 UTC (3 years, 11 months ago) by qiaomuf
Branch: MAIN
Add backported patches for the ifnet plug-in.

(Portage version: 2.1.9.49/cvs/Linux x86_64)

1 qiaomuf 1.1 From 776fafc133e18df48dc92a717c662e1b2858567e Mon Sep 17 00:00:00 2001
2     From: Mu Qiao <qiaomuf@gentoo.org>
3     Date: Fri, 25 Feb 2011 16:25:07 +0000
4     Subject: [PATCH 3/3] Won't write when nothing changed
5     Signed-off-by: Mu Qiao <qiaomuf@gentoo.org>
6     Make log less excessive, accept non-alnum ssid (bug #356337)
7    
8     Signed-off-by: Mu Qiao <qiaomuf@gentoo.org>
9     ---
10     system-settings/plugins/ifnet/connection_parser.c | 33 +++++++++-----------
11     system-settings/plugins/ifnet/net_parser.c | 8 ++++-
12     system-settings/plugins/ifnet/plugin.c | 4 --
13     system-settings/plugins/ifnet/wpa_parser.c | 7 +++-
14     4 files changed, 26 insertions(+), 26 deletions(-)
15    
16     diff --git a/system-settings/plugins/ifnet/connection_parser.c b/system-settings/plugins/ifnet/connection_parser.c
17     index 9b5ddc1..4ac2173 100644
18     --- a/system-settings/plugins/ifnet/connection_parser.c
19     +++ b/system-settings/plugins/ifnet/connection_parser.c
20     @@ -55,9 +55,16 @@ update_connection_id (NMConnection * connection, gchar * conn_name)
21     gchar *idstr = NULL;
22     gchar *uuid_base = NULL;
23     gchar *uuid = NULL;
24     + int name_len;
25     NMSettingConnection *setting;
26    
27     - idstr = g_strdup_printf ("%s (%s)", get_prefix (), conn_name);
28     + name_len = strlen (conn_name);
29     + if ((name_len > 2) && (g_str_has_prefix (conn_name, "0x"))) {
30     + gchar * conn_name_printable = utils_hexstr2bin (conn_name + 2, name_len - 2);
31     + idstr = g_strdup_printf ("%s (%s)", get_prefix (), conn_name_printable);
32     + g_free (conn_name_printable);
33     + } else
34     + idstr = g_strdup_printf ("%s (%s)", get_prefix (), conn_name);
35     uuid_base = idstr;
36     uuid = nm_utils_uuid_generate_from_string (uuid_base);
37     setting =
38     @@ -627,23 +634,13 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error)
39     g_object_set (ip4_setting,
40     NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES,
41     TRUE, NULL);
42     - if (nm_setting_ip4_config_add_address
43     - (ip4_setting, ip4_addr)) {
44     - PLUGIN_PRINT (IFNET_PLUGIN_NAME,
45     - "new address: %d", iblock->ip);
46     - PLUGIN_PRINT (IFNET_PLUGIN_NAME,
47     - "ipv4 addresses count: %d",
48     - nm_setting_ip4_config_get_num_addresses
49     - (ip4_setting));
50     - } else {
51     - PLUGIN_WARN (IFNET_PLUGIN_NAME,
52     - "ignoring duplicate IP4 address");
53     - }
54     + if (!nm_setting_ip4_config_add_address (ip4_setting, ip4_addr))
55     + PLUGIN_WARN (IFNET_PLUGIN_NAME,
56     + "ignoring duplicate IP4 address");
57     nm_ip4_address_unref (ip4_addr);
58     current_iblock = iblock;
59     iblock = iblock->next;
60     destroy_ip_block (current_iblock);
61     -
62     }
63     g_object_set (ip4_setting,
64     NM_SETTING_IP4_CONFIG_METHOD,
65     @@ -2276,11 +2273,12 @@ write_wireless_setting (NMConnection * connection,
66     return FALSE;
67     }
68    
69     - /* If the SSID contains any non-printable characters, we need to use the
70     - * hex notation of the SSID instead.
71     + /* If the SSID contains any non-alnum characters, we need to use
72     + * the hex notation of the SSID instead. (Because openrc doesn't
73     + * support these characters, see bug #356337)
74     */
75     for (i = 0; i < ssid->len; i++) {
76     - if (!isprint (ssid->data[i])) {
77     + if (!isalnum (ssid->data[i])) {
78     hex_ssid = TRUE;
79     break;
80     }
81     @@ -2487,7 +2485,6 @@ write_ip4_setting (NMConnection * connection, gchar * conn_name,
82     ifnet_set_data (conn_name, "config", "dhcp");
83    
84     /* DNS Servers */
85     - ifnet_set_data (conn_name, "dns_servers", NULL);
86     num = nm_setting_ip4_config_get_num_dns (s_ip4);
87     if (num > 0) {
88     dns = g_string_new (NULL);
89     diff --git a/system-settings/plugins/ifnet/net_parser.c b/system-settings/plugins/ifnet/net_parser.c
90     index de2db8a..57f3688 100644
91     --- a/system-settings/plugins/ifnet/net_parser.c
92     +++ b/system-settings/plugins/ifnet/net_parser.c
93     @@ -411,12 +411,16 @@ ifnet_set_data (gchar * conn_name, gchar * key, gchar * value)
94     }
95     /* Remove existing key value pair */
96     if (g_hash_table_lookup_extended (conn, key, &orin_key, &orin_value)) {
97     - if (new_value && !strcmp (orin_value, new_value))
98     + if (new_value && !strcmp (orin_value, new_value)){
99     + g_free (new_value);
100     return;
101     + }
102     g_hash_table_remove (conn, orin_key);
103     g_free (orin_key);
104     g_free (orin_value);
105     - }
106     + /* old key/value doesn't exist but new value is NULL */
107     + } else if (!value)
108     + return;
109     if (new_value)
110     g_hash_table_insert (conn, g_strdup (key), new_value);
111     net_parser_data_changed = TRUE;
112     diff --git a/system-settings/plugins/ifnet/plugin.c b/system-settings/plugins/ifnet/plugin.c
113     index 94f9e79..3952e91 100644
114     --- a/system-settings/plugins/ifnet/plugin.c
115     +++ b/system-settings/plugins/ifnet/plugin.c
116     @@ -91,8 +91,6 @@ update_system_hostname (gpointer config)
117     {
118     SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (config);
119    
120     - PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Updating hostname");
121     -
122     if (priv->hostname)
123     g_free (priv->hostname);
124     priv->hostname = read_hostname (IFNET_SYSTEM_HOSTNAME_FILE);
125     @@ -184,8 +182,6 @@ monitor_file_changes (const char *filename,
126     info);
127     g_signal_connect (monitor, "changed", G_CALLBACK (file_changed),
128     info);
129     - PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Monitoring %s", filename);
130     -
131     } else
132     PLUGIN_WARN (IFNET_PLUGIN_NAME,
133     "Monitoring %s failed, error: %s", filename,
134     diff --git a/system-settings/plugins/ifnet/wpa_parser.c b/system-settings/plugins/ifnet/wpa_parser.c
135     index 42c52c3..338c338 100644
136     --- a/system-settings/plugins/ifnet/wpa_parser.c
137     +++ b/system-settings/plugins/ifnet/wpa_parser.c
138     @@ -463,12 +463,15 @@ wpa_set_data (gchar * ssid, gchar * key, gchar * value)
139     /* Remove old key value pairs */
140     if (g_hash_table_lookup_extended
141     (security, key, &orig_key, &orig_value)) {
142     - if (new_value && !strcmp(orig_value, new_value))
143     + if (new_value && !strcmp(orig_value, new_value)){
144     + g_free (new_value);
145     return;
146     + }
147     g_hash_table_remove (security, orig_key);
148     g_free (orig_key);
149     g_free (orig_value);
150     - }
151     + } else if (!value)
152     + return;
153    
154     /* Add new key value */
155     if (new_value)
156     --
157     1.7.3.4

  ViewVC Help
Powered by ViewVC 1.1.20