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 v3 09/11] iwd: Hookup manual scan trigger (Daniel Wagner)
2. [PATCH v3 07/11] iwd: Add AccessPoint API support (Daniel Wagner)
3. [PATCH v3 06/11] iwd: Add Station API support (Daniel Wagner)
4. Re: [PATCH v3 00/11] Update iwd plugin (Daniel Wagner)
5. Re: Connection to WPA fails following connect-failed error
([email protected])
----------------------------------------------------------------------
Date: Mon, 13 Jan 2020 09:47:53 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v3 09/11] iwd: Hookup manual scan trigger
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
Via the Station API we can trigger a manual scan.
---
plugins/iwd.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/plugins/iwd.c b/plugins/iwd.c
index 8b4a2b387daa..f762d97d1532 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -394,6 +394,42 @@ static int cm_device_disable(struct connman_device *device)
return set_device_powered(device, false);
}
+static void cm_device_scan_cb(DBusMessage *message, void *user_data)
+{
+ const char *path = user_data;
+ struct iwd_station *iwds;
+
+ iwds = g_hash_table_lookup(networks, path);
+ if (!iwds)
+ return;
+
+ if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_ERROR) {
+ const char *dbus_error = dbus_message_get_error_name(message);
+
+ DBG("%s scan failed: %s", path, dbus_error);
+ }
+}
+
+static int cm_device_scan(struct connman_device *device,
+ struct connman_device_scan_params *params)
+{
+ struct iwd_device *iwdd = connman_device_get_data(device);
+ struct iwd_station *iwds;
+
+ if (strcmp(iwdd->mode, "station"))
+ return -EINVAL;
+
+ iwds = g_hash_table_lookup(stations, iwdd->path);
+ if (!iwds)
+ return -EIO;
+
+ if (!g_dbus_proxy_method_call(iwds->proxy, "Scan",
+ NULL, cm_device_scan_cb, g_strdup(iwds->path), g_free))
+ return -EIO;
+
+ return -EINPROGRESS;
+}
+
static struct connman_device_driver device_driver = {
.name = "iwd",
.type = CONNMAN_DEVICE_TYPE_WIFI,
@@ -401,6 +437,7 @@ static struct connman_device_driver device_driver = {
.remove = cm_device_remove,
.enable = cm_device_enable,
.disable = cm_device_disable,
+ .scan = cm_device_scan,
};
static int cm_tech_probe(struct connman_technology *technology)
--
2.24.1
------------------------------
Date: Mon, 13 Jan 2020 09:47:51 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v3 07/11] iwd: Add AccessPoint API support
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
iwd exposes the AcessPoint API under the same path as the Device API. Add
the initial D-Bus parsing code to the plugin.
---
plugins/iwd.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
diff --git a/plugins/iwd.c b/plugins/iwd.c
index e40ac913b93a..6e2b9672beb5 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -44,6 +44,7 @@ static GHashTable *devices;
static GHashTable *networks;
static GHashTable *known_networks;
static GHashTable *stations;
+static GHashTable *access_points;
static bool agent_registered;
#define IWD_SERVICE "net.connman.iwd"
@@ -54,6 +55,7 @@ static bool agent_registered;
#define IWD_NETWORK_INTERFACE "net.connman.iwd.Network"
#define IWD_KNOWN_NETWORK_INTERFACE "net.connman.iwd.KnownNetwork"
#define IWD_STATION_INTERFACE "net.connman.iwd.Station"
+#define IWD_AP_INTERFACE "net.connman.iwd.AccessPoint"
#define IWD_AGENT_INTERFACE "net.connman.iwd.Agent"
#define IWD_AGENT_ERROR_INTERFACE "net.connman.iwd.Agent.Error"
@@ -113,6 +115,12 @@ struct iwd_station {
bool scanning;
};
+struct iwd_ap {
+ GDBusProxy *proxy;
+ char *path;
+ bool started;
+};
+
static const char *proxy_get_string(GDBusProxy *proxy, const char *property)
{
DBusMessageIter iter;
@@ -676,6 +684,27 @@ static void station_property_change(GDBusProxy *proxy,
const char *name,
}
}
+static void ap_property_change(GDBusProxy *proxy, const char *name,
+ DBusMessageIter *iter, void *user_data)
+{
+ struct iwd_ap *iwdap;
+ const char *path;
+
+ path = g_dbus_proxy_get_path(proxy);
+ iwdap = g_hash_table_lookup(access_points, path);
+ if (!iwdap)
+ return;
+
+ if (!strcmp(name, "Started")) {
+ dbus_bool_t started;
+
+ dbus_message_iter_get_basic(iter, &started);
+ iwdap->started = started;
+
+ DBG("%s started %d", path, iwdap->started);
+ }
+}
+
static void adapter_free(gpointer data)
{
struct iwd_adapter *iwda = data;
@@ -757,6 +786,17 @@ static void station_free(gpointer data)
g_free(iwds);
}
+static void ap_free(gpointer data)
+{
+ struct iwd_ap *iwdap = data;
+
+ if (iwdap->proxy) {
+ g_dbus_proxy_unref(iwdap->proxy);
+ iwdap->proxy = NULL;
+ }
+ g_free(iwdap);
+}
+
static void create_adapter(GDBusProxy *proxy)
{
const char *path = g_dbus_proxy_get_path(proxy);
@@ -1088,6 +1128,36 @@ static void create_station(GDBusProxy *proxy)
station_property_change, NULL);
}
+static void create_ap(GDBusProxy *proxy)
+{
+ const char *path = g_dbus_proxy_get_path(proxy);
+ struct iwd_ap *iwdap;
+
+ iwdap = g_try_new0(struct iwd_ap, 1);
+ if (!iwdap) {
+ connman_error("Out of memory creating IWD access point");
+ return;
+ }
+
+ iwdap->path = g_strdup(path);
+ g_hash_table_replace(access_points, iwdap->path, iwdap);
+
+ iwdap->proxy = g_dbus_proxy_ref(proxy);
+
+ if (!iwdap->proxy) {
+ connman_error("Cannot create IWD access point watcher %s",
path);
+ g_hash_table_remove(access_points, path);
+ return;
+ }
+
+ iwdap->started = proxy_get_bool(proxy, "Started");
+
+ DBG("started %d", iwdap->started);
+
+ g_dbus_proxy_set_property_watch(iwdap->proxy,
+ ap_property_change, NULL);
+}
+
static void object_added(GDBusProxy *proxy, void *user_data)
{
const char *interface;
@@ -1113,6 +1183,8 @@ static void object_added(GDBusProxy *proxy, void
*user_data)
create_know_network(proxy);
else if (!strcmp(interface, IWD_STATION_INTERFACE))
create_station(proxy);
+ else if (!strcmp(interface, IWD_AP_INTERFACE))
+ create_ap(proxy);
}
static void object_removed(GDBusProxy *proxy, void *user_data)
@@ -1141,6 +1213,8 @@ static void object_removed(GDBusProxy *proxy, void
*user_data)
g_hash_table_remove(known_networks, path);
else if (!strcmp(interface, IWD_STATION_INTERFACE))
g_hash_table_remove(stations, path);
+ else if (!strcmp(interface, IWD_AP_INTERFACE))
+ g_hash_table_remove(access_points, path);
}
static int iwd_init(void)
@@ -1164,6 +1238,9 @@ static int iwd_init(void)
stations = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
station_free);
+ access_points = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
+ ap_free);
+
if (connman_technology_driver_register(&tech_driver) < 0) {
connman_warn("Failed to initialize technology for IWD");
goto out;
@@ -1209,6 +1286,9 @@ static int iwd_init(void)
if (stations)
g_hash_table_destroy(stations);
+ if (access_points)
+ g_hash_table_destroy(access_points);
+
if (adapters)
g_hash_table_destroy(adapters);
@@ -1226,6 +1306,7 @@ static void iwd_exit(void)
g_dbus_client_unref(client);
+ g_hash_table_destroy(access_points);
g_hash_table_destroy(stations);
g_hash_table_destroy(known_networks);
g_hash_table_destroy(networks);
--
2.24.1
------------------------------
Date: Mon, 13 Jan 2020 09:47:50 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v3 06/11] iwd: Add Station API support
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
iwd exposes the Station API under the same path as the Device API. Add
the initial D-Bus parsing code to the plugin.
---
plugins/iwd.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
diff --git a/plugins/iwd.c b/plugins/iwd.c
index 94284996a6bb..e40ac913b93a 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -43,6 +43,7 @@ static GHashTable *adapters;
static GHashTable *devices;
static GHashTable *networks;
static GHashTable *known_networks;
+static GHashTable *stations;
static bool agent_registered;
#define IWD_SERVICE "net.connman.iwd"
@@ -52,6 +53,7 @@ static bool agent_registered;
#define IWD_DEVICE_INTERFACE "net.connman.iwd.Device"
#define IWD_NETWORK_INTERFACE "net.connman.iwd.Network"
#define IWD_KNOWN_NETWORK_INTERFACE "net.connman.iwd.KnownNetwork"
+#define IWD_STATION_INTERFACE "net.connman.iwd.Station"
#define IWD_AGENT_INTERFACE "net.connman.iwd.Agent"
#define IWD_AGENT_ERROR_INTERFACE "net.connman.iwd.Agent.Error"
@@ -103,6 +105,14 @@ struct iwd_known_network {
bool auto_connect;
};
+struct iwd_station {
+ GDBusProxy *proxy;
+ char *path;
+ char *state;
+ char *connected_network;
+ bool scanning;
+};
+
static const char *proxy_get_string(GDBusProxy *proxy, const char *property)
{
DBusMessageIter iter;
@@ -625,6 +635,47 @@ static void network_property_change(GDBusProxy *proxy,
const char *name,
}
}
+static void station_property_change(GDBusProxy *proxy, const char *name,
+ DBusMessageIter *iter, void *user_data)
+{
+ struct iwd_station *iwds;
+ const char *path;
+
+ path = g_dbus_proxy_get_path(proxy);
+ iwds = g_hash_table_lookup(stations, path);
+ if (!iwds)
+ return;
+
+ if (!strcmp(name, "State")) {
+ const char *state;
+
+ dbus_message_iter_get_basic(iter, &state);
+ g_free(iwds->state);
+ iwds->state = g_strdup(state);
+
+ DBG("%s state %s", path, iwds->state);
+ } else if (!strcmp(name, "ConnectedNetwork")) {
+ const char *connected_network;
+
+ g_free(iwds->connected_network);
+ if (!g_strcmp0(iwds->state, "disconnecting")) {
+ iwds->connected_network = NULL;
+ } else {
+ dbus_message_iter_get_basic(iter, &connected_network);
+ iwds->connected_network = g_strdup(connected_network);
+ }
+
+ DBG("%s connected_network %s", path, iwds->connected_network);
+ } else if (!strcmp(name, "Scanning")) {
+ dbus_bool_t scanning;
+
+ dbus_message_iter_get_basic(iter, &scanning);
+ iwds->scanning = scanning;
+
+ DBG("%s scanning %d", path, iwds->scanning);
+ }
+}
+
static void adapter_free(gpointer data)
{
struct iwd_adapter *iwda = data;
@@ -693,6 +744,19 @@ static void known_network_free(gpointer data)
g_free(iwdkn);
}
+static void station_free(gpointer data)
+{
+ struct iwd_station *iwds = data;
+
+ if (iwds->proxy) {
+ g_dbus_proxy_unref(iwds->proxy);
+ iwds->proxy = NULL;
+ }
+ g_free(iwds->path);
+ g_free(iwds->connected_network);
+ g_free(iwds);
+}
+
static void create_adapter(GDBusProxy *proxy)
{
const char *path = g_dbus_proxy_get_path(proxy);
@@ -991,6 +1055,39 @@ static void create_know_network(GDBusProxy *proxy)
iwdkn->last_connected_time, iwdkn->auto_connect);
}
+static void create_station(GDBusProxy *proxy)
+{
+ const char *path = g_dbus_proxy_get_path(proxy);
+ struct iwd_station *iwds;
+
+ iwds = g_try_new0(struct iwd_station, 1);
+ if (!iwds) {
+ connman_error("Out of memory creating IWD station");
+ return;
+ }
+
+ iwds->path = g_strdup(path);
+ g_hash_table_replace(stations, iwds->path, iwds);
+
+ iwds->proxy = g_dbus_proxy_ref(proxy);
+
+ if (!iwds->proxy) {
+ connman_error("Cannot create IWD station watcher %s", path);
+ g_hash_table_remove(stations, path);
+ return;
+ }
+
+ iwds->state = g_strdup(proxy_get_string(proxy, "State"));
+ iwds->connected_network = g_strdup(proxy_get_string(proxy,
"ConnectedNetwork"));
+ iwds->scanning = proxy_get_bool(proxy, "Scanning");
+
+ DBG("state '%s' connected_network %s scanning %d",
+ iwds->state, iwds->connected_network, iwds->scanning);
+
+ g_dbus_proxy_set_property_watch(iwds->proxy,
+ station_property_change, NULL);
+}
+
static void object_added(GDBusProxy *proxy, void *user_data)
{
const char *interface;
@@ -1014,6 +1111,8 @@ static void object_added(GDBusProxy *proxy, void
*user_data)
create_network(proxy);
else if (!strcmp(interface, IWD_KNOWN_NETWORK_INTERFACE))
create_know_network(proxy);
+ else if (!strcmp(interface, IWD_STATION_INTERFACE))
+ create_station(proxy);
}
static void object_removed(GDBusProxy *proxy, void *user_data)
@@ -1040,6 +1139,8 @@ static void object_removed(GDBusProxy *proxy, void
*user_data)
g_hash_table_remove(networks, path);
else if (!strcmp(interface, IWD_KNOWN_NETWORK_INTERFACE))
g_hash_table_remove(known_networks, path);
+ else if (!strcmp(interface, IWD_STATION_INTERFACE))
+ g_hash_table_remove(stations, path);
}
static int iwd_init(void)
@@ -1060,6 +1161,9 @@ static int iwd_init(void)
known_networks = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
known_network_free);
+ stations = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
+ station_free);
+
if (connman_technology_driver_register(&tech_driver) < 0) {
connman_warn("Failed to initialize technology for IWD");
goto out;
@@ -1102,6 +1206,9 @@ static int iwd_init(void)
if (known_networks)
g_hash_table_destroy(known_networks);
+ if (stations)
+ g_hash_table_destroy(stations);
+
if (adapters)
g_hash_table_destroy(adapters);
@@ -1119,6 +1226,7 @@ static void iwd_exit(void)
g_dbus_client_unref(client);
+ g_hash_table_destroy(stations);
g_hash_table_destroy(known_networks);
g_hash_table_destroy(networks);
g_hash_table_destroy(devices);
--
2.24.1
------------------------------
Date: Mon, 13 Jan 2020 09:56:38 +0100
From: Daniel Wagner <[email protected]>
Subject: Re: [PATCH v3 00/11] Update iwd plugin
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
> changes since v2:
> - Disconnect via station API
- Dropped ad-hoc code
------------------------------
Date: Mon, 13 Jan 2020 13:06:08 -0000
From: [email protected]
Subject: Re: Connection to WPA fails following connect-failed error
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Hi Daniel,
Our UI that uses libConnman-qt5 has the same behavior as connmanctl.
If we don't remove the service after a connect-failed (config <service>
--remove), we don't have problem to connect to a known service.
However, if we don't do the remove command, it is not possible to fix the wrong
password because the agent doesn't request a user input.
Is there another way to ensure that a user input is requested after a wrong
password is set for a service?
best regards
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list -- [email protected]
To unsubscribe send an email to [email protected]
------------------------------
End of connman Digest, Vol 51, Issue 17
***************************************