1 |
qiaomuf 11/01/25 02:46:46 |
2 |
|
3 |
Modified: networkmanager-0.8.2-shared-connection.patch |
4 |
Log: |
5 |
Fix parsing dhclient.conf wrt bug #352638 |
6 |
|
7 |
(Portage version: 2.1.9.25/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.2 net-misc/networkmanager/files/networkmanager-0.8.2-shared-connection.patch |
11 |
|
12 |
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 |
13 |
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 |
14 |
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 |
15 |
|
16 |
Index: networkmanager-0.8.2-shared-connection.patch |
17 |
=================================================================== |
18 |
RCS file: /var/cvsroot/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.8.2-shared-connection.patch,v |
19 |
retrieving revision 1.1 |
20 |
retrieving revision 1.2 |
21 |
diff -u -r1.1 -r1.2 |
22 |
--- networkmanager-0.8.2-shared-connection.patch 24 Jan 2011 07:31:49 -0000 1.1 |
23 |
+++ networkmanager-0.8.2-shared-connection.patch 25 Jan 2011 02:46:46 -0000 1.2 |
24 |
@@ -1,24 +1,20 @@ |
25 |
-From 5a67c7a5ad341fa84091287eb6452458c7ee24b0 Mon Sep 17 00:00:00 2001 |
26 |
+From d252fad6aa69aefa17b592111c2db23864f63907 Mon Sep 17 00:00:00 2001 |
27 |
From: Mu Qiao <qiaomuf@g.o> |
28 |
-Date: Wed, 5 Jan 2011 13:30:08 +0800 |
29 |
-Subject: [PATCH] Support shared and link-local method for ipv4 |
30 |
- Signed-off-by: Mu Qiao <qiaomuf@g.o> |
31 |
- fix flush_to_file, return TRUE when nothing changed |
32 |
- ssid do not lose quotes anymore |
33 |
- do not delete old connection when ssid is not changed |
34 |
+Date: Tue, 25 Jan 2011 10:31:53 +0000 |
35 |
+Subject: [PATCH] shared-connection |
36 |
|
37 |
Signed-off-by: Mu Qiao <qiaomuf@g.o> |
38 |
--- |
39 |
- system-settings/plugins/ifnet/connection_parser.c | 92 ++++++++++++++------ |
40 |
+ system-settings/plugins/ifnet/connection_parser.c | 90 ++++++++++++++------ |
41 |
system-settings/plugins/ifnet/net_parser.c | 55 +++++++----- |
42 |
system-settings/plugins/ifnet/net_parser.h | 4 +- |
43 |
- system-settings/plugins/ifnet/net_utils.c | 4 + |
44 |
+ system-settings/plugins/ifnet/net_utils.c | 6 +- |
45 |
.../plugins/ifnet/nm-ifnet-connection.c | 8 +- |
46 |
system-settings/plugins/ifnet/wpa_parser.c | 21 +++-- |
47 |
- 6 files changed, 123 insertions(+), 61 deletions(-) |
48 |
+ 6 files changed, 122 insertions(+), 62 deletions(-) |
49 |
|
50 |
diff --git a/system-settings/plugins/ifnet/connection_parser.c b/system-settings/plugins/ifnet/connection_parser.c |
51 |
-index f9fae51..539f33c 100644 |
52 |
+index f9fae51..9b5ddc1 100644 |
53 |
--- a/system-settings/plugins/ifnet/connection_parser.c |
54 |
+++ b/system-settings/plugins/ifnet/connection_parser.c |
55 |
@@ -557,7 +557,7 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error) |
56 |
@@ -30,7 +26,7 @@ |
57 |
gboolean is_static_block = is_static_ip4 (conn_name); |
58 |
ip_block *iblock = NULL; |
59 |
|
60 |
-@@ -569,12 +569,42 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error) |
61 |
+@@ -569,13 +569,41 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error) |
62 |
&& strstr (value, "nogateway") ? TRUE : FALSE, NULL); |
63 |
|
64 |
if (!is_static_block) { |
65 |
@@ -40,6 +36,7 @@ |
66 |
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL); |
67 |
- PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Using DHCP for %s", |
68 |
- conn_name); |
69 |
+- } else { |
70 |
+ method = ifnet_get_data (conn_name, "config"); |
71 |
+ if (!method){ |
72 |
+ g_set_error (error, ifnet_plugin_error_quark (), 0, |
73 |
@@ -59,16 +56,14 @@ |
74 |
+ NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL); |
75 |
+ nm_connection_add_setting (connection, NM_SETTING (ip4_setting)); |
76 |
+ return; |
77 |
-+ } |
78 |
-+ else if (!strcmp (method, "shared")){ |
79 |
++ } else if (!strcmp (method, "shared")){ |
80 |
+ g_object_set (ip4_setting, |
81 |
+ NM_SETTING_IP4_CONFIG_METHOD, |
82 |
+ NM_SETTING_IP4_CONFIG_METHOD_SHARED, |
83 |
+ NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL); |
84 |
+ nm_connection_add_setting (connection, NM_SETTING (ip4_setting)); |
85 |
+ return; |
86 |
-+ } |
87 |
-+ else { |
88 |
++ } else { |
89 |
+ g_set_error (error, ifnet_plugin_error_quark (), 0, |
90 |
+ "Unknown config for %s", conn_name); |
91 |
+ g_object_unref (ip4_setting); |
92 |
@@ -76,10 +71,11 @@ |
93 |
+ } |
94 |
+ PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Using %s method for %s", |
95 |
+ method, conn_name); |
96 |
- } else { |
97 |
++ }else { |
98 |
iblock = convert_ip4_config_block (conn_name); |
99 |
if (!iblock) { |
100 |
-@@ -625,7 +655,7 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error) |
101 |
+ g_set_error (error, ifnet_plugin_error_quark (), 0, |
102 |
+@@ -625,7 +653,7 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error) |
103 |
} |
104 |
|
105 |
/* add dhcp hostname and client id */ |
106 |
@@ -88,7 +84,7 @@ |
107 |
gchar *dhcp_hostname, *client_id; |
108 |
|
109 |
get_dhcp_hostname_and_client_id (&dhcp_hostname, &client_id); |
110 |
-@@ -712,7 +742,6 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error) |
111 |
+@@ -712,7 +740,6 @@ make_ip4_setting (NMConnection * connection, gchar * conn_name, GError ** error) |
112 |
iblock = iblock->next; |
113 |
destroy_ip_block (current_iblock); |
114 |
} |
115 |
@@ -96,7 +92,7 @@ |
116 |
/* Finally add setting to connection */ |
117 |
nm_connection_add_setting (connection, NM_SETTING (ip4_setting)); |
118 |
} |
119 |
-@@ -1243,10 +1272,10 @@ parse_wpa_psk (gchar * psk, GError ** error) |
120 |
+@@ -1243,10 +1270,10 @@ parse_wpa_psk (gchar * psk, GError ** error) |
121 |
* the passphrase contains spaces. |
122 |
*/ |
123 |
|
124 |
@@ -110,7 +106,7 @@ |
125 |
/* Verify the hex PSK; 64 digits */ |
126 |
if (!is_hex (p)) { |
127 |
g_set_error (error, ifnet_plugin_error_quark (), |
128 |
-@@ -1254,7 +1283,7 @@ parse_wpa_psk (gchar * psk, GError ** error) |
129 |
+@@ -1254,7 +1281,7 @@ parse_wpa_psk (gchar * psk, GError ** error) |
130 |
"Invalid WPA_PSK (contains non-hexadecimal characters)"); |
131 |
goto out; |
132 |
} |
133 |
@@ -119,7 +115,7 @@ |
134 |
} else { |
135 |
strip_string (p, '"'); |
136 |
|
137 |
-@@ -1276,6 +1305,7 @@ parse_wpa_psk (gchar * psk, GError ** error) |
138 |
+@@ -1276,6 +1303,7 @@ parse_wpa_psk (gchar * psk, GError ** error) |
139 |
} |
140 |
|
141 |
out: |
142 |
@@ -127,7 +123,7 @@ |
143 |
return hashed; |
144 |
} |
145 |
|
146 |
-@@ -2085,7 +2115,8 @@ write_wireless_security_setting (NMConnection * connection, |
147 |
+@@ -2085,7 +2113,8 @@ write_wireless_security_setting (NMConnection * connection, |
148 |
} else if (!strcmp (key_mgmt, "wpa-eap")) { |
149 |
wpa_set_data (conn_name, "key_mgmt", "WPA-EAP"); |
150 |
wpa = TRUE; |
151 |
@@ -137,7 +133,7 @@ |
152 |
|
153 |
if (auth_alg) { |
154 |
if (!strcmp (auth_alg, "shared")) |
155 |
-@@ -2180,8 +2211,11 @@ write_wireless_security_setting (NMConnection * connection, |
156 |
+@@ -2180,8 +2209,11 @@ write_wireless_security_setting (NMConnection * connection, |
157 |
g_string_append (quoted, psk); |
158 |
g_string_append_c (quoted, '"'); |
159 |
} |
160 |
@@ -151,7 +147,7 @@ |
161 |
if (quoted) |
162 |
g_string_free (quoted, TRUE); |
163 |
} else |
164 |
-@@ -2190,15 +2224,19 @@ write_wireless_security_setting (NMConnection * connection, |
165 |
+@@ -2190,15 +2222,19 @@ write_wireless_security_setting (NMConnection * connection, |
166 |
return TRUE; |
167 |
} |
168 |
|
169 |
@@ -175,22 +171,20 @@ |
170 |
wpa_add_security (ssid); |
171 |
} |
172 |
|
173 |
-@@ -2443,8 +2481,12 @@ write_ip4_setting (NMConnection * connection, gchar * conn_name, |
174 |
+@@ -2443,7 +2479,11 @@ write_ip4_setting (NMConnection * connection, gchar * conn_name, |
175 |
} |
176 |
ifnet_set_data (conn_name, "config", ips->str); |
177 |
g_string_free (ips, TRUE); |
178 |
- } else |
179 |
-- ifnet_set_data (conn_name, "config", "dhcp"); |
180 |
+ } else if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) |
181 |
+ ifnet_set_data (conn_name, "config", "shared"); |
182 |
+ else if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)) |
183 |
+ ifnet_set_data (conn_name, "config", "autoip"); |
184 |
+ else |
185 |
-+ ifnet_set_data (conn_name, "config", "dhcp"); |
186 |
+ ifnet_set_data (conn_name, "config", "dhcp"); |
187 |
|
188 |
/* DNS Servers */ |
189 |
- ifnet_set_data (conn_name, "dns_servers", NULL); |
190 |
-@@ -2858,7 +2900,7 @@ get_wired_name () |
191 |
+@@ -2858,7 +2898,7 @@ get_wired_name () |
192 |
for (; i < 256; i++) { |
193 |
gchar *conn_name = g_strdup_printf ("eth%d", i); |
194 |
|
195 |
@@ -199,7 +193,7 @@ |
196 |
return conn_name; |
197 |
} else |
198 |
g_free (conn_name); |
199 |
-@@ -2875,7 +2917,7 @@ get_ppp_name () |
200 |
+@@ -2875,7 +2915,7 @@ get_ppp_name () |
201 |
for (; i < 256; i++) { |
202 |
gchar *conn_name = g_strdup_printf ("ppp%d", i); |
203 |
|
204 |
@@ -208,7 +202,7 @@ |
205 |
return conn_name; |
206 |
} else |
207 |
g_free (conn_name); |
208 |
-@@ -2982,7 +3024,7 @@ ifnet_add_new_connection (NMConnection * connection, |
209 |
+@@ -2982,7 +3022,7 @@ ifnet_add_new_connection (NMConnection * connection, |
210 |
goto out; |
211 |
} |
212 |
|
213 |
@@ -354,7 +348,7 @@ |
214 |
gboolean ifnet_delete_network (gchar * conn_name); |
215 |
#endif |
216 |
diff --git a/system-settings/plugins/ifnet/net_utils.c b/system-settings/plugins/ifnet/net_utils.c |
217 |
-index 2dc253c..7e52f10 100644 |
218 |
+index 2dc253c..83b4325 100644 |
219 |
--- a/system-settings/plugins/ifnet/net_utils.c |
220 |
+++ b/system-settings/plugins/ifnet/net_utils.c |
221 |
@@ -278,6 +278,10 @@ is_static_ip4 (gchar * conn_name) |
222 |
@@ -368,6 +362,16 @@ |
223 |
dhcp6 = strstr (data, "dhcp6"); |
224 |
if (dhcp6) { |
225 |
gchar *dhcp4; |
226 |
+@@ -942,8 +946,8 @@ get_dhcp_hostname_and_client_id (char **hostname, char **client_id) |
227 |
+ else if ((tmp = strstr (line, "send host-name")) != NULL) { |
228 |
+ tmp += strlen ("send host-name"); |
229 |
+ g_strstrip (tmp); |
230 |
+- strip_string (tmp, '"'); |
231 |
+ strip_string (tmp, ';'); |
232 |
++ strip_string (tmp, '"'); |
233 |
+ if (tmp[0] != '\0') |
234 |
+ *hostname = g_strdup (tmp); |
235 |
+ else |
236 |
diff --git a/system-settings/plugins/ifnet/nm-ifnet-connection.c b/system-settings/plugins/ifnet/nm-ifnet-connection.c |
237 |
index e47495c..ebe2581 100644 |
238 |
--- a/system-settings/plugins/ifnet/nm-ifnet-connection.c |