mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 13:40:11 +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
This commit is contained in:
parent
19133b08da
commit
641e8b00fe
1 changed files with 18 additions and 8 deletions
|
|
@ -1470,10 +1470,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);
|
||||
}
|
||||
|
||||
|
|
@ -1607,10 +1612,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