=== modified file 'system-settings/plugins/ifupdown/plugin.c' --- a/system-settings/plugins/ifupdown/plugin.c 2008-10-20 14:22:58.000000000 +0000 +++ b/system-settings/plugins/ifupdown/plugin.c 2008-11-04 08:52:36.000000000 +0000 @@ -73,6 +73,7 @@ GHashTable *iface_connections; gchar* hostname; + GHashTable *well_known_interfaces; GHashTable *well_known_udis; gboolean unmanage_well_known; @@ -293,32 +294,44 @@ udi, &error); - PLUGIN_PRINT("SCPlugin-Ifupdown", - "devices added (udi: %s, iface: %s)", udi, iface); - - if(!iface) + if(!iface) { + PLUGIN_PRINT("SCPlugin-Ifupdown", + "device added (udi: %s, iface: %s): iface not found", udi, iface); return; + } - exported_iface_connection = - NM_EXPORTED_CONNECTION (g_hash_table_lookup (priv->iface_connections, iface)); - - /* if we have a configured connection for this particular iface - * we want to either unmanage the device or lock it - */ - if(!exported_iface_connection) - goto out; - - iface_connection = nm_exported_connection_get_connection (exported_iface_connection); - - if(!iface_connection) + if(!g_hash_table_lookup (priv->well_known_interfaces, iface)) { + PLUGIN_PRINT("SCPlugin-Ifupdown", + "device added (udi: %s, iface: %s): not well known", udi, iface); goto out; + } + PLUGIN_PRINT("SCPlugin-Ifupdown", + "device added (udi: %s, iface: %s): well known", udi, iface); g_hash_table_insert (priv->well_known_udis, (gpointer)udi, "nothing"); if (ALWAYS_UNMANAGE || priv->unmanage_well_known) g_signal_emit_by_name (G_OBJECT(config), "unmanaged-devices-changed"); - else + else { + exported_iface_connection = + NM_EXPORTED_CONNECTION (g_hash_table_lookup (priv->iface_connections, iface)); + + if(!exported_iface_connection) { + PLUGIN_PRINT("SCPlugin-Ifupdown", + "device added (udi: %s, iface: %s): no exported connection", udi, iface); + goto out; + } + + iface_connection = nm_exported_connection_get_connection (exported_iface_connection); + + if(!iface_connection) { + goto out; + PLUGIN_PRINT("SCPlugin-Ifupdown", + "device added (udi: %s, iface: %s): no iface connection", udi, iface); + } + bind_device_to_connection (config, priv->g_connection, udi, exported_iface_connection); + } out: g_free (iface); @@ -371,6 +384,9 @@ if(!priv->iface_connections) priv->iface_connections = g_hash_table_new (g_str_hash, g_str_equal); + if(!priv->well_known_interfaces) + priv->well_known_interfaces = g_hash_table_new (g_str_hash, g_str_equal); + if(!priv->well_known_udis) priv->well_known_udis = g_hash_table_new (g_str_hash, g_str_equal); @@ -413,6 +429,9 @@ block); g_hash_table_insert (priv->iface_connections, block->name, connection); + g_hash_table_insert (priv->well_known_interfaces, block->name, "known"); + } else if (!strcmp ("mapping", block->type)) { + g_hash_table_insert (priv->well_known_interfaces, block->name, "known"); } block = block -> next; } @@ -686,6 +705,9 @@ if (priv->inotify_system_hostname_wd >= 0) nm_inotify_helper_remove_watch (inotify_helper, priv->inotify_system_hostname_wd); + if (priv->well_known_interfaces) + g_hash_table_destroy(priv->well_known_interfaces); + if (priv->well_known_udis) g_hash_table_destroy(priv->well_known_udis);