~network-manager/network-manager/ubuntu.hardy.07

« back to all changes in this revision

Viewing changes to system-settings/plugins/ifupdown/parser.c

(merge) RELEASE 0.7~~svn20080928t225540+eni0-0ubuntu1 to ubuntu/intrepid

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
 
2
 
 
3
/* NetworkManager system settings service (ifupdown)
 
4
 *
 
5
 * Alexander Sack <asac@ubuntu.com>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
 *
 
21
 * (C) Copyright 2008 Canonical Ltd.
 
22
 */
 
23
 
 
24
#include <string.h>
 
25
#include <arpa/inet.h>
 
26
 
 
27
#include <nm-connection.h>
 
28
#include <NetworkManager.h>
 
29
#include <nm-setting-connection.h>
 
30
#include <nm-setting-ip4-config.h>
 
31
#include <nm-setting-ppp.h>
 
32
#include <nm-setting-wired.h>
 
33
#include <nm-setting-wireless.h>
 
34
#include <nm-setting-8021x.h>
 
35
#include <nm-system-config-interface.h>
 
36
#include <nm-utils.h>
 
37
 
 
38
#include "parser.h"
 
39
#include "plugin.h"
 
40
#include "sha1.h"
 
41
 
 
42
 
 
43
#define WPA_PMK_LEN 32
 
44
 
 
45
#include "parser.h"
 
46
 
 
47
static const gchar*
 
48
_ifupdownplugin_guess_connection_type (if_block *block)
 
49
{
 
50
        if_data *curr = block->info;
 
51
        const gchar* ret_type = NULL;
 
52
        const gchar* value = ifparser_getkey(block, "inet");
 
53
        if(value && !strcmp("ppp", value)) {
 
54
                ret_type = NM_SETTING_PPP_SETTING_NAME;
 
55
        }
 
56
 
 
57
        while(!ret_type && curr) {
 
58
                if(!strncmp("wireless-", curr->key, strlen("wireless-")) ||
 
59
                   !strncmp("wpa-", curr->key, strlen("wpa-"))) {
 
60
                        ret_type = NM_SETTING_WIRELESS_SETTING_NAME;
 
61
                }
 
62
                curr = curr->next;
 
63
        }
 
64
 
 
65
        if(!ret_type)
 
66
                ret_type = NM_SETTING_WIRED_SETTING_NAME;
 
67
 
 
68
        PLUGIN_PRINT("SCPluginIfupdown",
 
69
                           "guessed connection type (%s) = %s",
 
70
                           block->name, ret_type);
 
71
        return ret_type;
 
72
}
 
73
 
 
74
/* 
 
75
 * utils_bin2hexstr 
 
76
 * 
 
77
 * Convert a byte-array into a hexadecimal string. 
 
78
 * 
 
79
 * Code originally by Alex Larsson <alexl@redhat.com> and 
 
80
 *  copyright Red Hat, Inc. under terms of the LGPL. 
 
81
 * 
 
82
 */ 
 
83
static char * 
 
84
utils_bin2hexstr (const char *bytes, int len, int final_len) 
 
85
 
86
        static char     hex_digits[] = "0123456789abcdef"; 
 
87
        char *          result; 
 
88
        int                     i; 
 
89
 
 
90
        g_return_val_if_fail (bytes != NULL, NULL); 
 
91
        g_return_val_if_fail (len > 0, NULL); 
 
92
        g_return_val_if_fail (len < 256, NULL); /* Arbitrary limit */ 
 
93
 
 
94
        result = g_malloc0 (len * 2 + 1); 
 
95
        for (i = 0; i < len; i++) 
 
96
        { 
 
97
                result[2*i] = hex_digits[(bytes[i] >> 4) & 0xf]; 
 
98
                result[2*i+1] = hex_digits[bytes[i] & 0xf]; 
 
99
        } 
 
100
        /* Cut converted key off at the correct length for this cipher type */ 
 
101
        if (final_len > -1) 
 
102
                result[final_len] = '\0'; 
 
103
 
 
104
        return result; 
 
105
 
106
 
 
107
 
 
108
struct _Mapping {
 
109
        const gchar *domain;
 
110
        const gpointer target;
 
111
};
 
