diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2022-01-19 12:03:04 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2022-01-26 14:54:51 +0100 |
commit | 86cd4580f157e280d912538efe078ea8f2481b41 (patch) | |
tree | 63f3a4af4668e63e56e49501075bd967cf2358a8 | |
parent | e1648d0665a0a2f619f0d63053b8a7e5b4fa0df8 (diff) |
core: defer DNS updates until the device enters the SECONDARIES state
I see a significant performance increase with many parallel
activations if DNS updates are deferred to the SECONDARIES state.
Since there is no guarantee that device_l3cd_changed() is called again
when the device becomes ACTIVATED, we need also to change
device_state_changed().
-rw-r--r-- | src/core/nm-policy.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c index c4ae8e2abb..dcb951af4d 100644 --- a/src/core/nm-policy.c +++ b/src/core/nm-policy.c @@ -1995,6 +1995,26 @@ device_state_changed(NMDevice *device, /* Reset auto retries back to default since connection was successful */ nm_settings_connection_autoconnect_retries_reset(sett_conn); } + + /* Since there is no guarantee that device_l3cd_changed() is called + * again when the device becomes ACTIVATED, we need also to update + * routing and DNS here. */ + nm_dns_manager_begin_updates(priv->dns_manager, __func__); + if (!nm_device_sys_iface_state_is_external(device)) { + nm_dns_manager_set_ip_config(priv->dns_manager, + AF_UNSPEC, + device, + nm_device_get_l3cd(device, TRUE), + NM_DNS_IP_CONFIG_TYPE_DEFAULT, + TRUE); + } + update_ip_dns(self, AF_INET, device); + update_ip_dns(self, AF_INET6, device); + update_ip4_routing(self, TRUE); + update_ip6_routing(self, TRUE); + update_system_hostname(self, "routing and dns"); + nm_dns_manager_end_updates(priv->dns_manager, __func__); + break; case NM_DEVICE_STATE_UNMANAGED: case NM_DEVICE_STATE_UNAVAILABLE: @@ -2122,7 +2142,7 @@ device_l3cd_changed(NMDevice *device, * now. */ state = nm_device_get_state(device); - if (l3cd_new && state > NM_DEVICE_STATE_DISCONNECTED && state < NM_DEVICE_STATE_DEACTIVATING) { + if (l3cd_new && state > NM_DEVICE_STATE_IP_CONFIG && state < NM_DEVICE_STATE_DEACTIVATING) { nm_dns_manager_set_ip_config(priv->dns_manager, AF_UNSPEC, device, |