/[gentoo-x86]/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-openrc-style.patch
Gentoo

Contents of /net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-openrc-style.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Thu Sep 13 09:54:12 2012 UTC (21 months, 3 weeks ago) by tetromino
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Version bump with various fixes. No longer saves thousands of temporary ipv6 routes (bug #428274, thanks to Matthias Nagel). No longer installs dispatcher and init scripts when USE=systemd to avoid annoying systemd users (bug #434692, thanks to Arne St├Ącker). Drop old.

(Portage version: 2.2.0_alpha125/cvs/Linux x86_64)

1 From c5f080923f0c52084a929b4125e8fbe19f6e7279 Mon Sep 17 00:00:00 2001
2 From: Mu Qiao <qiaomuf@gentoo.org>
3 Date: Tue, 6 Dec 2011 14:55:03 +0800
4 Subject: [PATCH] ifnet: support reading openrc style
5
6 IP configuration like 192.168.1.{2..4} is not supported anymore.
7 ---
8 src/settings/plugins/ifnet/connection_parser.c | 14 +-
9 src/settings/plugins/ifnet/net_parser.c | 84 ++++++++++----
10 src/settings/plugins/ifnet/net_utils.c | 144 ++++++++++--------------
11 src/settings/plugins/ifnet/tests/net | 11 ++-
12 src/settings/plugins/ifnet/tests/test_all.c | 30 ++++-
13 5 files changed, 163 insertions(+), 120 deletions(-)
14
15 diff --git a/src/settings/plugins/ifnet/connection_parser.c b/src/settings/plugins/ifnet/connection_parser.c
16 index b4aaa8d..66ce318 100644
17 --- a/src/settings/plugins/ifnet/connection_parser.c
18 +++ b/src/settings/plugins/ifnet/connection_parser.c
19 @@ -567,7 +567,7 @@ make_wired_connection_setting (NMConnection *connection,
20 nm_connection_add_setting (connection, NM_SETTING (s_wired));
21 }
22
23 -/* add NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME,
24 +/* add NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME,
25 * NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID in future*/
26 static void
27 make_ip4_setting (NMConnection *connection,
28 @@ -596,19 +596,19 @@ make_ip4_setting (NMConnection *connection,
29 g_object_unref (ip4_setting);
30 return;
31 }
32 - if (!strcmp (method, "dhcp"))
33 + if (strstr (method, "dhcp"))
34 g_object_set (ip4_setting,
35 NM_SETTING_IP4_CONFIG_METHOD,
36 NM_SETTING_IP4_CONFIG_METHOD_AUTO,
37 NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
38 - else if (!strcmp (method, "autoip")){
39 + else if (strstr (method, "autoip")){
40 g_object_set (ip4_setting,
41 NM_SETTING_IP4_CONFIG_METHOD,
42 NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
43 NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
44 nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
45 return;
46 - } else if (!strcmp (method, "shared")){
47 + } else if (strstr (method, "shared")){
48 g_object_set (ip4_setting,
49 NM_SETTING_IP4_CONFIG_METHOD,
50 NM_SETTING_IP4_CONFIG_METHOD_SHARED,
51 @@ -663,7 +663,7 @@ make_ip4_setting (NMConnection *connection,
52 }
53
54 /* add dhcp hostname and client id */
55 - if (!is_static_block && !strcmp (method, "dhcp")) {
56 + if (!is_static_block && strstr (method, "dhcp")) {
57 gchar *dhcp_hostname, *client_id;
58
59 get_dhcp_hostname_and_client_id (&dhcp_hostname, &client_id);
60 @@ -868,7 +868,7 @@ make_ip6_setting (NMConnection *connection,
61 nm_ip6_route_set_dest (route, iblock->ip);
62 nm_ip6_route_set_next_hop (route, iblock->next_hop);
63 nm_ip6_route_set_prefix (route, iblock->prefix);
64 - /* metric is not per routes configuration right now
65 + /* metric is not per routes configuration right now
66 * global metric is also supported (metric="x") */
67 if ((metric_str = ifnet_get_data (conn_name, "metric")) != NULL) {
68 metric = strtol (metric_str, NULL, 10);
69 @@ -995,7 +995,7 @@ make_wireless_connection_setting (const char *conn_name,
70 goto error;
71 }
72
73 - /* mode=0: infrastructure
74 + /* mode=0: infrastructure
75 * mode=1: adhoc */
76 value = wpa_get_value (conn_name, "mode");
77 if (value)
78 diff --git a/src/settings/plugins/ifnet/net_parser.c b/src/settings/plugins/ifnet/net_parser.c
79 index a48103d..4befc37 100644
80 --- a/src/settings/plugins/ifnet/net_parser.c
81 +++ b/src/settings/plugins/ifnet/net_parser.c
82 @@ -169,12 +169,10 @@ init_block_by_line (gchar * buf)
83 conn = add_new_connection_config ("wireless", pos);
84 }
85 data = g_strdup (key_value[1]);
86 - tmp = strip_string (data, '(');
87 - tmp = strip_string (tmp, ')');
88 - strip_string (tmp, '"');
89 + tmp = strip_string (data, '"');
90 strip_string (tmp, '\'');
91 if (conn)
92 - g_hash_table_insert (conn, g_strdup (key_value[0]),
93 + g_hash_table_insert (conn, strip_string (g_strdup (key_value[0]), ' '),
94 g_strdup (tmp));
95 g_free (data);
96 g_strfreev (key_value);
97 @@ -283,6 +281,22 @@ is_function (gchar * line)
98 return FALSE;
99 }
100
101 +static void
102 +append_line (GString *buf, gchar* line)
103 +{
104 + gchar *pos = NULL;
105 +
106 + if ((pos = strchr (line, '#')) != NULL)
107 + *pos = '\0';
108 + g_strstrip (line);
109 +
110 + if (line[0] != '\0') {
111 + g_string_append_printf (buf,
112 + " %s", line);
113 + }
114 + g_free (line);
115 +}
116 +
117 gboolean
118 ifnet_init (gchar * config_file)
119 {
120 @@ -292,6 +306,8 @@ ifnet_init (gchar * config_file)
121 /* Handle multiple lines with brackets */
122 gboolean complete = TRUE;
123
124 + gboolean openrc_style = TRUE;
125 +
126 /* line buffer */
127 GString *buf;
128
129 @@ -319,36 +335,60 @@ ifnet_init (gchar * config_file)
130 strip_function (channel, line);
131 continue;
132 }
133 - if (line[0] != '#' && line[0] != '\0') {
134 - gchar *pos = NULL;
135
136 + // New openrc style, bash arrays are not allowed. We only care about '"'
137 + if (openrc_style && line[0] != '#' && line[0] != '\0'
138 + && !strchr (line, '(') && !strchr (line, ')')) {
139 + gchar *tmp = line;
140 +
141 + while ((tmp = strchr (tmp, '"')) != NULL) {
142 + complete = !complete;
143 + ++tmp;
144 + }
145 +
146 + append_line (buf, line);
147 + // Add "(separator) for routes. It will be easier for later parsing
148 + if (strstr (buf->str, "via"))
149 + g_string_append_printf (buf, "\"");
150 +
151 + if (!complete)
152 + continue;
153 +
154 + strip_string (buf->str, '"');
155 +
156 + init_block_by_line (buf->str);
157 + g_string_free (buf, TRUE);
158 + buf = g_string_new (NULL);
159 + }
160 + // Old bash arrays for baselayout-1, to be deleted
161 + else if (line[0] != '#' && line[0] != '\0') {
162 if (!complete) {
163 complete =
164 g_strrstr (line,
165 ")") == NULL ? FALSE : TRUE;
166 - if ((pos = strchr (line, '#')) != NULL)
167 - *pos = '\0';
168 - g_strstrip (line);
169 - if (line[0] != '\0') {
170 - g_string_append_printf (buf,
171 - " %s", line);
172 - }
173 - g_free (line);
174 - if (!complete)
175 +
176 + append_line (buf, line);
177 + if (!complete) {
178 + openrc_style = FALSE;
179 continue;
180 + }
181 + else {
182 + openrc_style = TRUE;
183 + }
184 } else {
185 complete =
186 (g_strrstr (line, "(") != NULL
187 && g_strrstr (line, ")") != NULL)
188 || g_strrstr (line, "(") == NULL;
189 - if ((pos = strchr (line, '#')) != NULL)
190 - *pos = '\0';
191 - g_strstrip (line);
192 - if (line[0] != '\0')
193 - g_string_append (buf, line);
194 - g_free (line);
195 +
196 + append_line (buf, line);
197 if (!complete)
198 + {
199 + openrc_style = FALSE;
200 continue;
201 + } else {
202 + openrc_style = TRUE;
203 + }
204 }
205 init_block_by_line (buf->str);
206 g_string_free (buf, TRUE);
207 @@ -391,7 +431,7 @@ ifnet_set_data (const char *conn_name, const char *key, const char *value)
208 }
209 /* Remove existing key value pair */
210 if (g_hash_table_lookup_extended (conn, key, &old_key, &old_value)) {
211 - if (stripped && !strcmp(old_value, stripped)){
212 + if (stripped && !strcmp (old_value, stripped)){
213 g_free (stripped);
214 return;
215 }
216 diff --git a/src/settings/plugins/ifnet/net_utils.c b/src/settings/plugins/ifnet/net_utils.c
217 index b533ae3..fc7e283 100644
218 --- a/src/settings/plugins/ifnet/net_utils.c
219 +++ b/src/settings/plugins/ifnet/net_utils.c
220 @@ -352,6 +352,49 @@ is_ip6_address (const char *in_address)
221
222 }
223
224 +// 'c' is only used for openrc style
225 +static gchar **
226 +split_addresses_by_char (const gchar *addresses, const gchar *c)
227 +{
228 + gchar **ipset;
229 +
230 + if (addresses == NULL)
231 + return NULL;
232 +
233 + if (strchr (addresses, '(') != NULL) { // old baselayout style
234 + gchar *tmp = g_strdup (addresses);
235 + strip_string (tmp, '(');
236 + strip_string (tmp, ')');
237 + strip_string (tmp, '"');
238 + strip_string (tmp, '\'');
239 + ipset = g_strsplit (tmp, "\" \"", 0);
240 + g_free(tmp);
241 + } else { // openrc style
242 + if (strstr (addresses, "netmask"))
243 + // There is only one ip address if "netmask" is specified.
244 + // '\n' is not used in config so there will be only one split.
245 + ipset = g_strsplit (addresses, "\n", 0);
246 + else
247 + ipset = g_strsplit (addresses, c, 0);
248 + }
249 +
250 + return ipset;
251 +}
252 +
253 +static gchar **
254 +split_addresses (const gchar* addresses)
255 +{
256 + // " " is only used by openrc style
257 + return split_addresses_by_char (addresses, " ");
258 +}
259 +
260 +static gchar **
261 +split_routes (const gchar* routes)
262 +{
263 + // "\"" is only used by openrc style
264 + return split_addresses_by_char (routes, "\"");
265 +}
266 +
267 gboolean
268 has_ip6_address (const char *conn_name)
269 {
270 @@ -360,7 +403,7 @@ has_ip6_address (const char *conn_name)
271 guint i;
272
273 g_return_val_if_fail (conn_name != NULL, FALSE);
274 - ipset = g_strsplit (ifnet_get_data (conn_name, "config"), "\" \"", 0);
275 + ipset = split_addresses (ifnet_get_data (conn_name, "config"));
276 length = g_strv_length (ipset);
277 for (i = 0; i < length; i++) {
278 if (!is_ip6_address (ipset[i]))
279 @@ -512,8 +555,11 @@ get_ip4_gateway (gchar * gateway)
280 tmp = g_strdup (tmp);
281 strip_string (tmp, ' ');
282 strip_string (tmp, '"');
283 +
284 + // Only one gateway is selected
285 if ((split = strstr (tmp, "\"")) != NULL)
286 *split = '\0';
287 +
288 if (!inet_pton (AF_INET, tmp, &tmp_ip4_addr))
289 goto error;
290 g_free (tmp);
291 @@ -567,14 +613,11 @@ convert_ip4_config_block (const char *conn_name)
292 gchar *ip;
293 guint32 def_gateway = 0;
294 const char *routes;
295 - gchar *pos;
296 ip_block *start = NULL, *current = NULL, *iblock = NULL;
297 - const char *pattern =
298 - "((\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.)\\{(\\d{1,3})\\.\\.(\\d{1,3})\\}(/\\d{1,2}))";
299
300 g_return_val_if_fail (conn_name != NULL, NULL);
301
302 - ipset = g_strsplit (ifnet_get_data (conn_name, "config"), "\" \"", 0);
303 + ipset = split_addresses (ifnet_get_data (conn_name, "config"));
304 length = g_strv_length (ipset);
305
306 routes = ifnet_get_data (conn_name, "routes");
307 @@ -584,73 +627,16 @@ convert_ip4_config_block (const char *conn_name)
308 for (i = 0; i < length; i++) {
309 ip = ipset[i];
310 ip = strip_string (ip, '"');
311 - //Handle ip like 192.168.4.{1..3}
312 - if ((pos = strchr (ip, '{')) != NULL) {
313 - gchar *ip_start, *ip_prefix;
314 - gchar *begin_str, *end_str;
315 - int begin, end, j;
316 - GRegex *regex;
317 - GMatchInfo *match_info;
318 -
319 - regex = g_regex_new (pattern, 0, 0, NULL);
320 - g_regex_match (regex, ip, 0, &match_info);
321 - g_regex_unref (regex);
322 -
323 - if (!g_match_info_matches (match_info)) {
324 - g_match_info_free (match_info);
325 - continue;
326 - }
327 - begin_str = g_match_info_fetch (match_info, 3);
328 - end_str = g_match_info_fetch (match_info, 4);
329 - begin = atoi (begin_str);
330 - end = atoi (end_str);
331 - ip_start = g_match_info_fetch (match_info, 2);
332 - ip_prefix = g_match_info_fetch (match_info, 5);
333 - if (end < begin || begin < 1 || end > 254) {
334 - g_match_info_free (match_info);
335 - continue;
336 - }
337 -
338 - for (j = begin; j <= end; j++) {
339 - char suf[4];
340 - gchar *newip;
341 -
342 - sprintf (suf, "%d", j);
343 - newip =
344 - g_strconcat (ip_start, suf, ip_prefix,
345 - NULL);
346 - iblock = create_ip4_block (newip);
347 - if (iblock == NULL) {
348 - g_free (newip);
349 - continue;
350 - }
351 - if (!iblock->gateway && def_gateway != 0)
352 - iblock->gateway = def_gateway;
353 - if (start == NULL)
354 - start = current = iblock;
355 - else {
356 - current->next = iblock;
357 - current = iblock;
358 - }
359 - g_free (newip);
360 - }
361 - g_free (begin_str);
362 - g_free (end_str);
363 - g_free (ip_start);
364 - g_free (ip_prefix);
365 - g_match_info_free (match_info);
366 - } else {
367 - iblock = create_ip4_block (ip);
368 - if (iblock == NULL)
369 - continue;
370 - if (!iblock->gateway && def_gateway != 0)
371 - iblock->gateway = def_gateway;
372 - if (start == NULL)
373 - start = current = iblock;
374 - else {
375 - current->next = iblock;
376 - current = iblock;
377 - }
378 + iblock = create_ip4_block (ip);
379 + if (iblock == NULL)
380 + continue;
381 + if (!iblock->gateway && def_gateway != 0)
382 + iblock->gateway = def_gateway;
383 + if (start == NULL)
384 + start = current = iblock;
385 + else {
386 + current->next = iblock;
387 + current = iblock;
388 }
389 }
390 g_strfreev (ipset);
391 @@ -667,7 +653,7 @@ convert_ip6_config_block (const char *conn_name)
392 ip6_block *start = NULL, *current = NULL, *iblock = NULL;
393
394 g_return_val_if_fail (conn_name != NULL, NULL);
395 - ipset = g_strsplit (ifnet_get_data (conn_name, "config"), "\" \"", 0);
396 + ipset = split_addresses (ifnet_get_data (conn_name, "config"));
397 length = g_strv_length (ipset);
398 for (i = 0; i < length; i++) {
399 ip = ipset[i];
400 @@ -693,15 +679,11 @@ convert_ip4_routes_block (const char *conn_name)
401 guint length;
402 guint i;
403 gchar *ip;
404 - const char *routes;
405 ip_block *start = NULL, *current = NULL, *iblock = NULL;
406
407 g_return_val_if_fail (conn_name != NULL, NULL);
408
409 - routes = ifnet_get_data (conn_name, "routes");
410 - if (!routes)
411 - return NULL;
412 - ipset = g_strsplit (routes, "\" \"", 0);
413 + ipset = split_routes (ifnet_get_data (conn_name, "routes"));
414 length = g_strv_length (ipset);
415 for (i = 0; i < length; i++) {
416 ip = ipset[i];
417 @@ -731,15 +713,11 @@ convert_ip6_routes_block (const char *conn_name)
418 guint length;
419 guint i;
420 gchar *ip, *tmp_addr;
421 - const char *routes;
422 ip6_block *start = NULL, *current = NULL, *iblock = NULL;
423 struct in6_addr *tmp_ip6_addr;
424
425 g_return_val_if_fail (conn_name != NULL, NULL);
426 - routes = ifnet_get_data (conn_name, "routes");
427 - if (!routes)
428 - return NULL;
429 - ipset = g_strsplit (routes, "\" \"", 0);
430 + ipset = split_routes (ifnet_get_data (conn_name, "routes"));
431 length = g_strv_length (ipset);
432 for (i = 0; i < length; i++) {
433 ip = ipset[i];
434 diff --git a/src/settings/plugins/ifnet/tests/net b/src/settings/plugins/ifnet/tests/net
435 index 0eef399..27d39f4 100644
436 --- a/src/settings/plugins/ifnet/tests/net
437 +++ b/src/settings/plugins/ifnet/tests/net
438 @@ -27,10 +27,9 @@ config_eth2=(
439 routes_eth2=("default via 4321:0:1:2:3:4:567:89ab")
440 enable_ipv6_eth2="true"
441 config_eth3=("nufjlsjlll")
442 -managed_eth4=("false")
443 +managed_eth4="false"
444 routes_eth4=("default via 4321:0:1:2:3:4:567:89ab")
445 config_eth5=("dhcp")
446 -config_eth6=("192.168.4.{1..101}/24")
447
448 config_eth7=( "dhcp" )
449 auto_eth7="true"
450 @@ -38,6 +37,14 @@ auto_eth7="true"
451 # missing config_eth8
452 auto_eth8="true"
453
454 +#new openrc style
455 +config_eth9="202.117.16.10/24 202.117.17.10/24"
456 +routes_eth9="default via 202.117.16.1
457 +10.0.0.0/8 via 192.168.0.1
458 +"
459 +config_eth10="202.117.16.2 netmask 255.255.255.0"
460 +routes_eth10="10.0.0.0/8 via 192.168.0.1"
461 +
462 config_myxjtu2=("202.117.16.121/24 brd 202.117.16.255")
463 routes_myxjtu2=("default via 202.117.16.1")
464 dns_servers_myxjtu2="202.117.0.20 202.117.0.21"
465 diff --git a/src/settings/plugins/ifnet/tests/test_all.c b/src/settings/plugins/ifnet/tests/test_all.c
466 index 52d9ce2..9ca5f65 100644
467 --- a/src/settings/plugins/ifnet/tests/test_all.c
468 +++ b/src/settings/plugins/ifnet/tests/test_all.c
469 @@ -37,7 +37,7 @@ static void
470 test_getdata ()
471 {
472 ASSERT (ifnet_get_data ("eth1", "config")
473 - && strcmp (ifnet_get_data ("eth1", "config"), "dhcp") == 0,
474 + && strcmp (ifnet_get_data ("eth1", "config"), "( \"dhcp\" )") == 0,
475 "get data", "config_eth1 is not correct");
476 ASSERT (ifnet_get_data ("ppp0", "username")
477 && strcmp (ifnet_get_data ("ppp0", "username"), "user") == 0,
478 @@ -84,7 +84,7 @@ test_is_static ()
479 ASSERT (is_static_ip4 ("eth0") == TRUE, "is static",
480 "a static interface is recognized as dhcp");
481 ASSERT (!is_static_ip6 ("eth0") == TRUE, "is static",
482 - "a static interface is recognized as dhcp");
483 + "a dhcp interface is recognized as static");
484 }
485
486 static void
487 @@ -182,10 +182,6 @@ test_convert_ipv4_config_block ()
488 ASSERT (iblock == NULL, "convert config_block",
489 "convert error configuration");
490 destroy_ip_block (iblock);
491 - iblock = convert_ip4_config_block ("eth6");
492 - ASSERT (iblock != NULL, "convert config_block",
493 - "convert error configuration");
494 - destroy_ip_block (iblock);
495 }
496
497 static void
498 @@ -200,6 +196,16 @@ test_convert_ipv4_routes_block ()
499 destroy_ip_block (tmp);
500 ASSERT (iblock == NULL, "convert ip4 routes",
501 "should only get one route");
502 +
503 + iblock = convert_ip4_routes_block ("eth9");
504 + tmp = iblock;
505 +
506 + ASSERT (iblock != NULL, "convert ip4 routes", "should get one route");
507 + check_ip_block (iblock, "10.0.0.0", "255.0.0.0", "192.168.0.1");
508 + iblock = iblock->next;
509 + destroy_ip_block (tmp);
510 + ASSERT (iblock == NULL, "convert ip4 routes",
511 + "should only get one route");
512 }
513
514 static void
515 @@ -272,6 +278,18 @@ test_new_connection ()
516 "new connection failed: %s",
517 error ? error->message : "NONE");
518 g_object_unref (connection);
519 +
520 + connection = ifnet_update_connection_from_config_block ("eth9", &error);
521 + ASSERT (connection != NULL, "new connection",
522 + "new connection(eth9) failed: %s",
523 + error ? error->message : "NONE");
524 + g_object_unref (connection);
525 +
526 + connection = ifnet_update_connection_from_config_block ("eth10", &error);
527 + ASSERT (connection != NULL, "new connection",
528 + "new connection(eth10) failed: %s",
529 + error ? error->message : "NONE");
530 + g_object_unref (connection);
531 }
532
533 #define NET_GEN_NAME "net.generate"
534 --
535 1.7.3.4
536
537 From 73a17edee3ba1f378166e0eee69f25b28902ce8d Mon Sep 17 00:00:00 2001
538 From: Mu Qiao <qiaomuf@gentoo.org>
539 Date: Wed, 7 Dec 2011 10:39:26 +0800
540 Subject: [PATCH 2/2] ifnet: support writing for openrc style
541
542 ---
543 src/settings/plugins/ifnet/net_parser.c | 20 +++++++++++++-------
544 1 files changed, 13 insertions(+), 7 deletions(-)
545
546 diff --git a/src/settings/plugins/ifnet/net_parser.c b/src/settings/plugins/ifnet/net_parser.c
547 index 4befc37..abca89c 100644
548 --- a/src/settings/plugins/ifnet/net_parser.c
549 +++ b/src/settings/plugins/ifnet/net_parser.c
550 @@ -476,22 +476,28 @@ format_ips (gchar * value, gchar ** out_line, gchar * key, gchar * name)
551 guint length, i;
552 GString *formated_string = g_string_new (NULL);
553
554 + strip_string (value, '(');
555 + strip_string (value, ')');
556 strip_string (value, '"');
557 - ipset = g_strsplit (value, "\" \"", 0);
558 + ipset = g_strsplit (value, "\"", 0);
559 length = g_strv_length (ipset);
560
561 //only one line
562 if (length < 2) {
563 *out_line =
564 - g_strdup_printf ("%s_%s=( \"%s\" )\n", key, name, value);
565 + g_strdup_printf ("%s_%s=\"%s\"\n", key, name, value);
566 goto done;
567 }
568 // Multiple lines
569 - g_string_append_printf (formated_string, "%s_%s=(\n", key, name);
570 + g_string_append_printf (formated_string, "%s_%s=\"\n", key, name);
571 for (i = 0; i < length; i++)
572 - g_string_append_printf (formated_string,
573 - "\t\"%s\"\n", ipset[i]);
574 - g_string_append (formated_string, ")\n");
575 + {
576 + strip_string (ipset[i], ' ');
577 + if (ipset[i][0] != '\0')
578 + g_string_append_printf (formated_string,
579 + "%s\n", ipset[i]);
580 + }
581 + g_string_append (formated_string, "\"\n");
582 *out_line = g_strdup (formated_string->str);
583 done:
584 g_string_free (formated_string, TRUE);
585 @@ -506,7 +512,7 @@ ifnet_flush_to_file (const char *config_file)
586 gpointer key, value, name, network;
587 GHashTableIter iter, iter_network;
588 GList *list_iter;
589 - gchar *out_line;
590 + gchar *out_line = NULL;
591 gsize bytes_written;
592 gboolean result = FALSE;
593
594 --
595 1.7.3.4

  ViewVC Help
Powered by ViewVC 1.1.20