112
 
 
113
static gpointer
 
114
map_by_mapping(struct _Mapping *mapping, const gchar *key)
 
115
{
 
116
        struct _Mapping *curr = mapping;
 
117
        while(curr->domain) {
 
118
                if(!strcmp(curr->domain, key))
 
119
                        return curr->target;
 
120
                curr++;
 
121
        }
 
122
        return NULL;
 
123
}
 
124
 
 
125
static void
 
126
update_wireless_setting_from_if_block(NMConnection *connection,
 
127
                                                           if_block *block)
 
128
{
 
129
        gint wpa_l= strlen("wpa-");
 
130
        gint wireless_l= strlen("wireless-");
 
131
 
 
132
        if_data *curr = block->info;
 
133
        const gchar* value = ifparser_getkey (block, "inet");
 
134
        struct _Mapping mapping[] = {
 
135
                {"ssid", "ssid"},
 
136
                { NULL, NULL}
 
137
        };
 
138
 
 
139
        NMSettingWireless *wireless_setting = NULL;
 
140
 
 
141
        if(value && !strcmp("ppp", value)) {
 
142
                return;
 
143
        }
 
144
 
 
145
        PLUGIN_PRINT ("SCPlugin-Ifupdown", "update wireless settings (%s).", block->name);
 
146
        wireless_setting = NM_SETTING_WIRELESS(nm_setting_wireless_new());
 
147
 
 
148
        while(curr) {
 
149
                if(strlen(curr->key) > wireless_l &&
 
150
                   !strncmp("wireless-", curr->key, wireless_l)) {
 
151
                        const gchar* newkey = map_by_mapping(mapping, curr->key+wireless_l);
 
152
                        PLUGIN_PRINT ("SCPlugin-Ifupdown", "wireless setting key: %s='%s'",
 
153
                                            newkey, curr->data);
 
154
                        g_object_set(wireless_setting,
 
155
                                           newkey, curr->data,
 
156
                                           NULL);
 
157
                } else if(strlen(curr->key) > wpa_l &&
 
158
                                !strncmp("wpa-", curr->key, wpa_l)) {
 
159
                        const gchar* newkey = map_by_mapping(mapping, curr->key+wpa_l);
 
160
 
 
161
                        if(newkey && !strcmp("ssid", newkey)) {
 
162
                                gint len = strlen(curr->data);
 
163
                                wireless_setting->ssid = g_byte_array_sized_new (len);
 
164
                                g_byte_array_append (wireless_setting->ssid, (const guint8 *) curr->data, len);
 
165
                                PLUGIN_PRINT("SCPlugin-Ifupdown", "setting wpa ssid = %d", wireless_setting->ssid->len);
 
166
                        } else if(newkey) {
 
167
 
 
168
                                g_object_set(wireless_setting,
 
169
                                                   newkey, curr->data,
 
170
                                                   NULL);
 
171
                                PLUGIN_PRINT ("SCPlugin-Ifupdown", "setting wpa newkey(%s)=data(%s)", newkey, curr->data);
 
172
                        }
 
173
                }
 
174
                curr = curr->next;
 
175
        }
 
176
        nm_connection_add_setting(connection, (NMSetting*) wireless_setting);
 
177
}
 
178
 
 
179
typedef gchar* (*IfupdownStrDupeFunc) (gpointer value, gpointer data);
 
180
typedef gpointer (*IfupdownStrToTypeFunc) (const gchar* value);
 
181
 
 
182
static char*
 
183
normalize_dupe (gpointer value, gpointer data) {
 
184
        return g_strdup(value);
 
185
}
 
186
 
 
187
static char*
 
188
normalize_tolower (gpointer value, gpointer data) {
 
189
        return g_ascii_strdown(value, -1);
 
190
}
 
