2008-04-15 Tiago Pierezan Camargo Dont let NetworkManger work on interfaces without enabled (without an !) in rc.conf (Arch Linux) --- nm-old/src/backends/NetworkManagerArch.c 2007-04-18 20:13:06.000000000 +0200 +++ nm-new/src/backends/NetworkManagerArch.c 2008-04-15 14:50:55.000000000 +0200 @@ -568,6 +568,17 @@ } + /* Find if our network device is enabled in rc.conf */ + if ((val=g_hash_table_lookup(cfg,"INTERFACES"))) { + gchar match[8] = "!"; + g_strlcat(match, dev, 8); + + if (!g_strrstr(val, match)) + /* interface not negated in rc.conf. nm should not mess with it */ + g_hash_table_insert(ifs,g_strdup("disable"),g_strdup("true")); + + } + /* Find our network device */ if ((val=g_hash_table_lookup(cfg,dev))) { @@ -653,6 +664,7 @@ { NMIP4Config * config; gboolean use_dhcp; + gboolean disable; } ArchSystemConfigData; @@ -677,6 +689,7 @@ sys_data = g_malloc0 (sizeof (ArchSystemConfigData)); sys_data->use_dhcp = TRUE; sys_data->config=NULL; + sys_data->disable = FALSE; ifh=ArchReadConfig("/etc/rc.conf",nm_device_get_iface(dev)); if (ifh==NULL) @@ -685,6 +698,11 @@ return NULL; } val=g_hash_table_lookup(ifh,nm_device_get_iface(dev)); + + if (g_hash_table_lookup(ifh, "disable")) { + sys_data->disable = TRUE; + } + if (val && !g_hash_table_lookup(ifh, "dhcp")) { /* This device does not use DHCP */ @@ -803,6 +821,18 @@ */ gboolean nm_system_device_get_disabled (NMDevice *dev) { + + ArchSystemConfigData *sys_data; + + g_return_val_if_fail (dev != NULL, TRUE); + + sys_data = nm_device_get_system_config_data(dev); + + if (sys_data->disable) { + nm_info ("Device %s enabled in rc.conf. Removing it from the devices list", nm_device_get_iface(dev)); + return TRUE; + } + return FALSE; }