mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-01 03:18:06 +02:00
device: don't remove routes when the interface is down
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.
This commit is contained in:
parent
8f07b3ac4f
commit
f069c98cc9
1 changed files with 12 additions and 9 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue