ip6: don't 'assume' IPv6 connections (bgo #676740)
authorPavel Šimerda <psimerda@redhat.com>
Thu, 24 May 2012 13:37:40 +0000 (15:37 +0200)
committerPavel Šimerda <psimerda@redhat.com>
Wed, 30 May 2012 17:07:14 +0000 (19:07 +0200)
The bug report describes a testing scenario where device is down
and no IPv4 or IPv6 addresses are set up. Then NetworkManager
is started and it decides not to configure DHCPv6 address. This
is caused by code copied from IPv4 that does not work here at
all (and I wonder if it does in IPv4).

In any case, when NetworkManager starts a DHCP client and recieves
an IPv6 address (no addresses are configured at the time), it
*must* send this new IPv6 address to the kernel.

src/nm-device.c

index 5499ccf..885fb49 100644 (file)
@@ -246,7 +246,6 @@ static gboolean nm_device_set_ip4_config (NMDevice *dev,
                                           NMDeviceStateReason *reason);
 static gboolean nm_device_set_ip6_config (NMDevice *dev,
                                           NMIP6Config *config,
-                                          gboolean assumed,
                                           NMDeviceStateReason *reason);
 
 static gboolean nm_device_activate_ip6_config_commit (gpointer user_data);
@@ -1821,7 +1820,7 @@ ip6_config_merge_and_apply (NMDevice *self,
 {
        NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
        NMConnection *connection;
-       gboolean assumed, success;
+       gboolean success;
        NMIP6Config *composite;
 
        connection = nm_device_get_connection (self);
@@ -1844,8 +1843,7 @@ ip6_config_merge_and_apply (NMDevice *self,
        /* Merge user overrides into the composite config */
        nm_utils_merge_ip6_config (composite, nm_connection_get_setting_ip6_config (connection));
 
-       assumed = nm_act_request_get_assumed (priv->act_request);
-       success = nm_device_set_ip6_config (self, composite, assumed, out_reason);
+       success = nm_device_set_ip6_config (self, composite, out_reason);
        g_object_unref (composite);
        return success;
 }
@@ -3185,7 +3183,7 @@ nm_device_deactivate (NMDevice *self, NMDeviceStateReason reason)
 
        /* Clean up nameservers and addresses */
        nm_device_set_ip4_config (self, NULL, FALSE, &ignored);
-       nm_device_set_ip6_config (self, NULL, FALSE, &ignored);
+       nm_device_set_ip6_config (self, NULL, &ignored);
 }
 
 gboolean
@@ -3489,7 +3487,6 @@ nm_device_set_ip4_config (NMDevice *self,
 static gboolean
 nm_device_set_ip6_config (NMDevice *self,
                           NMIP6Config *new_config,
-                          gboolean assumed,
                           NMDeviceStateReason *reason)
 {
        NMDevicePrivate *priv;
@@ -3527,13 +3524,9 @@ nm_device_set_ip6_config (NMDevice *self,
        if (new_config) {
                priv->ip6_config = g_object_ref (new_config);
 
-               /* Don't touch the device's actual IP config if the connection is
-                * assumed when NM starts.
-                */
-               if (!assumed)
-                       success = nm_system_apply_ip6_config (ip_ifindex, new_config, nm_device_get_priority (self), diff);
+               success = nm_system_apply_ip6_config (ip_ifindex, new_config, nm_device_get_priority (self), diff);
 
-               if (success || assumed) {
+               if (success) {
                        /* Export over D-Bus */
                        if (!nm_ip6_config_get_dbus_path (new_config))
                                nm_ip6_config_export (new_config);