2008-09-30 Tambet Ingo <tambet@gmail.com>

* src/nm-device.c (nm_device_get_priority): Implement.
	(nm_device_set_ip4_config): Send the device priority to system ip4
	config setter.

	* src/NetworkManagerSystem.c (nm_system_device_set_from_ip4_config):
	Add priority argument and if it's >= 0, set the priority of the network
	route added automatically by netlink (or kernel?).
	(nm_system_device_set_priority): Implement.

	* src/NetworkManagerPolicy.c (get_best_device): Use
	nm_device_get_priority() instead of home-grown version. Revert the
	meaning, best priority is the lowest one.

git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4125 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Tambet Ingo
2008-09-30 15:04:10 +00:00
parent 11f71598b7
commit 50f3ec27a2
6 changed files with 123 additions and 41 deletions

View File

@@ -303,6 +303,15 @@ nm_device_set_device_type (NMDevice *dev, NMDeviceType type)
}
int
nm_device_get_priority (NMDevice *dev)
{
g_return_val_if_fail (NM_IS_DEVICE (dev), -1);
return (int) nm_device_get_device_type (dev);
}
/*
* Accessor for capabilities
*/
@@ -1910,7 +1919,7 @@ nm_device_set_ip4_config (NMDevice *self, NMIP4Config *config, NMDeviceStateReas
if (!nm_ip4_config_is_exported (config))
nm_ip4_config_export (config);
success = nm_system_device_set_from_ip4_config (ip_iface, config);
success = nm_system_device_set_from_ip4_config (ip_iface, config, nm_device_get_priority (self));
if (success)
nm_device_update_ip4_address (self);