From: Pasi Sjöholm <[email protected]>

It is possible that IPv6.Settings-properties does not include
ip-address, gateway or nameservers when the context is made active.
This is due underlying ofono-driver/ril sending the assigned ipv4-addresses
first and then the assigned ipv6-addresses (within 3 secs).

This happens especially only with dual/ipv4v6-protocol and Ofono does not
currently have method to signal the updated values to it's clients.

However there is a way to workaround this by setting the ipv6_method
as CONNMAN_IPCONFIG_METHOD_AUTO and letting the connman find about
those ipv6-addresses (ip-address, gateway, nameservers) by itself.
---
 plugins/ofono.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index eb788e0..17cda61 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -298,7 +298,12 @@ static void set_connected(struct modem_data *modem)
        }
 
        method = modem->context->ipv6_method;
-       if (method == CONNMAN_IPCONFIG_METHOD_FIXED) {
+       if (method == CONNMAN_IPCONFIG_METHOD_AUTO) {
+               connman_service_create_ip6config(service, index);
+               connman_network_set_ipv6_method(modem->network, method);
+
+               setip = true;
+       } else if (method == CONNMAN_IPCONFIG_METHOD_FIXED) {
                if (modem->context->ipv6_address) {
                        connman_service_create_ip6config(service, index);
                        connman_network_set_ipv6_method(modem->network, method);
@@ -939,19 +944,23 @@ static void extract_ipv6_settings(DBusMessageIter *array,
        if (index < 0)
                goto out;
 
-       context->ipv6_method = CONNMAN_IPCONFIG_METHOD_FIXED;
-
-       context->ipv6_address =
-               connman_ipaddress_alloc(CONNMAN_IPCONFIG_TYPE_IPV6);
-       if (!context->ipv6_address)
-               goto out;
+       g_free(context->ipv6_nameservers);
+       context->ipv6_nameservers = nameservers;
 
        context->index = index;
-       connman_ipaddress_set_ipv6(context->ipv6_address, address,
-                               prefix_length, gateway);
 
-       g_free(context->ipv6_nameservers);
-       context->ipv6_nameservers = nameservers;
+       if (address) {
+               context->ipv6_address =
+                       connman_ipaddress_alloc(CONNMAN_IPCONFIG_TYPE_IPV6);
+               if (!context->ipv6_address)
+                       goto out;
+
+               connman_ipaddress_set_ipv6(context->ipv6_address, address,
+                                       prefix_length, gateway);
+               context->ipv6_method = CONNMAN_IPCONFIG_METHOD_FIXED;
+       } else {
+               context->ipv6_method = CONNMAN_IPCONFIG_METHOD_AUTO;
+       }
 
 out:
        if (context->ipv6_nameservers != nameservers)
-- 
2.1.0

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to