summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-05-17 10:52:01 +0200
committerLubomir Rintel <lkundrak@v3.sk>2015-12-08 17:38:53 +0100
commit26072e52540cc01d60a203c02b775f0207f8b18b (patch)
treebbacbff678b8d965175d2dbcfcb36b005f37141a
parent1fa806f0dd11125a9f13795cfc6b8c7711015a4c (diff)
downloadNetworkManager-lr/reapply-1.tar.gz
device: add possibility to reapply the ipv6 settingslr/reapply-1
-rw-r--r--src/devices/nm-device.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 8e1439a969..7d0f9b17c9 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6869,6 +6869,52 @@ nm_device_reapply_ip4_config (NMDevice *self,
return TRUE;
}
+static gboolean
+nm_device_reapply_ip6_config (NMDevice *self,
+ NMConnection *old,
+ gboolean reconfigure,
+ GError **error)
+{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ NMSettingsConnection *connection = nm_device_get_settings_connection (self);
+ NMSettingIPConfig *s_ip6 = nm_connection_get_setting_ip6_config (NM_CONNECTION (connection));
+ NMSettingIPConfig *s_ip6_applied = nm_connection_get_setting_ip6_config (old);
+ const char *method = nm_setting_ip_config_get_method (s_ip6);
+ const char *method_applied = nm_setting_ip_config_get_method (s_ip6_applied);
+
+ if (priv->ip6_state == IP_NONE) {
+ g_set_error_literal (error,
+ NM_DEVICE_ERROR,
+ NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
+ "No IPv6 configuration to update");
+ return FALSE;
+ }
+
+ if (!reconfigure)
+ return TRUE;
+
+ g_clear_object (&priv->con_ip6_config);
+ priv->con_ip6_config = nm_ip6_config_new (nm_device_get_ip_ifindex (self));
+ nm_ip6_config_merge_setting (priv->con_ip6_config,
+ nm_connection_get_setting_ip6_config (NM_CONNECTION (connection)),
+ nm_device_get_ip6_route_metric (self));
+
+ if (strcmp (method, method_applied)) {
+ _cleanup_ip6_pre (self, CLEANUP_TYPE_DECONFIGURE);
+ priv->ip6_state = IP_WAIT;
+ if (!nm_device_activate_stage3_ip6_start (self)) {
+ g_set_error_literal (error,
+ NM_DEVICE_ERROR,
+ NM_DEVICE_ERROR_CREATION_FAILED,
+ "Failed to apply IPv6 configuration");
+ }
+ } else {
+ ip6_config_merge_and_apply (self, TRUE, NULL);
+ }
+
+ return TRUE;
+}
+
/* nm_device_reapply_connection:
* @connection: the new connection settings to be applied
* @flags: always zero
@@ -6921,6 +6967,9 @@ nm_device_reapply_connection (NMDevice *self,
if (strcmp (setting, NM_SETTING_IP4_CONFIG_SETTING_NAME) == 0) {
if (!nm_device_reapply_ip4_config (self, old, reconfigure, error))
goto done;
+ } else if (strcmp (setting, NM_SETTING_IP6_CONFIG_SETTING_NAME) == 0) {
+ if (!nm_device_reapply_ip6_config (self, old, reconfigure, error))
+ goto done;
} else if (NM_DEVICE_GET_CLASS (self)->reapply) {
if (!NM_DEVICE_GET_CLASS (self)->reapply (self, old, setting, reconfigure, error))
goto done;