mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 02:40:17 +01:00
device: only 'ignore-auto-routes' and 'ignore-auto-dns' for certain settings
During merge_and_apply(), we merge several NMIPxConfig into a new @composite. For 'ignore-auto-routes' and 'ignore-auto-dns', we want to prevent certain routes/dns-settings to be merged. But it is wrong to reject settings from all partial configs. For example, especially ext_ipx_config and vpn_ipx_config contain routes that we still must merge and preserve. This was recently changed by79630c11e5and previously byab6548c621. But it was wrong for a long time already. Also note, that nm_ip4_config_merge() now also ignores NIS, WINS, and dns-options. https://bugzilla.gnome.org/show_bug.cgi?id=752546 Fixes:79630c11e5(cherry picked from commit43e6f6a178)
This commit is contained in:
parent
aadf202cf2
commit
1ee28ba989
1 changed files with 49 additions and 40 deletions
|
|
@ -3238,6 +3238,8 @@ ip4_config_merge_and_apply (NMDevice *self,
|
|||
guint32 gateway;
|
||||
gboolean connection_has_default_route, connection_is_never_default;
|
||||
gboolean routes_full_sync;
|
||||
gboolean ignore_auto_routes = FALSE;
|
||||
gboolean ignore_auto_dns = FALSE;
|
||||
|
||||
/* Merge all the configs into the composite config */
|
||||
if (config) {
|
||||
|
|
@ -3245,13 +3247,27 @@ ip4_config_merge_and_apply (NMDevice *self,
|
|||
priv->dev_ip4_config = g_object_ref (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 (s_ip4) {
|
||||
ignore_auto_routes = nm_setting_ip_config_get_ignore_auto_routes (s_ip4);
|
||||
ignore_auto_dns = nm_setting_ip_config_get_ignore_auto_dns (s_ip4);
|
||||
}
|
||||
}
|
||||
|
||||
composite = nm_ip4_config_new ();
|
||||
|
||||
if (commit)
|
||||
ensure_con_ip4_config (self);
|
||||
|
||||
if (priv->dev_ip4_config)
|
||||
nm_ip4_config_merge (composite, priv->dev_ip4_config, NM_IP_CONFIG_MERGE_DEFAULT);
|
||||
if (priv->dev_ip4_config) {
|
||||
nm_ip4_config_merge (composite, priv->dev_ip4_config,
|
||||
(ignore_auto_routes ? NM_IP_CONFIG_MERGE_NO_ROUTES : 0)
|
||||
| (ignore_auto_dns ? NM_IP_CONFIG_MERGE_NO_DNS : 0));
|
||||
}
|
||||
if (priv->vpn4_config)
|
||||
nm_ip4_config_merge (composite, priv->vpn4_config, NM_IP_CONFIG_MERGE_DEFAULT);
|
||||
if (priv->ext_ip4_config)
|
||||
|
|
@ -3260,23 +3276,10 @@ ip4_config_merge_and_apply (NMDevice *self,
|
|||
/* Merge WWAN config *last* to ensure modem-given settings overwrite
|
||||
* any external stuff set by pppd or other scripts.
|
||||
*/
|
||||
if (priv->wwan_ip4_config)
|
||||
nm_ip4_config_merge (composite, priv->wwan_ip4_config, NM_IP_CONFIG_MERGE_DEFAULT);
|
||||
|
||||
/* 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 (s_ip4) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (priv->wwan_ip4_config) {
|
||||
nm_ip4_config_merge (composite, priv->wwan_ip4_config,
|
||||
(ignore_auto_routes ? NM_IP_CONFIG_MERGE_NO_ROUTES : 0)
|
||||
| (ignore_auto_dns ? NM_IP_CONFIG_MERGE_NO_DNS : 0));
|
||||
}
|
||||
|
||||
/* Merge user overrides into the composite config. For assumed connections,
|
||||
|
|
@ -3865,6 +3868,19 @@ ip6_config_merge_and_apply (NMDevice *self,
|
|||
const struct in6_addr *gateway;
|
||||
gboolean connection_has_default_route, connection_is_never_default;
|
||||
gboolean routes_full_sync;
|
||||
gboolean ignore_auto_routes = FALSE;
|
||||
gboolean ignore_auto_dns = FALSE;
|
||||
|
||||
/* 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 (s_ip6) {
|
||||
ignore_auto_routes = nm_setting_ip_config_get_ignore_auto_routes (s_ip6);
|
||||
ignore_auto_dns = nm_setting_ip_config_get_ignore_auto_dns (s_ip6);
|
||||
}
|
||||
}
|
||||
|
||||
/* If no config was passed in, create a new one */
|
||||
composite = nm_ip6_config_new ();
|
||||
|
|
@ -3873,10 +3889,16 @@ ip6_config_merge_and_apply (NMDevice *self,
|
|||
ensure_con_ip6_config (self);
|
||||
|
||||
/* Merge all the IP configs into the composite config */
|
||||
if (priv->ac_ip6_config)
|
||||
nm_ip6_config_merge (composite, priv->ac_ip6_config, NM_IP_CONFIG_MERGE_DEFAULT);
|
||||
if (priv->dhcp6_ip6_config)
|
||||
nm_ip6_config_merge (composite, priv->dhcp6_ip6_config, NM_IP_CONFIG_MERGE_DEFAULT);
|
||||
if (priv->ac_ip6_config) {
|
||||
nm_ip6_config_merge (composite, priv->ac_ip6_config,
|
||||
(ignore_auto_routes ? NM_IP_CONFIG_MERGE_NO_ROUTES : 0)
|
||||
| (ignore_auto_dns ? NM_IP_CONFIG_MERGE_NO_DNS : 0));
|
||||
}
|
||||
if (priv->dhcp6_ip6_config) {
|
||||
nm_ip6_config_merge (composite, priv->dhcp6_ip6_config,
|
||||
(ignore_auto_routes ? NM_IP_CONFIG_MERGE_NO_ROUTES : 0)
|
||||
| (ignore_auto_dns ? NM_IP_CONFIG_MERGE_NO_DNS : 0));
|
||||
}
|
||||
if (priv->vpn6_config)
|
||||
nm_ip6_config_merge (composite, priv->vpn6_config, NM_IP_CONFIG_MERGE_DEFAULT);
|
||||
if (priv->ext_ip6_config)
|
||||
|
|
@ -3885,23 +3907,10 @@ ip6_config_merge_and_apply (NMDevice *self,
|
|||
/* Merge WWAN config *last* to ensure modem-given settings overwrite
|
||||
* any external stuff set by pppd or other scripts.
|
||||
*/
|
||||
if (priv->wwan_ip6_config)
|
||||
nm_ip6_config_merge (composite, priv->wwan_ip6_config, NM_IP_CONFIG_MERGE_DEFAULT);
|
||||
|
||||
/* 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 (s_ip6) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (priv->wwan_ip6_config) {
|
||||
nm_ip6_config_merge (composite, priv->wwan_ip6_config,
|
||||
(ignore_auto_routes ? NM_IP_CONFIG_MERGE_NO_ROUTES : 0)
|
||||
| (ignore_auto_dns ? NM_IP_CONFIG_MERGE_NO_DNS : 0));
|
||||
}
|
||||
|
||||
/* Merge user overrides into the composite config. For assumed connections,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue