devices: don't try to capture resolv.conf if not managing it (rh #1035861)

If NM is not explicitly managing resolv.conf (either due to the "dns"
NetworkManager.conf setting, or because resolv.conf is immutable),
then don't try to parse nameservers out of it when capturing a
connection, since there's no reason to believe that the name servers
there are related to any particular connection.
This commit is contained in:
Dan Winship 2013-12-17 16:57:47 -05:00
parent 20b43802e8
commit f2413ae498

View file

@ -68,6 +68,7 @@
#include "nm-config-device.h"
#include "nm-config.h"
#include "nm-platform.h"
#include "nm-dns-manager.h"
#include "nm-device-bridge.h"
#include "nm-device-bond.h"
@ -6584,14 +6585,19 @@ update_ip_config (NMDevice *self, gboolean initial)
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
int ifindex;
gboolean linklocal6_just_completed = FALSE;
gboolean capture_resolv_conf;
NMDnsManagerResolvConfMode resolv_conf_mode;
ifindex = nm_device_get_ip_ifindex (self);
if (!ifindex)
return;
resolv_conf_mode = nm_dns_manager_get_resolv_conf_mode (nm_dns_manager_get ());
capture_resolv_conf = initial && (resolv_conf_mode == NM_DNS_MANAGER_RESOLV_CONF_EXPLICIT);
/* IPv4 */
g_clear_object (&priv->ext_ip4_config);
priv->ext_ip4_config = nm_ip4_config_capture (ifindex, initial);
priv->ext_ip4_config = nm_ip4_config_capture (ifindex, capture_resolv_conf);
if (priv->ext_ip4_config) {
if (initial) {
@ -6608,7 +6614,7 @@ update_ip_config (NMDevice *self, gboolean initial)
/* IPv6 */
g_clear_object (&priv->ext_ip6_config);
priv->ext_ip6_config = nm_ip6_config_capture (ifindex, initial);
priv->ext_ip6_config = nm_ip6_config_capture (ifindex, capture_resolv_conf);
if (priv->ext_ip6_config) {
/* Check this before modifying ext_ip6_config */