Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. Re: [PATCH v2 1/4] inet: Add prefixlen to
      iproute_default_function (Daniel Wagner)
   2. Re: [PATCH] ipv6pd: Remove unused timer_hash (Daniel Wagner)
   3. [PATCH v2] dns: Use hash table instead of binary tree
      (Daniel Wagner)
   4. [PATCH] service: Return OperationAborted when agent gets
      Canceled (Daniel Wagner)
   5. Re: net.connman.Error.InvalidArguments is returned in
      response to net.connman.Agent.Error.Canceled (Daniel Wagner)


----------------------------------------------------------------------

Message: 1
Date: Sun, 08 Oct 2017 11:27:35 +0200
From: Daniel Wagner <[email protected]>
To: Jian Liang <[email protected]>
Cc: [email protected],  Jian Liang <[email protected]>
Subject: Re: [PATCH v2 1/4] inet: Add prefixlen to
        iproute_default_function
Message-ID: <[email protected]>
Content-Type: text/plain

Hi Jian,

Jian Liang <[email protected]> writes:

> From: Jian Liang <[email protected]>
>
> Add prefixlen parameter to this function in preparation for using
> it also in creating subnet route later, e.g.
>
> default via 192.168.100.1 dev eth0
> 192.168.100.0/24 dev eth0

Works as expected now. No crashes or anyting else unexpected. All four
patches applied.

Thanks,
Daniel


------------------------------

Message: 2
Date: Sun, 08 Oct 2017 11:47:27 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Subject: Re: [PATCH] ipv6pd: Remove unused timer_hash
Message-ID: <[email protected]>
Content-Type: text/plain

Daniel Wagner <[email protected]> writes:

> There is no user of timer_hash, hence remove it.

Patch applied.


------------------------------

Message: 3
Date: Sun,  8 Oct 2017 11:56:41 +0200
From: Daniel Wagner <[email protected]>
To: "Puustinen, Ismo" <[email protected]>
Cc: [email protected],       Daniel Wagner <[email protected]>
Subject: [PATCH v2] dns: Use hash table instead of binary tree
Message-ID: <[email protected]>

ConnMan doesn't use the binary tree data structures from glib
anywhere. Since there are still plans to move to ELL which has no
support for a binary tree. Let's not make our live more complex than
necessary.
---
Hi Ismo,

here is an updated version. It looks like I am bit rusty on my glib
foo :)

changes since v1:
 - fixed the signature and implemenetation of compare_index()
 - test return value of setup_resolved correctly

Thanks,
Daniel

src/dns-systemd-resolved.c | 50 ++++++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/src/dns-systemd-resolved.c b/src/dns-systemd-resolved.c
index 93d63b5bf0ae..4e9b2ff15233 100644
--- a/src/dns-systemd-resolved.c
+++ b/src/dns-systemd-resolved.c
@@ -36,7 +36,7 @@
 #define SYSTEMD_RESOLVED_SERVICE "org.freedesktop.resolve1"
 #define SYSTEMD_RESOLVED_PATH "/org/freedesktop/resolve1"
 
-static GTree *interface_map;
+static GHashTable *interface_hash;
 static DBusConnection *connection;
 static GDBusClient *client;
 static GDBusProxy *resolved_proxy;
@@ -52,12 +52,12 @@ struct dns_interface {
        bool needs_server_update;
 };
 
-static gint int_cmp(gconstpointer a, gconstpointer b, void *data)
+static gboolean compare_index(gconstpointer a, gconstpointer b)
 {
        gint ai = GPOINTER_TO_UINT(a);
        gint bi = GPOINTER_TO_UINT(b);
 
-       return ai - bi;
+       return ai == bi;
 }
 
 static void free_dns_interface(gpointer data)
@@ -217,7 +217,7 @@ static bool is_empty(struct dns_interface *iface)
        return (!iface->domains && !iface->servers);
 }
 
