summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2018-09-24 16:35:25 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2018-09-26 11:49:37 +0200
commitf069c98cc95494891215ddf261661afb742744ba (patch)
tree60252f537afccba2d0fe9626f8d1baa5accaaed5
parent8f07b3ac4f6878b3cb1e24c8f272e1bbfa26ba2f (diff)
downloadNetworkManager-bg/preserve-routes-down-rh1626004.tar.gz
device: don't remove routes when the interface is downbg/preserve-routes-down-rh1626004
In update update_ext_ip_config() we remove from various internal configurations those addresses and routes that were removed externally by users. When the interface is brought down, the kernel automatically removes routes associated with it and so we should not consider them as "removed by users". Instead, keep them so that they can be restored when the interface comes up again.
-rw-r--r--src/devices/nm-device.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 0172078759..daa5a0c5f1 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -12636,6 +12636,7 @@ update_ext_ip_config (NMDevice *self, int addr_family, gboolean intersect_config
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
int ifindex;
GSList *iter;
+ gboolean is_up;
nm_assert_addr_family (addr_family);
@@ -12643,6 +12644,8 @@ update_ext_ip_config (NMDevice *self, int addr_family, gboolean intersect_config
if (!ifindex)
return FALSE;
+ is_up = nm_platform_link_is_up (nm_device_get_platform (self), ifindex);
+
if (addr_family == AF_INET) {
g_clear_object (&priv->ext_ip_config_4);
@@ -12657,15 +12660,15 @@ update_ext_ip_config (NMDevice *self, int addr_family, gboolean intersect_config
* by the user. */
if (priv->con_ip_config_4) {
nm_ip4_config_intersect (priv->con_ip_config_4, priv->ext_ip_config_4,
- TRUE,
+ is_up,
default_route_metric_penalty_get (self, AF_INET));
}
- intersect_ext_config (self, &priv->dev_ip4_config, TRUE);
- intersect_ext_config (self, &priv->wwan_ip_config_4, TRUE);
+ intersect_ext_config (self, &priv->dev_ip4_config, is_up);
+ intersect_ext_config (self, &priv->wwan_ip_config_4, is_up);
for (iter = priv->vpn_configs_4; iter; iter = iter->next)
- nm_ip4_config_intersect (iter->data, priv->ext_ip_config_4, TRUE, 0);
+ nm_ip4_config_intersect (iter->data, priv->ext_ip_config_4, is_up, 0);
}
/* Remove parts from ext_ip_config_4 to only contain the information that
@@ -12709,16 +12712,16 @@ update_ext_ip_config (NMDevice *self, int addr_family, gboolean intersect_config
* by the user. */
if (priv->con_ip_config_6) {
nm_ip6_config_intersect (priv->con_ip_config_6, priv->ext_ip_config_6,
- TRUE,
+ is_up,
default_route_metric_penalty_get (self, AF_INET6));
}
- intersect_ext_config (self, &priv->ac_ip6_config, TRUE);
- intersect_ext_config (self, &priv->dhcp6.ip6_config, TRUE);
- intersect_ext_config (self, &priv->wwan_ip_config_6, TRUE);
+ intersect_ext_config (self, &priv->ac_ip6_config, is_up);
+ intersect_ext_config (self, &priv->dhcp6.ip6_config, is_up);
+ intersect_ext_config (self, &priv->wwan_ip_config_6, is_up);
for (iter = priv->vpn_configs_6; iter; iter = iter->next)
- nm_ip6_config_intersect (iter->data, priv->ext_ip_config_6, TRUE, 0);
+ nm_ip6_config_intersect (iter->data, priv->ext_ip_config_6, is_up, 0);
if ( priv->ipv6ll_has
&& !nm_ip6_config_lookup_address (priv->ext_ip_config_6, &priv->ipv6ll_addr))