191
 
 
192
static char *normalize_psk (gpointer value, gpointer data) {
 
193
        NMConnection *connection = data;
 
194
        NMSettingWireless *s_wireless =
 
195
                NM_SETTING_WIRELESS(nm_connection_get_setting(connection, NM_TYPE_SETTING_WIRELESS));
 
196
        gchar *normalized;
 
197
        if (strlen (value) == 64) {
 
198
                normalized = g_strdup (value);
 
199
        } else {
 
200
                /* passphrase */
 
201
                unsigned char *buf = g_malloc0 (WPA_PMK_LEN * 2);
 
202
                pbkdf2_sha1 (value, (char *) s_wireless->ssid->data, s_wireless->ssid->len, 4096, buf, WPA_PMK_LEN);
 
203
                normalized = utils_bin2hexstr ((const char *) buf, WPA_PMK_LEN, WPA_PMK_LEN * 2);
 
204
                g_free (buf);
 
205
        }
 
206
        return normalized;
 
207
}
 
208
 
 
209
static gpointer
 
210
string_to_glist_of_strings(const gchar* data)
 
211
{
 
212
        GSList *ret = NULL;
 
213
        gchar *string = (gchar*) data;
 
214
        while(string) {
 
215
                gchar* next = NULL;
 
216
                if( (next = strchr(string, ' '))  ||
 
217
                    (next = strchr(string, '\t')) ||
 
218
                    (next = strchr(string, '\0')) ) {
 
219
 
 
220
                        gchar *part = g_strndup(string, (next - string));
 
221
                        ret = g_slist_append(ret, part);
 
222
                        if (*next)
 
223
                                string = next+1;
 
224
                        else
 
225
                                string = NULL;
 
226
                } else {
 
227
                        string = NULL;
 
228
                }
 
229
        }
 
230
        return ret;
 
231
}
 
232
 
 
233
static void
 
234
update_wireless_security_setting_from_if_block(NMConnection *connection,
 
235
                                                                          if_block *block)
 
236
{
 
237
        gint wpa_l= strlen("wpa-");
 
238
        gint wireless_l= strlen("wireless-");
 
239
        if_data *curr = block->info;
 
240
        const gchar* value = ifparser_getkey (block, "inet");
 
241
        struct _Mapping mapping[] = {
 
242
                {"psk", "psk"},
 
243
                {"identity", "identity"},
 
244
                {"password", "password"},
 
245
                {"key", "key"},
 
246
                {"key-mgmt", "key-mgmt"},
 
247
                {"group", "group"},
 
248
                {"pairwise", "pairwise"},
 
249
                {"proto", "proto"},
 
250
                {"pin", "pin"},
 
251
                {"wep-key0", "wep-key0"},
 
252
                {"wep-key1", "wep-key1"},
 
253
                {"wep-key2", "wep-key2"},
 
254
                {"wep-key3", "wep-key3"},
 
255
                {"wep-tx-keyidx", "wep-tx-keyidx"},
 
256
                { NULL, NULL}
 
257
        };
 
258
 
 
259
        struct _Mapping dupe_mapping[] = {
 
260
                {"psk", normalize_psk},
 
261
                {"identity", normalize_dupe},
 
262
                {"password", normalize_dupe},
 
263
                {"key", normalize_dupe},
 
264
                {"key-mgmt", normalize_tolower},
 
265
                {"group", normalize_tolower},
 
266
                {"pairwise", normalize_tolower},
 
267
                {"proto", normalize_tolower},
 
268
                {"pin", normalize_dupe},
 
269
                {"wep-key0", normalize_dupe},
 
270
                {"wep-key1", normalize_dupe},
 
271
                {"wep-key2", normalize_dupe},
 
272
                {"wep-key3", normalize_dupe},
 
273
                {"wep-tx-keyidx", normalize_dupe},
 
274
                { NULL, NULL}
 
275
        };
 
276
 
 
277
        struct _Mapping type_mapping[] = {
 
278
                {"group", string_to_glist_of_strings},
 
279
                {"pairwise", string_to_glist_of_strings},
 
280
                {"proto", string_to_glist_of_strings},
 
281
                { NULL, NULL}
 
282
        };
 
283
 
 
284
 
 
285
        NMSettingWirelessSecurity *wireless_security_setting;
 
286
        NMSettingWireless *s_wireless;
 
287
        gboolean security = FALSE;
 
288
 
 
289
        if(value && !strcmp("ppp", value)) {
 
290
                return;
 
291
        }
 
292
 
 
293
        s_wireless = NM_SETTING_WIRELESS(nm_connection_get_setting(connection,
 
294
                                                                                                    NM_TYPE_SETTING_WIRELESS));
 
295
        g_return_if_fail(s_wireless);
 
296
 
 
297
        PLUGIN_PRINT ("SCPlugin-Ifupdown","update wireless security settings (%s).", block->name);
 
298
        wireless_security_setting =
 
299
                NM_SETTING_WIRELESS_SECURITY(nm_setting_wireless_security_new());
 
300
 
 
301
        while(curr) {
 
302
                if(strlen(curr->key) > wireless_l &&
 
303
                   !strncmp("wireless-", curr->key, wireless_l)) {
 
304
 
 
305
                        gchar *property_value = NULL;
 
306
                        gpointer property_value2 = NULL;
 
307
                        const gchar* newkey = map_by_mapping(mapping, curr->key+wireless_l);
 
308
                        IfupdownStrDupeFunc func = map_by_mapping (dupe_mapping, curr->key+wireless_l);
 
309
                        IfupdownStrToTypeFunc func1 = map_by_mapping (type_mapping, curr->key+wireless_l);
 
310
                        if(!newkey || !func) {
 
311
                                g_warning("no (wireless) mapping found for key: %s", curr->key);
 
312
                                goto next;
 
313
                        }
 
314
                        property_value = (*func) (curr->data, connection);
 
315
                        PLUGIN_PRINT ("SCPlugin-Ifupdown", "setting wireless security key: %s=%s",
 
316
                                            newkey, property_value);
 
317
                        if(func1)
 
318
                                property_value2 = (*func1) (property_value);
 
319
                    
 
320
                        g_object_set(wireless_security_setting,
 
321
                                           newkey, property_value2 ? property_value2 : property_value,
 
322
                                           NULL);
 
323
                        security = TRUE;
 
324
                        g_free(property_value);
 
325
                        if(property_value)
 
326
                                g_free(property_value2);
 
327
                } else if(strlen(curr->key) > wpa_l &&
 
328
                                !strncmp("wpa-", curr->key, wpa_l)) {
 
329
 
 
330
                        gchar *property_value = NULL;
 
331
                        gpointer property_value2 = NULL;
 
332
                        const gchar* newkey = map_by_mapping(mapping, curr->key+wpa_l);
 
333
                        IfupdownStrDupeFunc func = map_by_mapping (dupe_mapping, curr->key+wpa_l);
 
334
                        IfupdownStrToTypeFunc func1 = map_by_mapping (type_mapping, curr->key+wpa_l);
 
335
                        if(!newkey || !func) {
 
336
                                goto next;
 
337
                        }
 
338
                        property_value = (*func) (curr->data, connection);
 
339
                        PLUGIN_PRINT ("SCPlugin-Ifupdown", "setting wpa security key: %s=%s",
 
340
                                            newkey,
 
341
#ifdef DEBUG_SECRETS
 
342
                                            property_value
 
343
#else // DEBUG_SECRETS
 
344
                                            !strcmp("key", newkey) ||
 
345
                                            !strcmp("password", newkey) ||
 
346
                                            !strcmp("pin", newkey) ||
 
347
                                            !strcmp("psk", newkey) ||
 
348
                                            !strcmp("wep-key0", newkey) ||
 
349
                                            !strcmp("wep-key1", newkey) ||
 
350
                                            !strcmp("wep-key2", newkey) ||
 
351
                                            !strcmp("wep-key3", newkey) ||
 
352
                                            NULL ?
 
353
                                            "<omitted>" : property_value
 
354
#endif // DEBUG_SECRETS
 
355
                                            );
 
356
 
 
357
                        if(func1)
 
358
                                property_value2 = (*func1) (property_value);
 
359
                    
 
360
                        g_object_set(wireless_security_setting,
 
361
                                           newkey, property_value2 ? property_value2 : property_value,
 
362
                                           NULL);
 
363
                        security = TRUE;
 
364
                        g_free(property_value);
 
365
                }
 
366
        next:
 
367
                curr = curr->next;
 
368
        }
 
369
 
 
370
 
 
371
        if(security) {
 
372
                nm_connection_add_setting(connection, NM_SETTING(wireless_security_setting));
 
373
                g_object_set(s_wireless, NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NULL);
 
374
        }
 
375
 
 
376
}
 
