2008-10-10 Alexander Sack <asac@ubuntu.com>

Parse nm-system-settings.conf and allow admins to either use managed and unmanaged
	mode of the ifupdown system config plugin.

	* system-settings/plugins/ifupdown/plugin.c
		- (SCPluginIfupdown_init): parse nm-system-settings.conf keyfile and set
			private unmanage_well_known state field accordingly



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4164 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Alexander Sack 2008-10-10 11:14:26 +00:00 committed by Dan Williams
parent ab59790905
commit da167bbcb1
2 changed files with 48 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2008-10-10 Alexander Sack <asac@ubuntu.com>
Parse nm-system-settings.conf and allow admins to either use managed and unmanaged
mode of the ifupdown system config plugin.
* system-settings/plugins/ifupdown/plugin.c
- (SCPluginIfupdown_init): parse nm-system-settings.conf keyfile and set
private unmanage_well_known state field accordingly
2008-10-10 Alexander Sack <asac@ubuntu.com>
Implement unmanaged mode that will prevent all devices in the

View file

@ -52,6 +52,11 @@
#define IFUPDOWN_PLUGIN_INFO "(C) 2008 Canonical Ltd. To report bugs please use the NetworkManager mailing list."
#define IFUPDOWN_SYSTEM_HOSTNAME_FILE "/etc/hostname"
#define IFUPDOWN_SYSTEM_SETTINGS_KEY_FILE SYSCONFDIR "/NetworkManager/nm-system-settings.conf"
#define IFUPDOWN_KEY_FILE_GROUP "ifupdown"
#define IFUPDOWN_KEY_FILE_KEY_MANAGED "managed"
#define IFUPDOWN_UNMANAGE_WELL_KNOWN_DEFAULT TRUE
/* #define ALWAYS_UNMANAGE TRUE */
#ifndef ALWAYS_UNMANAGE
# define ALWAYS_UNMANAGE FALSE
@ -274,6 +279,8 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config,
GHashTable *auto_ifaces = g_hash_table_new (g_str_hash, g_str_equal);
if_block *block = NULL;
NMInotifyHelper *inotify_helper;
GKeyFile* keyfile;
GError *error = NULL;
if(!priv->iface_connections)
priv->iface_connections = g_hash_table_new (g_str_hash, g_str_equal);
@ -347,6 +354,38 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config,
}
}
priv->unmanage_well_known = IFUPDOWN_UNMANAGE_WELL_KNOWN_DEFAULT;
keyfile = g_key_file_new ();
if (!g_key_file_load_from_file (keyfile,
IFUPDOWN_SYSTEM_SETTINGS_KEY_FILE,
G_KEY_FILE_NONE,
&error)) {
nm_info ("loading system config file (%s) caused error: %s (%d)",
IFUPDOWN_SYSTEM_SETTINGS_KEY_FILE,
error->message,
error->code);
} else {
gboolean manage_well_known;
error = NULL;
manage_well_known = g_key_file_get_boolean (keyfile,
IFUPDOWN_KEY_FILE_GROUP,
IFUPDOWN_KEY_FILE_KEY_MANAGED,
&error);
if (error) {
nm_info ("getting keyfile key '%s' in group '%s' failed: %s (%d)",
IFUPDOWN_KEY_FILE_GROUP,
IFUPDOWN_KEY_FILE_KEY_MANAGED,
error->message,
error->code);
} else {
priv->unmanage_well_known = !manage_well_known;
}
}
PLUGIN_PRINT ("SCPluginIfupdown", "management mode: %s", priv->unmanage_well_known ? "unmanaged" : "managed");
if (keyfile)
g_key_file_free (keyfile);
{
/* init well_known_udis */
GSList *wired_devices = nm_system_config_hal_manager_get_devices_of_type (hal_manager, NM_DEVICE_TYPE_ETHERNET);