ipconfig: IPv6 was enabled too early
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Mon, 21 Jan 2013 12:39:31 +0000 (14:39 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 24 Jan 2013 10:08:17 +0000 (12:08 +0200)
When enabling IPv6 ipconfig, we enable kernel IPv6 support too early.
The ipconfig might get unreffed which will disable ipconfig and
thus disable kernel IPv6 support. By moving kernel IPv6 enabling
after the ipconfig unref call, we make sure that IPv6 kernel support
is properly enabled.
This is related to fix in commit d479904ecaa2bd9

src/ipconfig.c

index b400894..9ca3316 100644 (file)
@@ -1556,7 +1556,6 @@ int __connman_ipconfig_enable(struct connman_ipconfig *ipconfig)
                if (ipdevice->config_ipv6 == ipconfig)
                        return -EALREADY;
                type = CONNMAN_IPCONFIG_TYPE_IPV6;
-               enable_ipv6(ipconfig);
        } else
                return -EINVAL;
 
@@ -1584,9 +1583,11 @@ int __connman_ipconfig_enable(struct connman_ipconfig *ipconfig)
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
                ipdevice->config_ipv4 = __connman_ipconfig_ref(ipconfig);
-       else if (type == CONNMAN_IPCONFIG_TYPE_IPV6)
+       else if (type == CONNMAN_IPCONFIG_TYPE_IPV6) {
                ipdevice->config_ipv6 = __connman_ipconfig_ref(ipconfig);
 
+               enable_ipv6(ipdevice->config_ipv6);
+       }
        ipconfig_list = g_list_append(ipconfig_list, ipconfig);
 
        if (ipdevice->flags & IFF_UP)