377
 
 
378
static void
 
379
update_wired_setting_from_if_block(NMConnection *connection,
 
380
                                                        if_block *block)
 
381
{
 
382
        NMSettingWired *s_wired = NULL;
 
383
        s_wired = NM_SETTING_WIRED(nm_setting_wired_new());
 
384
        nm_connection_add_setting(connection, NM_SETTING(s_wired));
 
385
}
 
386
 
 
387
static GQuark
 
388
eni_plugin_error_quark() {
 
389
        static GQuark error_quark = 0;
 
390
 
 
391
        if(!error_quark) {
 
392
                error_quark = g_quark_from_static_string ("eni-plugin-error-quark");
 
393
        }
 
394
 
 
395
        return error_quark;
 
396
}
 
397
        
 
398
 
 
399
static void
 
400
update_ip4_setting_from_if_block(NMConnection *connection,
 
401
                                                   if_block *block)
 
402
{
 
403
 
 
404
        NMSettingIP4Config *ip4_setting = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new());
 
405
        const char *type = ifparser_getkey(block, "inet");
 
406
        gboolean is_static = type && !strcmp("static", type);
 
407
 
 
408
        if(!is_static) {
 
409
                g_object_set(ip4_setting,
 
410
                                   NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
 
411
                                   NULL);
 
412
        } else {
 
413
                struct in_addr tmp_ip4_addr;
 
414
                NMSettingIP4Address *ip4config = g_new0(NMSettingIP4Address, 1);
 
415
                GSList *ip4_addresses = NULL;
 
416
                GArray *nameserver = g_array_new (TRUE, TRUE, sizeof(guint32));
 
417
 
 
418
                const char *address_v = ifparser_getkey(block, "address");
 
419
                const char *netmask_v = ifparser_getkey(block, "netmask");
 
420
                const char *gateway_v = ifparser_getkey(block, "gateway");
 
421
                const char *nameserver_v = ifparser_getkey(block, "dns-nameserver");
 
422
                const char *nameservers_v = ifparser_getkey(block, "dns-nameservers");
 
423
                GSList* nameservers_list = NULL;
 
424
                GSList* nameservers_list_i = NULL;
 
425
                GError *error = NULL;
 
426
 
 
427
                if(nameservers_v)
 
428
                        nameservers_list_i = nameservers_list = string_to_glist_of_strings (nameservers_v);
 
429
                if(nameserver_v)
 
430
                        nameservers_list_i = nameservers_list = g_slist_append(nameservers_list, g_strdup(nameserver_v));
 
431
 
 
432
                if (!address_v)
 
433
                        address_v = g_strdup ("0.0.0.0");
 
434
 
 
435
                if (inet_pton (AF_INET, address_v, &tmp_ip4_addr))
 
436
                        ip4config->address = tmp_ip4_addr.s_addr;
 
437
                else
 
438
                        g_set_error (&error, eni_plugin_error_quark (), 0,
 
439
                                           "Invalid %s IP4 address '%s'", "address", address_v);
 
440
                if (!netmask_v)
 
441
                        netmask_v = g_strdup( "255.255.255.255");
 
442
 
 
443
                if (inet_pton (AF_INET, netmask_v, &tmp_ip4_addr))
 
444
                        ip4config->prefix = nm_utils_ip4_netmask_to_prefix(tmp_ip4_addr.s_addr);
 
445
                else
 
446
                        g_set_error (&error, eni_plugin_error_quark (), 0,
 
447
                                           "Invalid %s IP4 address '%s'", "netmask", netmask_v);
 
448
 
 
449
                if (!gateway_v)
 
450
                        gateway_v = g_strdup (address_v);
 
451
 
 
452
                if (inet_pton (AF_INET, gateway_v, &tmp_ip4_addr))
 
453
                        ip4config->gateway = tmp_ip4_addr.s_addr;
 
454
                else
 
455
                        g_set_error (&error, eni_plugin_error_quark (), 0,
 
456
                                           "Invalid %s IP4 address '%s'", "gateway", gateway_v);
 
457
 
 
458
                ip4_addresses = g_slist_append(ip4_addresses, ip4config);
 
459
 
 
460
                PLUGIN_PRINT("SCPlugin-Ifupdown", "addresses count: %d", g_slist_length(ip4_addresses));
 
461
 
 
462
                while(nameservers_list_i) {
 
463
                        gchar *dns = nameservers_list_i->data;
 
464
                        nameservers_list_i = nameservers_list_i -> next;
 
465
                        if(!dns)
 
466
                                continue;
 
467
                        if (inet_pton (AF_INET, dns, &tmp_ip4_addr))
 
468
                                g_array_append_vals(nameserver, &tmp_ip4_addr.s_addr, 1);
 
469
                        else
 
470
                                g_set_error (&error, eni_plugin_error_quark (), 0,
 
471
                                                   "Invalid %s IP4 address nameserver '%s'", "nameserver", dns);
 
472
                }
 
473
                if (!nameserver->len)
 
474
                        PLUGIN_PRINT("SCPlugin-Ifupdown", "No dns-nameserver configured in /etc/network/interfaces");
 
475
 
 
476
                ip4_setting->addresses = ip4_addresses;
 
477
                ip4_setting->dns = nameserver;
 
478
 
 
479
                g_object_set(ip4_setting,
 
480
                                   NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
 
481
                                   NULL);
 
482
 
 
483
                g_slist_foreach (nameservers_list, (GFunc) g_free, NULL);
 
484
                g_slist_free (nameservers_list);
 
485
        }
 
486
 
 
487
        nm_connection_add_setting(connection, NM_SETTING(ip4_setting));
 
488
}
 
489
 
 
490
void
 
491
ifupdown_update_connection_from_if_block(NMConnection *connection,
 
492
                                                                 if_block *block)
 
493
{
 
494
        const char *type = NULL;
 
495
        char *idstr = NULL;
 
496
        char *uuid_base = NULL;
 
497
        GError *verify_error =NULL;
 
498
 
 
499
        NMSettingConnection *connection_setting =
 
500
                NM_SETTING_CONNECTION(nm_connection_get_setting
 
501
                                                  (connection, NM_TYPE_SETTING_CONNECTION));
 
502
 
 
503
        if(!connection_setting) {
 
504
                connection_setting = NM_SETTING_CONNECTION(nm_setting_connection_new());
 
505
                nm_connection_add_setting(connection, NM_SETTING(connection_setting));
 
506
        }
 
507
 
 
508
        type = _ifupdownplugin_guess_connection_type (block);
 
509
        idstr = g_strconcat("Ifupdown (", block->name,")", NULL);
 
510
        uuid_base = idstr;
 
511
 
 
512
        g_object_set (connection_setting,
 
513
                            "type", type,
 
514
                            "id", idstr,            
 
515
                            NULL);
 
516
        connection_setting->uuid =
 
517
                nm_utils_uuid_generate_from_string(uuid_base);
 
518
 
 
519
        PLUGIN_PRINT("SCPlugin-Ifupdown", "update_connection_setting_from_if_block: name:%s, type:%s, autoconnect:%d, id:%s, uuid: %s",
 
520
                           block->name, type,
 
521
                           ((gboolean) strcmp("dhcp", type) == 0),
 
522
                           idstr,
 
523
                           connection_setting->uuid);
 
524
 
 
525
        if(!strcmp (NM_SETTING_WIRED_SETTING_NAME, type)) {
 
526
                update_wired_setting_from_if_block (connection, block); 
 
527
        }
 
528
        else if(!strcmp (NM_SETTING_WIRELESS_SETTING_NAME, type)) {
 
529
                update_wireless_setting_from_if_block (connection, block);
 
530
                update_wireless_security_setting_from_if_block (connection, block);
 
531
        }
 
532
 
 
533
        update_ip4_setting_from_if_block(connection, block);
 
534
 
 
535
        if(!nm_connection_verify(connection, &verify_error)) {
 
536
                nm_warning("connection broken: %s (%d)",
 
537
                                 verify_error->message, verify_error->code);
 
538
        }
 
539
 
 
540
        g_free(idstr);
 
541
}