diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2017-03-31 23:40:31 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2017-03-31 23:40:31 +0200 |
commit | af73541136f2325e622c50be90322c3dbcbb5d1e (patch) | |
tree | b1bd7077c5f35ed5d4070a0617d5a43fe871eac0 | |
parent | 50285c19bcaa34916a5a7c5ea21b26c97f1fdf53 (diff) | |
download | NetworkManager-af73541136f2325e622c50be90322c3dbcbb5d1e.tar.gz |
device: emit IP_CONFIG_CHANGED signal when default route changesbg/defroute
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.
-rw-r--r-- | src/devices/nm-device.c | 12 |
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; |