Re: keyfile plugin initialization and wireless at boot



I've tried that as well and can confirm a problem.

I rebooted to Ubuntu and added this line to /etc/network/interfaces
iface eth0 inet dhcp
That triggers the problem.

I looked into it a bit to find the cause. This is what is going on, IMO:

src/system-settings/nm-sysconfig-settings.c:load_plugins() function is used to 
load configured plugins. It adds the plugins to internal list that is used 
further in the code; this is done via add_plugin() function. In addition, 
add_plugin() funtion calls nm_system_config_interface_init (plugin, NULL) to 
initialize the plugin beeing added.
In case of 'ifupdown' SCPluginIfupdown_init (plugin.c) is invoked and it adds 
well-known interfaces via udev_device_added().
Here the working and not working case are forking. Without 'iface eth0 ...',
the function returns (log message: "device added (path: %s, iface: %s): no 
ifupdown configuration found.").  However with eth0 present in interfaces file,
g_signal_emit_by_name (G_OBJECT (self), 
NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED) is called.
That casues NM to invoke 
nm_sysconfig_settings_get_unmanaged_specs() and load_connections() in turn from 
src/system-settings/nm-sysconfig-settings.c.
*BUT* in this moment only 'ifupdown' plugin has been loaded. And because 
load_connections() is protected via 'connections_loaded'  guard, it won't load 
connections from 'keyfile' plugin later when it is added by add_plugin().

The attached patch should fix the problem.
Basically, it adds another boolean guard to load_connections() causing that
it loads the connections only after *all* plugins have been loaded.
Nevertheless, not sure if this is the right solution.

Here is a stack from gdb (it's clearer that my description):
Breakpoint 1, load_connections (self=0x80ef018) at nm-sysconfig-settings.c:133
133             NMSysconfigSettingsPrivate *priv = 
NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
(gdb) bt
#0  load_connections (self=0x80ef018) at nm-sysconfig-settings.c:133
#1  0x080b94c3 in nm_sysconfig_settings_get_unmanaged_specs (self=0x80ef018) at 
nm-sysconfig-settings.c:248
#2  0x080bc583 in get_property (object=0x80ef018, prop_id=1, value=0x80de330, 
pspec=0x80e0340) at nm-sysconfig-settings.c:1428
#3  0x003684b8 in g_object_get_property () from /usr/lib/libgobject-2.0.so.0
#4  0x080b93dc in notify (object=0x80ef018, pspec=0x80e0340) at nm-sysconfig-
settings.c:233
#5  0x00372118 in g_cclosure_marshal_VOID__PARAM () from 
/usr/lib/libgobject-2.0.so.0
#6  0x003636f9 in ?? () from /usr/lib/libgobject-2.0.so.0
#7  0x00365072 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#8  0x0037a0b0 in ?? () from /usr/lib/libgobject-2.0.so.0
#9  0x0037bb2d in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#10 0x0037bfb6 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#11 0x003693e1 in ?? () from /usr/lib/libgobject-2.0.so.0
#12 0x00365daf in ?? () from /usr/lib/libgobject-2.0.so.0
#13 0x0036aec3 in g_object_notify () from /usr/lib/libgobject-2.0.so.0
#14 0x080b9886 in unmanaged_specs_changed (config=0x80f5640, 
user_data=0x80ef018) at nm-sysconfig-settings.c:343
#15 0x003729fc in g_cclosure_marshal_VOID__VOID () from 
/usr/lib/libgobject-2.0.so.0
#16 0x00365072 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#17 0x0037a7a8 in ?? () from /usr/lib/libgobject-2.0.so.0
#18 0x0037bb2d in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#19 0x0037be42 in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
#20 0x002a5b33 in udev_device_added (self=0x80f5640, device=0x80e0718) at 
plugin.c:266
#21 0x002a6469 in SCPluginIfupdown_init (config=0x80f5640) at plugin.c:448
#22 0x080bd66b in nm_system_config_interface_init (config=0x80f5640, unused=0x0) 
at nm-system-config-interface.c:126
#23 0x080b9ab1 in add_plugin (self=0x80ef018, plugin=0x80f5640) at nm-
sysconfig-settings.c:374
#24 0x080ba031 in load_plugins (self=0x80ef018, plugins=0x80e1438 
"ifupdown,keyfile", error=0xbffff6f0) at nm-sysconfig-settings.c:481
#25 0x080bc2c1 in nm_sysconfig_settings_new (config_file=0x80df608 
"//etc/NetworkManager/nm-system-settings.conf", 
    plugins=0x80e1438 "ifupdown,keyfile", bus=0x80e6b1c, error=0xbffff6f0) at nm-
sysconfig-settings.c:1345
#26 0x0808a77d in nm_manager_get (config_file=0x80df608 
"//etc/NetworkManager/nm-system-settings.conf", 
    plugins=0x80e1438 "ifupdown,keyfile", state_file=0x80de700 
"//var/lib/NetworkManager/NetworkManager.state", initial_net_enabled=1,
    initial_wifi_enabled=1, initial_wwan_enabled=1, error=0xbffff6f0) at nm-
manager.c:2957
#27 0x0808359a in main (argc=1, argv=0xbffff7f4) at main.c:646


As far as "Available to all users" is concerned, I didn't tested that 
specifically. However I think it was sensitive in my case.

Jirka
diff --git a/src/system-settings/nm-sysconfig-settings.c b/src/system-settings/nm-sysconfig-settings.c
index b120953..b2eda02 100644
--- a/src/system-settings/nm-sysconfig-settings.c
+++ b/src/system-settings/nm-sysconfig-settings.c
@@ -100,6 +100,7 @@ typedef struct {
 
 	GSList *plugins;
 	gboolean connections_loaded;
+	gboolean all_plugins_loaded;
 	GHashTable *connections;
 	GSList *unmanaged_specs;
 } NMSysconfigSettingsPrivate;
@@ -133,6 +134,9 @@ load_connections (NMSysconfigSettings *self)
 	NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
 	GSList *iter;
 
+	if (!priv->all_plugins_loaded)
+		return;
+
 	if (priv->connections_loaded)
 		return;
 
@@ -1328,6 +1344,7 @@ nm_sysconfig_settings_new (const char *config_file,
 			g_object_unref (self);
 			return NULL;
 		}
+		priv->all_plugins_loaded = TRUE;
 	}
 
 	return self;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]