mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-05 04:10:36 +01: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. (cherry picked from commitf069c98cc9) (cherry picked from commitce2d403530)
This commit is contained in:
parent
da46fcaffd
commit
4fc6f5f317
1 changed files with 12 additions and 9 deletions
|
|
@ -12159,6 +12159,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);
|
||||
|
||||
|
|
@ -12166,6 +12167,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);
|
||||
|
|
@ -12180,15 +12183,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
|
||||
|
|
@ -12232,16 +12235,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