fix: choose very low route metric for loopback devices

It's local. It seems if the user adds a route to that destination,
they would want it preferred over most other routes. Choose a small
metric.
This commit is contained in:
Thomas Haller 2022-07-26 17:16:00 +02:00
parent e48eef030f
commit a10ac7fa5a
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -4934,6 +4934,10 @@ nm_device_get_route_metric_default(NMDeviceType device_type)
*/ */
switch (device_type) { switch (device_type) {
case NM_DEVICE_TYPE_LOOPBACK:
return 30;
/* 50 is also used for VPN plugins (NM_VPN_ROUTE_METRIC_DEFAULT). /* 50 is also used for VPN plugins (NM_VPN_ROUTE_METRIC_DEFAULT).
* *
* Note that returning 50 from this function means that this device-type is * Note that returning 50 from this function means that this device-type is
@ -4990,8 +4994,6 @@ nm_device_get_route_metric_default(NMDeviceType device_type)
return 800; return 800;
case NM_DEVICE_TYPE_WPAN: case NM_DEVICE_TYPE_WPAN:
return 850; return 850;
case NM_DEVICE_TYPE_LOOPBACK:
return 875;
case NM_DEVICE_TYPE_WIFI_P2P: case NM_DEVICE_TYPE_WIFI_P2P:
case NM_DEVICE_TYPE_GENERIC: case NM_DEVICE_TYPE_GENERIC:
return 950; return 950;