summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-03-31 23:40:31 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2017-04-01 15:50:53 +0200
commit633881673e1bca646334e8655f132ac761862ac6 (patch)
treece4ee39b360e46e9f641e413e9d8f5c1912c1597 /src
parent383a50d78fa22328f3b2afd3415093b5acd5a463 (diff)
downloadNetworkManager-633881673e1bca646334e8655f132ac761862ac6.tar.gz
device: emit IP_CONFIG_CHANGED signal when default route changes
We now update the default route metric based on the result of the connectivity check. When we update the metric and there is no other changes to the IP configuration, NMPolicy is not notified about it and can't update the best device until an actual change in IP config happens. This results in a wrong best device set in NMPolicy. NMDevice has NM_DEVICE_IP[4,6]_CONFIG_CHANGED signals that are used exclusively by NMPolicy to detect when there is a change in configuration that requires an update of global DNS and routing information. Emit those signals also when the default route changes. (cherry picked from commit 3fe144f9341b714faa8846dd31ed70d63745efc9)
Diffstat (limited to 'src')
-rw-r--r--src/devices/nm-device.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 70ec90235a..cf3d7525ac 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -9608,6 +9608,7 @@ nm_device_set_ip4_config (NMDevice *self,
NMIP4Config *old_config = NULL;
gboolean has_changes = FALSE;
gboolean success = TRUE;
+ gboolean def_route_changed;
int ip_ifindex, config_ifindex;
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
@@ -9667,7 +9668,7 @@ nm_device_set_ip4_config (NMDevice *self,
g_clear_object (&priv->dev_ip4_config);
}
- nm_default_route_manager_ip4_update_default_route (nm_default_route_manager_get (), self);
+ def_route_changed = nm_default_route_manager_ip4_update_default_route (nm_default_route_manager_get (), self);
concheck_periodic_update (self);
if (!nm_device_sys_iface_state_is_external_or_assume (self))
@@ -9701,6 +9702,9 @@ nm_device_set_ip4_config (NMDevice *self,
}
nm_device_queue_recheck_assume (self);
+ } else if (def_route_changed) {
+ _LOGD (LOGD_IP4, "ip4-config: default route changed");
+ g_signal_emit (self, signals[IP4_CONFIG_CHANGED], 0, priv->ip4_config, priv->ip4_config);
}
return success;
@@ -9779,6 +9783,7 @@ nm_device_set_ip6_config (NMDevice *self,
NMIP6Config *old_config = NULL;
gboolean has_changes = FALSE;
gboolean success = TRUE;
+ gboolean def_route_changed;
int ip_ifindex, config_ifindex;
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
@@ -9831,7 +9836,7 @@ nm_device_set_ip6_config (NMDevice *self,
nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config)));
}
- nm_default_route_manager_ip6_update_default_route (nm_default_route_manager_get (), self);
+ def_route_changed = nm_default_route_manager_ip6_update_default_route (nm_default_route_manager_get (), self);
if (has_changes) {
NMSettingsConnection *settings_connection;
@@ -9862,6 +9867,9 @@ nm_device_set_ip6_config (NMDevice *self,
if (priv->ndisc)
ndisc_set_router_config (priv->ndisc, self);
+ } else if (def_route_changed) {
+ _LOGD (LOGD_IP6, "ip6-config: default route changed");
+ g_signal_emit (self, signals[IP6_CONFIG_CHANGED], 0, priv->ip6_config, priv->ip6_config);
}
return success;