summaryrefslogtreecommitdiff
path: root/src/devices
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-09-28 15:06:28 +0200
committerThomas Haller <thaller@redhat.com>2017-10-06 11:13:43 +0200
commitb31226532d9e5b5ac5960ce2f0b65a60e92d428f (patch)
treef0ba6077c1f04cee497290adc5cb0fc9218a50be /src/devices
parent3dd60d0ef0049205bbbbf0a1ed4f5565289477eb (diff)
downloadNetworkManager-b31226532d9e5b5ac5960ce2f0b65a60e92d428f.tar.gz
device: refactor function nm_device_get_priority() / _get_route_metric_default()
The name nm_device_get_priority() is misleading. Nowadays it's only used for the default route metric, and nothing else. Rename it, and make it static.
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/nm-device.c17
-rw-r--r--src/devices/nm-device.h2
2 files changed, 4 insertions, 15 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index eefe62ea20..51d1f72a3f 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1586,23 +1586,14 @@ nm_device_get_metered (NMDevice *self)
return NM_DEVICE_GET_PRIVATE (self)->metered;
}
-/**
- * nm_device_get_priority():
- * @self: the #NMDevice
- *
- * Returns: the device's routing priority. Lower numbers means a "better"
- * device, eg higher priority.
- */
-int
-nm_device_get_priority (NMDevice *self)
+static guint32
+_get_route_metric_default (NMDevice *self)
{
- g_return_val_if_fail (NM_IS_DEVICE (self), 1000);
-
/* Device 'priority' is used for the default route-metric and is based on
* the device type. The settings ipv4.route-metric and ipv6.route-metric
* can overwrite this default.
*
- * Currently for both IPv4 and IPv6 we use the same default values.
+ * For both IPv4 and IPv6 we use the same default values.
*
* The route-metric is used for the metric of the routes of device.
* This also applies to the default route. Therefore it affects also
@@ -1729,7 +1720,7 @@ nm_device_get_route_metric (NMDevice *self,
if (route_metric >= 0)
goto out;
}
- route_metric = nm_device_get_priority (self);
+ route_metric = _get_route_metric_default (self);
out:
return nm_utils_ip_route_metric_normalize (addr_family, route_metric);
}
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h
index e1c47d3ff5..b02b8d923b 100644
--- a/src/devices/nm-device.h
+++ b/src/devices/nm-device.h
@@ -447,8 +447,6 @@ NMDeviceType nm_device_get_device_type (NMDevice *dev);
NMLinkType nm_device_get_link_type (NMDevice *dev);
NMMetered nm_device_get_metered (NMDevice *dev);
-int nm_device_get_priority (NMDevice *dev);
-
guint32 nm_device_get_route_metric (NMDevice *dev, int addr_family);
const char * nm_device_get_hw_address (NMDevice *dev);