diff options
author | Thomas Haller <thaller@redhat.com> | 2018-06-14 11:43:33 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-06-14 12:30:28 +0200 |
commit | 2f0d26e02cfc20c1a6423c3c611062c3d9418621 (patch) | |
tree | 34ec2df22b0caef919f3b887a95d3b4ffcee7462 | |
parent | e4426e302a6890cc2588d59eeea542cf0ad971d5 (diff) | |
download | NetworkManager-th/device-reapply-metric.tar.gz |
device: avoid accidentally changing route-metric during config-reloadth/device-reapply-metric
It's not properly implemented, to change the route-metric while
being active. That would require pecular re-initializations.
Avoid that a configuration reload, can change the used route-metric
unexpectedly.
It doesn't cover all potential changes, because
nm_manager_device_route_metric_reserve() might still return a different
value. That is however rather unlikely, because neither the ifindex nor
the device-type is expected to change.
-rw-r--r-- | src/devices/nm-device.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 08ed04fef4..a773b012fb 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1956,6 +1956,7 @@ guint32 nm_device_get_route_metric (NMDevice *self, int addr_family) { + NMDevicePrivate *priv; char *value; gint64 route_metric; NMSettingIPConfig *s_ip; @@ -1981,10 +1982,12 @@ nm_device_get_route_metric (NMDevice *self, } } + priv = NM_DEVICE_GET_PRIVATE (self); + /* use the current NMConfigData, which makes this configuration reloadable. * Note that that means that the route-metric might change between SIGHUP. * You must cache the returned value if that is a problem. */ - value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA, + value = nm_config_data_get_connection_default (priv->cur_config_data, addr_family == AF_INET ? "ipv4.route-metric" : "ipv6.route-metric", self); if (value) { route_metric = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, -1); |