diff options
author | Thomas Haller <thaller@redhat.com> | 2014-08-28 18:16:35 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-11-07 15:19:06 +0100 |
commit | a2662633a5ea21387cb9645440dc48b96b6100df (patch) | |
tree | 93ac92eab2a959951f7b9668f6ebe718b42d6098 | |
parent | 52ddd72bde2324d2ecd78d03b50391e491ffcbec (diff) | |
download | NetworkManager-a2662633a5ea21387cb9645440dc48b96b6100df.tar.gz |
core: modify the values/route metric returned by nm_device_get_priority()
nm_device_get_priority() is used to select the "best" device
for the default route. The absolute values don't matter
at that point and the relative ordering is not changed by
this patch.
It is also directly used for route priority/metric. As we soon
allow the user to overwrite the setting, we want to get more
space between the individual device-types.
That way, a user could overwrite the default metric for a wifi
device to be 109 (making it lower then the default value 110), but
still less preferred then other non-wifi types.
Obviously, this patch is a visible change of behavior as now
routes get different metrics assigned.
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/devices/nm-device.c | 27 | ||||
-rw-r--r-- | src/vpn-manager/nm-vpn-connection.h | 3 |
2 files changed, 17 insertions, 13 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index efb7f25d2d..efb4a69257 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -640,7 +640,7 @@ nm_device_get_device_type (NMDevice *self) int nm_device_get_priority (NMDevice *self) { - g_return_val_if_fail (NM_IS_DEVICE (self), 100); + g_return_val_if_fail (NM_IS_DEVICE (self), 1000); /* Device 'priority' is used for two things: * @@ -653,30 +653,31 @@ nm_device_get_priority (NMDevice *self) */ switch (nm_device_get_device_type (self)) { + /* 10 is reserved for VPN (NM_VPN_ROUTE_METRIC_DEFAULT) */ case NM_DEVICE_TYPE_ETHERNET: - return 1; + return 20; case NM_DEVICE_TYPE_INFINIBAND: - return 2; + return 30; case NM_DEVICE_TYPE_ADSL: - return 3; + return 40; case NM_DEVICE_TYPE_WIMAX: - return 4; + return 50; case NM_DEVICE_TYPE_BOND: - return 5; + return 60; case NM_DEVICE_TYPE_TEAM: - return 6; + return 70; case NM_DEVICE_TYPE_VLAN: - return 7; + return 80; case NM_DEVICE_TYPE_MODEM: - return 8; + return 90; case NM_DEVICE_TYPE_BT: - return 9; + return 100; case NM_DEVICE_TYPE_WIFI: - return 10; + return 110; case NM_DEVICE_TYPE_OLPC_MESH: - return 11; + return 120; default: - return 20; + return 200; } } diff --git a/src/vpn-manager/nm-vpn-connection.h b/src/vpn-manager/nm-vpn-connection.h index 31a2734e39..047113c318 100644 --- a/src/vpn-manager/nm-vpn-connection.h +++ b/src/vpn-manager/nm-vpn-connection.h @@ -46,6 +46,9 @@ #define NM_VPN_CONNECTION_INTERNAL_RETRY_AFTER_FAILURE "internal-retry-after-failure" +#define NM_VPN_ROUTE_METRIC_DEFAULT 10 + + struct _NMVpnConnection { NMActiveConnection parent; }; |