mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-09 06:10:29 +01:00
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>
This commit is contained in:
parent
52ddd72bde
commit
a2662633a5
2 changed files with 27 additions and 23 deletions
|
|
@ -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;
|
||||
case NM_DEVICE_TYPE_INFINIBAND:
|
||||
return 2;
|
||||
case NM_DEVICE_TYPE_ADSL:
|
||||
return 3;
|
||||
case NM_DEVICE_TYPE_WIMAX:
|
||||
return 4;
|
||||
case NM_DEVICE_TYPE_BOND:
|
||||
return 5;
|
||||
case NM_DEVICE_TYPE_TEAM:
|
||||
return 6;
|
||||
case NM_DEVICE_TYPE_VLAN:
|
||||
return 7;
|
||||
case NM_DEVICE_TYPE_MODEM:
|
||||
return 8;
|
||||
case NM_DEVICE_TYPE_BT:
|
||||
return 9;
|
||||
case NM_DEVICE_TYPE_WIFI:
|
||||
return 10;
|
||||
case NM_DEVICE_TYPE_OLPC_MESH:
|
||||
return 11;
|
||||
default:
|
||||
return 20;
|
||||
case NM_DEVICE_TYPE_INFINIBAND:
|
||||
return 30;
|
||||
case NM_DEVICE_TYPE_ADSL:
|
||||
return 40;
|
||||
case NM_DEVICE_TYPE_WIMAX:
|
||||
return 50;
|
||||
case NM_DEVICE_TYPE_BOND:
|
||||
return 60;
|
||||
case NM_DEVICE_TYPE_TEAM:
|
||||
return 70;
|
||||
case NM_DEVICE_TYPE_VLAN:
|
||||
return 80;
|
||||
case NM_DEVICE_TYPE_MODEM:
|
||||
return 90;
|
||||
case NM_DEVICE_TYPE_BT:
|
||||
return 100;
|
||||
case NM_DEVICE_TYPE_WIFI:
|
||||
return 110;
|
||||
case NM_DEVICE_TYPE_OLPC_MESH:
|
||||
return 120;
|
||||
default:
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue