From a10ac7fa5a557ea436c4dc11fde196684fb696b5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 26 Jul 2022 17:16:00 +0200 Subject: [PATCH] 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. --- src/core/devices/nm-device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index e133fca6a0..ad70740996 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -4934,6 +4934,10 @@ nm_device_get_route_metric_default(NMDeviceType device_type) */ switch (device_type) { + + case NM_DEVICE_TYPE_LOOPBACK: + return 30; + /* 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 @@ -4990,8 +4994,6 @@ nm_device_get_route_metric_default(NMDeviceType device_type) return 800; case NM_DEVICE_TYPE_WPAN: return 850; - case NM_DEVICE_TYPE_LOOPBACK: - return 875; case NM_DEVICE_TYPE_WIFI_P2P: case NM_DEVICE_TYPE_GENERIC: return 950;