2007-12-31 Dan Williams <dcbw@redhat.com>

* src/nm-device-interface.c
	  src/nm-device-interface.h
		- (nm_device_interface_check_connection_conflicts): new function

	* src/nm-device.c
	  src/nm-device.h
		- (nm_device_check_connection_conflicts): new function
		- (device_activation_precheck): don't require subclasses to implement
			check_connection_complete()
		- check_connection() -> check_connection_complete()

	* src/nm-device-802-11-wireless.c
		- (real_check_connection): remove; unused
		- (real_check_connection_conflicts): implement, handle lockdown for
			system connections

	* src/nm-device-802-3-ethernet.c
		- (real_check_connection): remove; unused

	* src/nm-manager.c
		- (check_connection_allowed): new function
		- (nm_manager_activate_device): ensure the connection being requested
			is allowed to be activated

	* src/nm-serial-device.c
	  src/nm-gsm-device.c
		- real_check_connection() -> real_check_connection_complete()



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3201 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2007-12-31 17:05:25 +00:00
parent 60cebd2de6
commit ec22c11c4f
10 changed files with 169 additions and 19 deletions

View File

@@ -39,6 +39,7 @@
#include "autoip.h"
#include "nm-netlink.h"
#include "nm-setting-ip4-config.h"
#include "nm-setting-connection.h"
#define NM_ACT_REQUEST_IP4_CONFIG "nm-act-request-ip4-config"
@@ -82,6 +83,10 @@ struct _NMDevicePrivate
gulong dhcp_timeout_sigid;
};
static gboolean nm_device_check_connection_conflicts (NMDeviceInterface *device,
NMConnection *connection,
NMConnection *system_connection);
static gboolean nm_device_activate (NMDeviceInterface *device,
NMActRequest *req,
GError **error);
@@ -100,6 +105,7 @@ static void
device_interface_init (NMDeviceInterface *device_interface_class)
{
/* interface implementation */
device_interface_class->check_connection_conflicts = nm_device_check_connection_conflicts;
device_interface_class->activate = nm_device_activate;
device_interface_class->deactivate = nm_device_deactivate;
}
@@ -1105,6 +1111,19 @@ nm_device_deactivate (NMDeviceInterface *device)
nm_device_state_changed (self, NM_DEVICE_STATE_DISCONNECTED);
}
static gboolean
nm_device_check_connection_conflicts (NMDeviceInterface *device,
NMConnection *connection,
NMConnection *system_connection)
{
NMDeviceClass *klass = NM_DEVICE_CLASS (NM_DEVICE (device));
if (klass->check_connection_conflicts)
return klass->check_connection_conflicts (NM_DEVICE (device), connection, system_connection);
return FALSE;
}
static void
connection_secrets_updated_cb (NMActRequest *req,
NMConnection *connection,
@@ -1136,7 +1155,8 @@ device_activation_precheck (NMDevice *self, NMConnection *connection, GError **e
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
if (!NM_DEVICE_GET_CLASS (self)->check_connection (self, connection, error)) {
if ( NM_DEVICE_GET_CLASS (self)->check_connection_complete
&& !NM_DEVICE_GET_CLASS (self)->check_connection_complete (self, connection, error)) {
/* connection is invalid */
g_assert (*error);
return FALSE;