Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe 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. [PATCH] iwd: Disable iwd's auto connect feature (Daniel Wagner)
   2. Re: [PATCH 0/2] Wireguard improvments (Daniel Wagner)
   3. Re: [PATCH] iwd: Disable iwd's auto connect feature
      (Daniel Wagner)
   4. Next release (Daniel Wagner)
   5. [PATCH] iwd: Fix station_property_changed KnownNetwork handling
      (Daniel Wagner)
   6. Re: [PATCH] iwd: Fix station_property_changed KnownNetwork handling
      (Daniel Wagner)
   7. Re: Next release (Jonah Petri)


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

Date: Sat, 18 Jan 2020 17:30:45 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH] iwd: Disable iwd's auto connect feature
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>

iwd is able to auto connect to known networks. Since ConnMan wants to
decide when to connect to a network, always disable the known network
auto connect feature.
---
 plugins/iwd.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 115 insertions(+), 1 deletion(-)

diff --git a/plugins/iwd.c b/plugins/iwd.c
index 94cc3d9a7719..ac9795f3a7e1 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -105,6 +105,7 @@ struct iwd_known_network {
        bool hidden;
        char *last_connected_time;
        bool auto_connect;
+       int auto_connect_id;
 };
 
 struct iwd_station {
@@ -1155,6 +1156,9 @@ static void known_network_free(gpointer data)
                iwdkn->proxy = NULL;
        }
 
+       if (iwdkn->auto_connect_id)
+               g_source_remove(iwdkn->auto_connect_id);
+
        g_free(iwdkn->path);
        g_free(iwdkn->name);
        g_free(iwdkn->type);
@@ -1451,6 +1455,110 @@ static void create_network(GDBusProxy *proxy)
        add_network(path, iwdn);
 }
 
+struct auto_connect_cb_data {
+       char *path;
+       bool auto_connect;
+};
+
+static void auto_connect_cb_free(struct auto_connect_cb_data *cbd)
+{
+       g_free(cbd->path);
+       g_free(cbd);
+}
+
+static void auto_connect_cb(const DBusError *error, void *user_data)
+{
+       struct auto_connect_cb_data *cbd = user_data;
+       struct iwd_known_network *iwdkn;
+
+       iwdkn = g_hash_table_lookup(known_networks, cbd->path);
+       if (!iwdkn)
+               goto out;
+
+       if (dbus_error_is_set(error))
+               connman_warn("WiFi known network %s property auto connect %s",
+                       cbd->path, error->message);
+
+       /* property is updated via watch known_network_property_change() */
+out:
+       auto_connect_cb_free(cbd);
+}
+
+static int set_auto_connect(struct iwd_known_network *iwdkn, bool auto_connect)
+{
+       dbus_bool_t dbus_auto_connect = auto_connect;
+       struct auto_connect_cb_data *cbd;
+
+       if (proxy_get_bool(iwdkn->proxy, "AutoConnect") == auto_connect)
+               return -EALREADY;
+
+       cbd = g_new(struct auto_connect_cb_data, 1);
+       cbd->path = g_strdup(iwdkn->path);
+       cbd->auto_connect = auto_connect;
+
+       if (!g_dbus_proxy_set_property_basic(iwdkn->proxy, "AutoConnect",
+                                               DBUS_TYPE_BOOLEAN,
+                                               &dbus_auto_connect,
+                                               auto_connect_cb, cbd, NULL)) {
+               auto_connect_cb_free(cbd);
+               return -EIO;
+       }
+
+       return -EINPROGRESS;
+}
+
+static gboolean disable_auto_connect_cb(gpointer data)
+{
+       char *path = data;
+       struct iwd_known_network *iwdkn;
+
+       iwdkn = g_hash_table_lookup(known_networks, path);
+       if (!iwdkn)
+               return FALSE;
+
+       if (set_auto_connect(iwdkn, false) != -EINPROGRESS)
+               connman_warn("Failed to disable auto connect");
+
+       iwdkn->auto_connect_id = 0;
+       return FALSE;
+}
+
+static void disable_auto_connect(struct iwd_known_network *iwdkn)
+{
+       if (iwdkn->auto_connect_id)
+               return;
+
+       iwdkn->auto_connect_id = g_timeout_add_full(G_PRIORITY_DEFAULT,
+                                               0,
+                                               disable_auto_connect_cb,
+                                               g_strdup(iwdkn->path),
+                                               g_free);
+}
+
+static void known_network_property_change(GDBusProxy *proxy, const char *name,
+               DBusMessageIter *iter, void *user_data)
+{
+       struct iwd_known_network *iwdkn;
+       const char *path;
+
+       path = g_dbus_proxy_get_path(proxy);
+       iwdkn = g_hash_table_lookup(known_networks, path);
+       if (!iwdkn)
+               return;
+
+       if (!strcmp(name, "AutoConnect")) {
+               dbus_bool_t auto_connect;
+
+               dbus_message_iter_get_basic(iter, &auto_connect);
+               iwdkn->auto_connect = auto_connect;
+
+               DBG("%p auto_connect %d", path, iwdkn->auto_connect);
+
+               if (iwdkn->auto_connect)
+                       disable_auto_connect(iwdkn);
+       }
+}
+
 static void create_know_network(GDBusProxy *proxy)
 {
        const char *path = g_dbus_proxy_get_path(proxy);
@@ -1478,11 +1586,17 @@ static void create_know_network(GDBusProxy *proxy)
        iwdkn->hidden = proxy_get_bool(proxy, "Hidden");
        iwdkn->last_connected_time =
                g_strdup(proxy_get_string(proxy, "LastConnectedTime"));
-       iwdkn->auto_connect = proxy_get_bool(proxy, "AutoConnec");
+       iwdkn->auto_connect = proxy_get_bool(proxy, "AutoConnect");
 
        DBG("name '%s' type %s hidden %d, last_connection_time %s auto_connect 
%d",
                iwdkn->name, iwdkn->type, iwdkn->hidden,
                iwdkn->last_connected_time, iwdkn->auto_connect);
+
+       g_dbus_proxy_set_property_watch(iwdkn->proxy,
+                       known_network_property_change, NULL);
+
+       if (iwdkn->auto_connect)
+               disable_auto_connect(iwdkn);
 }
 
 static void create_station(GDBusProxy *proxy)
-- 
2.24.1

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

Date: Sat, 18 Jan 2020 17:56:05 +0100
From: Daniel Wagner <[email protected]>
Subject: Re: [PATCH 0/2] Wireguard improvments
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Fri, Jan 17, 2020 at 09:35:11AM +0100, Daniel Wagner wrote:
> A few bunch of improvements for wireguard. Currently I can't test
> wireguard because my setup is broken. Out of tree code is a hassle...

Patches applied.

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

Date: Sat, 18 Jan 2020 17:57:04 +0100
From: Daniel Wagner <[email protected]>
Subject: Re: [PATCH] iwd: Disable iwd's auto connect feature
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Sat, Jan 18, 2020 at 05:30:45PM +0100, Daniel Wagner wrote:
> iwd is able to auto connect to known networks. Since ConnMan wants to
> decide when to connect to a network, always disable the known network
> auto connect feature.

Patch applied.

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

Date: Sat, 18 Jan 2020 18:07:01 +0100
From: Daniel Wagner <[email protected]>
Subject: Next release
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

Hi,

I think the current version is in good shape. We have a few 'new'
features, such as VPN revamp, WireGuard support and iwd 1.0
support. Also the usual bug fixes.

Is there anything properly annoying with the current HEAD?

The last release was almost a year ago. It's about time for new one :)

Thanks,
Daniel

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

Date: Sat, 18 Jan 2020 18:50:31 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH] iwd: Fix station_property_changed KnownNetwork
        handling
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>

Instead trying to figure out if it's okay to access the iter pointer
via the state name, just test the pointer for NULL.
---
 plugins/iwd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/iwd.c b/plugins/iwd.c
index ac9795f3a7e1..7821c51ba30b 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -1042,11 +1042,11 @@ static void station_property_change(GDBusProxy *proxy, 
const char *name,
                const char *connected_network;
 
                g_free(iwds->connected_network);
-               if (!g_strcmp0(iwds->state, "disconnecting")) {
-                       iwds->connected_network = NULL;
-               } else {
+               if (iter) {
                        dbus_message_iter_get_basic(iter, &connected_network);
                        iwds->connected_network = g_strdup(connected_network);
+               } else {
+                       iwds->connected_network = NULL;
                }
 
                DBG("%s connected_network %s", path, iwds->connected_network);
-- 
2.24.1

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

Date: Sat, 18 Jan 2020 18:54:08 +0100
From: Daniel Wagner <[email protected]>
Subject: Re: [PATCH] iwd: Fix station_property_changed KnownNetwork
        handling
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Sat, Jan 18, 2020 at 06:50:31PM +0100, Daniel Wagner wrote:
> Instead trying to figure out if it's okay to access the iter pointer
> via the state name, just test the pointer for NULL.

After fixing the subject s/KnownNetwork/connected network/ patch applied

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

Date: Sat, 18 Jan 2020 13:41:46 -0500
From: Jonah Petri <[email protected]>
Subject: Re: Next release
To: Daniel Wagner <[email protected]>, [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed

On 1/18/20 12:07 PM, Daniel Wagner wrote:
> The last release was almost a year ago. It's about time for new one

[accidentally dropped mailing list - re-adding!]

Out of curiosity, what does a release imply for this project?  Is there 
special testing for compatibility which is done?  (Do any companies lend 
their support to this testing effort?)

I'm not trying to imply any judgement about it either way; I'm just 
looking for info.

Best,

Jonah

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

Subject: Digest Footer

_______________________________________________
connman mailing list -- [email protected]
To unsubscribe send an email to [email protected]


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

End of connman Digest, Vol 51, Issue 23
***************************************

Reply via email to