diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2015-06-25 11:24:32 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2015-06-25 16:56:01 +0200 |
commit | 2a5eea7e7696c00befe81b934734f34ee150768f (patch) | |
tree | e741f4609ad806b2e807230af480f40de8c38733 | |
parent | bfab4d79e679194cfba96c17022282bd1748c2f9 (diff) |
device: fix handling of ignore-auto-dns and ignore-auto-routes
Since commit ab6548c62134 ("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: ab6548c62134518ba2871306397e7fb9c84260ca
(cherry picked from commit 79630c11e502c3b0b958abc0b1b5d777a3db2a98)
-rw-r--r-- | src/devices/nm-device.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 631ddb992d..d49b92b8a2 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -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. |