mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 02:50:10 +01:00
vpn: reuse existing ip_config objects when config gets updated
Previously we created a new NMIP[46]Config object to replace the
previous one every time the plugin reported a new IP configuration
through the Ip[46]Config signal, but the old configuration was not
removed from the DNS manager and would become stale.
The interaction with DNS manager is handled by NMPolicy, which only
reacts to changes in connection status, so it's not easy to have the
configuration removed from DNS while keeping the connection state
ACTIVATED.
A cleaner solutions is to avoid creating a new IP configuration object
and reuse the existing one if possible. The side effect is that the
D-Bus path of the object will not change, which seems also positive.
https://bugzilla.redhat.com/show_bug.cgi?id=1348901
(cherry picked from commit 641e8b00fe)
This commit is contained in:
parent
bea089c35d
commit
7a343cc981
1 changed files with 18 additions and 8 deletions
|
|
@ -1468,10 +1468,15 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
|
|||
nm_connection_get_setting_ip4_config (_get_applied_connection (self)),
|
||||
route_metric);
|
||||
|
||||
nm_exported_object_clear_and_unexport (&priv->ip4_config);
|
||||
priv->ip4_config = config;
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (config));
|
||||
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG);
|
||||
if (priv->ip4_config) {
|
||||
nm_ip4_config_replace (priv->ip4_config, config, NULL);
|
||||
g_object_unref (config);
|
||||
} else {
|
||||
priv->ip4_config = config;
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (config));
|
||||
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG);
|
||||
}
|
||||
|
||||
nm_vpn_connection_config_maybe_complete (self, TRUE);
|
||||
}
|
||||
|
||||
|
|
@ -1605,10 +1610,15 @@ next:
|
|||
nm_connection_get_setting_ip6_config (_get_applied_connection (self)),
|
||||
route_metric);
|
||||
|
||||
nm_exported_object_clear_and_unexport (&priv->ip6_config);
|
||||
priv->ip6_config = config;
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (config));
|
||||
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG);
|
||||
if (priv->ip6_config) {
|
||||
nm_ip6_config_replace (priv->ip6_config, config, NULL);
|
||||
g_object_unref (config);
|
||||
} else {
|
||||
priv->ip6_config = config;
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (config));
|
||||
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG);
|
||||
}
|
||||
|
||||
nm_vpn_connection_config_maybe_complete (self, TRUE);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue