mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-01 15:20:11 +01:00
device: fix handling of ignore-auto-dns and ignore-auto-routes
Since commitab6548c621("device: better accept external IP changes"), ipX_config_merge_and_apply() applies the configuration static settings to an intermediate, initially empty configuration (priv->con_ipX_config) instead of the composite configuration, and thus the handling of ignore-auto-routes and ignore-auto-dns options done in nm_ipX_config_merge_setting() has no effect. Fix this by clearing the routes and the DNS information when needed before merging static settings to the composite configuration. Fixes:ab6548c621(cherry picked from commit79630c11e5)
This commit is contained in:
parent
bfab4d79e6
commit
2a5eea7e76
1 changed files with 26 additions and 3 deletions
|
|
@ -3216,12 +3216,24 @@ ip4_config_merge_and_apply (NMDevice *self,
|
|||
if (priv->wwan_ip4_config)
|
||||
nm_ip4_config_merge (composite, priv->wwan_ip4_config);
|
||||
|
||||
/* Apply ignore-auto-routes and ignore-auto-dns settings */
|
||||
connection = nm_device_get_connection (self);
|
||||
if (connection) {
|
||||
NMSettingIPConfig *s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
|
||||
if (nm_setting_ip_config_get_ignore_auto_routes (s_ip4))
|
||||
nm_ip4_config_reset_routes (composite);
|
||||
if (nm_setting_ip_config_get_ignore_auto_dns (s_ip4))
|
||||
nm_ip4_config_reset_nameservers (composite);
|
||||
nm_ip4_config_reset_domains (composite);
|
||||
nm_ip4_config_reset_searches (composite);
|
||||
}
|
||||
|
||||
/* Merge user overrides into the composite config. For assumed connections,
|
||||
* con_ip4_config is empty. */
|
||||
if (priv->con_ip4_config)
|
||||
nm_ip4_config_merge (composite, priv->con_ip4_config);
|
||||
|
||||
connection = nm_device_get_connection (self);
|
||||
|
||||
/* Add the default route.
|
||||
*
|
||||
|
|
@ -3812,13 +3824,24 @@ ip6_config_merge_and_apply (NMDevice *self,
|
|||
if (priv->wwan_ip6_config)
|
||||
nm_ip6_config_merge (composite, priv->wwan_ip6_config);
|
||||
|
||||
/* Apply ignore-auto-routes and ignore-auto-dns settings */
|
||||
connection = nm_device_get_connection (self);
|
||||
if (connection) {
|
||||
NMSettingIPConfig *s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
|
||||
if (nm_setting_ip_config_get_ignore_auto_routes (s_ip6))
|
||||
nm_ip6_config_reset_routes (composite);
|
||||
if (nm_setting_ip_config_get_ignore_auto_dns (s_ip6))
|
||||
nm_ip6_config_reset_nameservers (composite);
|
||||
nm_ip6_config_reset_domains (composite);
|
||||
nm_ip6_config_reset_searches (composite);
|
||||
}
|
||||
|
||||
/* Merge user overrides into the composite config. For assumed connections,
|
||||
* con_ip6_config is empty. */
|
||||
if (priv->con_ip6_config)
|
||||
nm_ip6_config_merge (composite, priv->con_ip6_config);
|
||||
|
||||
connection = nm_device_get_connection (self);
|
||||
|
||||
/* Add the default route.
|
||||
*
|
||||
* We keep track of the default route of a device in a private field.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue