mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 11:30:15 +01:00
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.
This commit is contained in:
parent
3dd60d0ef0
commit
b31226532d
2 changed files with 4 additions and 15 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue