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: How are WIFI and iwd kept apart? (Daniel Wagner)
   2. [PATCH] iwd: Create wpa_s identifiers (Daniel Wagner)


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

Message: 1
Date: Sun, 18 Mar 2018 18:23:21 +0100
From: Daniel Wagner <[email protected]>
To: Andreas Koller <[email protected]>
Cc: [email protected]
Subject: Re: How are WIFI and iwd kept apart?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed

On 03/16/2018 02:51 PM, Andreas Koller wrote:
> They share all types (SERVICE_TYPE, DEVICE_TYPE and SERVICE_TYPE) -
> how does connman know, that a particular device is iwd and not WIFI,
> so it should call the iwd and not the WIFI probe functions?

You can build a ConnMan binary which supports wpa_supplicant and iwd. 
But you should use one at runtime. If you start both daemons you get 
interesting results. That happened to me when systemd decided it needs 
start NetworkManager (wpa_s) alongside ConnMan (iwd).


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

Message: 2
Date: Sun, 18 Mar 2018 18:26:11 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH] iwd: Create wpa_s identifiers
Message-ID: <[email protected]>

The identifier has no special meaning except it needs to be unique. It
will also be used to save and load configs. We should use the same
identifier as we have created with wpa_supplicant. This is important
when the user switches from a wpa_supplicant setup to iwd one. This
avoids reconfigurering the system.
---
 plugins/iwd.c | 45 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/plugins/iwd.c b/plugins/iwd.c
index b5191654d6cf..6a017b2e90d0 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -484,17 +484,53 @@ static void update_signal_strength(struct iwd_device 
*iwdd)
                DBG("GetOrderedNetworks() failed");
 }
 
+static const char *security_remap(const char *security)
+{
+       if (!g_strcmp0(security, "open"))
+               return "none";
+       else if (!g_strcmp0(security, "psk"))
+               return "psk";
+       else if (!g_strcmp0(security, "8021x"))
+               return "ieee8021x";
+
+       return "unknown";
+}
+
+static char *create_identifier(const char *path, const char *security)
+{
+       char *start, *end, *identifier;
+       char *_path = g_strdup(path);
+
+       /*
+        * _path is something like
+        *     /0/4/5363686970686f6c5f427573696e6573735f454150_8021x
+        */
+       start = strrchr(_path, '/');
+       start++;
+       end = strchr(start, '_');
+       *end = '\0';
+
+       /*
+        * Create an ident which is identical to the corresponding
+        * wpa_supplicant identifier.
+        */
+       identifier = g_strdup_printf("%s_managed_%s", start,
+                               security_remap(security));
+       g_free(_path);
+
+       return identifier;
+}
+
 static void add_network(const char *path, struct iwd_network *iwdn)
 {
        struct iwd_device *iwdd;
-       const char *identifier;
+       char *identifier;
 
        iwdd = g_hash_table_lookup(devices, iwdn->device);
        if (!iwdd)
                return;
 
-       identifier = strrchr(path, '/');
-       identifier++; /* strip leading slash as well */
+       identifier = create_identifier(path, iwdn->type);
        iwdn->network = connman_network_create(identifier,
                                        CONNMAN_NETWORK_TYPE_WIFI);
        connman_network_set_data(iwdn->network, iwdn);
@@ -504,6 +540,7 @@ static void add_network(const char *path, struct 
iwd_network *iwdn)
                                        strlen(iwdn->name));
        connman_network_set_string(iwdn->network, "WiFi.Security",
                                        iwdn->type);
+       connman_network_set_string(iwdn->network, "WiFi.Mode", "managed");
 
        if (connman_device_add_network(iwdd->device, iwdn->network) < 0) {
                connman_network_unref(iwdn->network);
@@ -514,6 +551,8 @@ static void add_network(const char *path, struct 
iwd_network *iwdn)
 
        connman_network_set_available(iwdn->network, true);
        connman_network_set_group(iwdn->network, identifier);
+
+       g_free(identifier);
 }
 
 static void remove_network(struct iwd_network *iwdn)
-- 
2.14.3


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

Subject: Digest Footer

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


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

End of connman Digest, Vol 29, Issue 16
***************************************

Reply via email to