diff options
author | Thomas Haller <thaller@redhat.com> | 2014-08-28 18:16:35 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-11-05 23:49:55 +0100 |
commit | 682ff5535e517a38ffdd36865d0ebbafc6bcb3bf (patch) | |
tree | 4df3152428d5755031a56e98c367b124c75a0934 | |
parent | 03b4d7deef010037d13066843ca921e9867656d8 (diff) | |
download | NetworkManager-682ff5535e517a38ffdd36865d0ebbafc6bcb3bf.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 | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index af5e52750c..7e04c4c104 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: * @@ -654,29 +654,29 @@ nm_device_get_priority (NMDevice *self) switch (nm_device_get_device_type (self)) { case NM_DEVICE_TYPE_ETHERNET: - return 1; + return 10; case NM_DEVICE_TYPE_INFINIBAND: - return 2; + return 20; case NM_DEVICE_TYPE_ADSL: - return 3; + return 30; case NM_DEVICE_TYPE_WIMAX: - return 4; + return 40; case NM_DEVICE_TYPE_BOND: - return 5; + return 50; case NM_DEVICE_TYPE_TEAM: - return 6; + return 60; case NM_DEVICE_TYPE_VLAN: - return 7; + return 70; case NM_DEVICE_TYPE_MODEM: - return 8; + return 80; case NM_DEVICE_TYPE_BT: - return 9; + return 90; case NM_DEVICE_TYPE_WIFI: - return 10; + return 100; case NM_DEVICE_TYPE_OLPC_MESH: - return 11; + return 110; default: - return 20; + return 200; } } |