-static gboolean update_interface(gpointer key, gpointer value, gpointer data)
+static void update_interface(gpointer key, gpointer value, gpointer data)
 {
        struct dns_interface *iface = value;
        GList **removed_items = data;
@@ -226,25 +226,25 @@ static gboolean update_interface(gpointer key, gpointer 
value, gpointer data)
 
        if (is_empty(iface))
                *removed_items = g_list_prepend(*removed_items, iface);
-
-       /* don't stop the tree traversal */
-       return FALSE;
 }
 
 static int update_systemd_resolved(gpointer data)
 {
        GList *removed_items = NULL, *list;
 
-       if (!interface_map) {
-               DBG("no interface map when updating");
+       if (!interface_hash) {
+               DBG("no interface hash when updating");
+
                return G_SOURCE_REMOVE;
        }
 
-       g_tree_foreach(interface_map, update_interface, &removed_items);
+       g_hash_table_foreach(interface_hash, update_interface, &removed_items);
 
        for (list = removed_items; list; list = g_list_next(list)) {
                struct dns_interface *iface = list->data;
-               g_tree_remove(interface_map, GUINT_TO_POINTER(iface->index));
+
+               g_hash_table_remove(interface_hash,
+                               GUINT_TO_POINTER(iface->index));
        }
 
        g_list_free(removed_items);
@@ -293,10 +293,10 @@ int __connman_dnsproxy_remove(int index, const char 
*domain,
        DBG("%d, %s, %s", index, domain ? domain : "no domain",
                        server ? server : "no server");
 
-       if (!interface_map || index < 0)
+       if (!interface_hash || index < 0)
                return -EINVAL;
 
-       iface = g_tree_lookup(interface_map, GUINT_TO_POINTER(index));
+       iface = g_hash_table_lookup(interface_hash, GUINT_TO_POINTER(index));
 
        if (!iface)
                return -EINVAL;
@@ -335,10 +335,10 @@ int __connman_dnsproxy_append(int index, const char 
*domain,
        DBG("%d, %s, %s", index, domain ? domain : "no domain",
                        server ? server : "no server");
 
-       if (!interface_map || index < 0)
+       if (!interface_hash || index < 0)
                return -EINVAL;
 
-       iface = g_tree_lookup(interface_map, GUINT_TO_POINTER(index));
+       iface = g_hash_table_lookup(interface_hash, GUINT_TO_POINTER(index));
 
        if (!iface) {
                iface = g_new0(struct dns_interface, 1);
@@ -346,7 +346,7 @@ int __connman_dnsproxy_append(int index, const char *domain,
                        return -ENOMEM;
 
                iface->index = index;
-               g_tree_insert(interface_map, GUINT_TO_POINTER(index), iface);
+               g_hash_table_replace(interface_hash, GUINT_TO_POINTER(index), 
iface);
        }
 
        if (domain) {
@@ -405,13 +405,15 @@ int __connman_dnsproxy_init(void)
 
        DBG("");
 
-       if ((ret = setup_resolved()) < 0)
+       ret = setup_resolved();
+       if (ret)
                return ret;
 
-       interface_map = g_tree_new_full(int_cmp, NULL, NULL,
-                       free_dns_interface);
-
-       if (!interface_map)
+       interface_hash = g_hash_table_new_full(g_direct_hash,
+                                               compare_index,
+                                               NULL,
+                                               free_dns_interface);
+       if (!interface_hash)
                return -ENOMEM;
 
        return 0;
@@ -431,9 +433,9 @@ void __connman_dnsproxy_cleanup(void)
                 update_interfaces_source = 0;
        }
 
-       if (interface_map) {
-               g_tree_destroy(interface_map);
-               interface_map = NULL;
+       if (interface_hash) {
+               g_hash_table_destroy(interface_hash);
+               interface_hash = NULL;
        }
 
        if (resolved_proxy) {
-- 
2.9.5


------------------------------

Message: 4
Date: Sun,  8 Oct 2017 13:10:11 +0200
From: Daniel Wagner <[email protected]>
To: Vasyl Vavrychuk <[email protected]>
Cc: [email protected],       Daniel Wagner <[email protected]>
Subject: [PATCH] service: Return OperationAborted when agent gets
        Canceled
Message-ID: <[email protected]>

When the user decided to cancel the connect attempt, the agent sends
net.connman.Agent.Error.Canceled. Currently, we return InvalidArgument
for normal non-hidden networks and ConnectedAborted for hidden
networks. Return OperationAborted also for non-hidden networks to
avoid confusion on the user ends. That means the cancel operation was
successful and nothing went wrong as invalid argument indicates.

Reported by Vasyl Vavrychuk.
---

Hi Vasyl,

Can you give it a try and give feedback?

Thanks,
Daniel


 doc/agent-api.txt | 2 ++
 src/service.c     | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/agent-api.txt b/doc/agent-api.txt
index aa7271d43484..e3c1dcde8cd3 100644
--- a/doc/agent-api.txt
+++ b/doc/agent-api.txt
@@ -54,6 +54,8 @@ Methods               void Release()
                        keys are the field names and the values are the
                        actual fields. Alternatively an error indicating that
                        the request got canceled can be returned.
+                       OperationAborted will be return on a successfull
+                       cancel request.
 
                        Most common return field names are "Name" and of
                        course "Passphrase".
diff --git a/src/service.c b/src/service.c
index 02cd51f2e104..219285439678 100644
--- a/src/service.c
+++ b/src/service.c
@@ -5341,7 +5341,7 @@ static void request_input_cb(struct connman_service 
*service,
 
                if (g_strcmp0(error,
                                "net.connman.Agent.Error.Canceled") == 0) {
-                       err = -EINVAL;
+                       err = -ECONNABORTED;
 
                        if (service->hidden)
                                __connman_service_return_error(service,
-- 
2.9.5


------------------------------

Message: 5
Date: Sun, 08 Oct 2017 13:11:51 +0200
From: Daniel Wagner <[email protected]>
To: Vasyl Vavrychuk <[email protected]>
Cc: [email protected]
Subject: Re: net.connman.Error.InvalidArguments is returned in
        response to net.connman.Agent.Error.Canceled
Message-ID: <[email protected]>
Content-Type: text/plain

Hi Valys,

Vasyl Vavrychuk <[email protected]> writes:
> Is it possible to get more specialized response like 'ConnectionAborted' 
> instead of InvalidArguments. Since we do not know if anything gonna
> wrong or canceling was successful.

Yes, that makes perfectly sense. Especially because we treat hidden and
non-hidden networks differently in the cancel code path. Can you please
test the patch I just send out?

Thanks,
Daniel


------------------------------

Subject: Digest Footer

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


------------------------------

End of connman Digest, Vol 24, Issue 11
***************************************

Reply via email to