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. [PATCH v1 6/7] iwd: Add/remove ConnMan devices (Daniel Wagner)
2. [PATCH v1 7/7] iwd: Add/remove ConnMan networks (Daniel Wagner)
3. [PATCH v1 4/7] iwd: Add Agent support (Daniel Wagner)
4. [PATCH v4 0/4] Add AlwaysConnectedTechnologies feature
(Ioan-Adrian Ratiu)
5. [PATCH v4 1/4] main: add new AlwaysConnectedTechnologies list
option (Ioan-Adrian Ratiu)
----------------------------------------------------------------------
Message: 1
Date: Fri, 11 Nov 2016 16:53:14 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v1 6/7] iwd: Add/remove ConnMan devices
Message-ID: <[email protected]>
From: Daniel Wagner <[email protected]>
---
plugins/iwd.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/plugins/iwd.c b/plugins/iwd.c
index b289cb05f09e..8c4efce0faec 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -26,12 +26,14 @@
#include <errno.h>
#include <string.h>
#include <stdbool.h>
+#include <linux/if_ether.h>
#define CONNMAN_API_SUBJECT_TO_CHANGE
#include <connman/plugin.h>
#include <connman/dbus.h>
#include <connman/network.h>
#include <connman/technology.h>
+#include <connman/inet.h>
#include <gdbus.h>
static DBusConnection *connection;
@@ -76,6 +78,8 @@ struct iwd_device {
enum iwd_device_state state;
bool powered;
bool scanning;
+
+ struct connman_device *device;
};
struct iwd_network {
@@ -140,6 +144,17 @@ static bool proxy_get_bool(GDBusProxy *proxy, const char
*property)
return value;
}
+static void address2ident(const char *address, char *ident)
+{
+ int i;
+
+ for (i = 0; i < ETH_ALEN; i++) {
+ ident[i * 2] = address[i * 3];
+ ident[i * 2 + 1] = address[i * 3 + 1];
+ }
+ ident[ETH_ALEN * 2] = '\0';
+}
+
static int cm_network_probe(struct connman_network *network)
{
return -EOPNOTSUPP;
@@ -170,6 +185,18 @@ static struct connman_network_driver network_driver = {
static int cm_device_probe(struct connman_device *device)
{
+ GHashTableIter iter;
+ gpointer key, value;
+
+ g_hash_table_iter_init(&iter, devices);
+
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ struct iwd_device *iwdd = value;
+
+ if (device == iwdd->device)
+ return 0;
+ }
+
return -EOPNOTSUPP;
}
@@ -177,8 +204,51 @@ static void cm_device_remove(struct connman_device *device)
{
}
+struct dev_cb_data {
+ char *path;
+ bool powered;
+};
+
+static void device_powered_cb(const DBusError *error, void *user_data)
+{
+ struct dev_cb_data *cbd = user_data;
+ struct iwd_device *iwdd;;
+
+ iwdd = g_hash_table_lookup(devices, cbd->path);
+ if (!iwdd)
+ goto out;
+
+ if (dbus_error_is_set(error)) {
+ connman_warn("WiFi device %s not enabled %s",
+ cbd->path, error->message);
+ goto out;
+ }
+
+ connman_device_set_powered(iwdd->device, cbd->powered);
+out:
+ g_free(cbd->path);
+}
+
static int set_device_powered(struct connman_device *device, bool powered)
{
+ struct iwd_device *iwdd = connman_device_get_data(device);
+ dbus_bool_t device_powered = powered;
+ struct dev_cb_data *cbd;
+ const char *path;
+
+ path = g_dbus_proxy_get_path(iwdd->proxy);
+
+ if (proxy_get_bool(iwdd->proxy, "Powered"))
+ return -EALREADY;
+
+ cbd = g_new(struct dev_cb_data, 1);
+ cbd->path = g_strdup(path);
+ cbd->powered = powered;
+
+ g_dbus_proxy_set_property_basic(iwdd->proxy, "Powered",
+ DBUS_TYPE_BOOLEAN, &device_powered,
+ device_powered_cb, cbd, g_free);
+
return -EINPROGRESS;
}
@@ -217,6 +287,36 @@ static struct connman_technology_driver tech_driver = {
.remove = cm_tech_remove,
};
+static void add_device(const char *path, struct iwd_device *iwdd)
+{
+ char ident[ETH_ALEN * 2 + 1];
+
+ iwdd->device = connman_device_create("wifi", CONNMAN_DEVICE_TYPE_WIFI);
+ if (!iwdd->device)
+ return;
+
+ connman_device_set_data(iwdd->device, iwdd);
+
+ address2ident(iwdd->address, ident);
+ connman_device_set_ident(iwdd->device, ident);
+
+ if (connman_device_register(iwdd->device) < 0) {
+ g_hash_table_remove(devices, path);
+ return;
+ }
+
+ connman_device_set_powered(iwdd->device, iwdd->powered);
+}
+
+static void remove_device(struct iwd_device *iwdd)
+{
+ if (!iwdd->device)
+ return;
+
+ connman_device_unref(iwdd->device);
+ iwdd->device = NULL;
+}
+
static void adapter_property_change(GDBusProxy *proxy, const char *name,
DBusMessageIter *iter, void *user_data)
{
@@ -325,6 +425,8 @@ static void device_free(gpointer data)
iwdd->proxy = NULL;
}
+ remove_device(iwdd);
+
g_free(iwdd->adapter);
g_free(iwdd->name);
g_free(iwdd->address);
@@ -430,6 +532,8 @@ static void create_device(GDBusProxy *proxy)
g_dbus_proxy_set_property_watch(iwdd->proxy,
device_property_change, NULL);
+
+ add_device(path, iwdd);
}
static void unregister_agent();
--
2.7.4
------------------------------
Message: 2
Date: Fri, 11 Nov 2016 16:53:15 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v1 7/7] iwd: Add/remove ConnMan networks
Message-ID: <[email protected]>
From: Daniel Wagner <[email protected]>
---
plugins/iwd.c | 273 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 272 insertions(+), 1 deletion(-)
diff --git a/plugins/iwd.c b/plugins/iwd.c
index 8c4efce0faec..f43b483b88ab 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -88,6 +88,8 @@ struct iwd_network {
char *name;
char *type;
bool connected;
+
+ struct connman_network *network;
};
static enum iwd_device_state string2state(const char *str)
@@ -157,20 +159,155 @@ static void address2ident(const char *address, char
*ident)
static int cm_network_probe(struct connman_network *network)
{
+ GHashTableIter iter;
+ gpointer key, value;
+
+ g_hash_table_iter_init(&iter, networks);
+
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ struct iwd_network *iwdn = value;
+
+ if (network == iwdn->network)
+ return 0;
+ }
+
return -EOPNOTSUPP;
}
static void cm_network_remove(struct connman_network *network)
{
+ struct connman_device *device;
+ struct iwd_network *iwdn;
+
+ iwdn = connman_network_get_data(network);
+ if (iwdn)
+ iwdn->network = NULL;
+
+ device = connman_network_get_device(network);
+ if (device)
+ connman_device_remove_network(device, network);
+}
+
+static void update_network_connected(struct iwd_network *iwdn)
+{
+ struct iwd_device *iwdd;
+ int index;
+
+ iwdd = g_hash_table_lookup(devices, iwdn->device);
+ if (!iwdd)
+ return;
+
+ index = connman_inet_ifindex(iwdd->name);
+ if (index < 0)
+ return;
+
+ DBG("interface name %s index %d", iwdd->name, index);
+ connman_network_set_index(iwdn->network, index);
+ connman_network_set_connected(iwdn->network, true);
+}
+
+static void update_network_disconnected(struct iwd_network *iwdn)
+{
+ DBG("interface name %s", iwdn->name);
+ connman_network_set_connectable(iwdn->network, false);
+ connman_network_set_connected(iwdn->network, false);
+}
+
+static void cm_network_connect_cb(DBusMessage *message, void *user_data)
+{
+ const char *path = user_data;
+ struct iwd_network *iwdn;
+
+ iwdn = g_hash_table_lookup(networks, path);
+ if (!iwdn)
+ return;
+
+ if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_ERROR) {
+ const char *dbus_error = dbus_message_get_error_name(message);
+
+ if (!strcmp(dbus_error, "net.connman.iwd.InProgress"))
+ return;
+
+ DBG("%s connect failed: %s", path, dbus_error);
+ connman_network_set_error(iwdn->network,
+ CONNMAN_NETWORK_ERROR_CONNECT_FAIL);
+ return;
+ }
+
+ update_network_connected(iwdn);
}
static int cm_network_connect(struct connman_network *network)
{
+ struct iwd_network *iwdn = connman_network_get_data(network);
+ const char *path;
+
+ if (!iwdn)
+ return -EINVAL;
+
+ path = g_dbus_proxy_get_path(iwdn->proxy);
+
+ if (!g_dbus_proxy_method_call(iwdn->proxy, "Connect",
+ NULL, cm_network_connect_cb,
+ g_strdup(path), g_free))
+ return -EIO;
+
+ connman_network_set_connectable(iwdn->network, true);
+ connman_network_set_associating(iwdn->network, true);
+
return -EINPROGRESS;
}
+static void cm_network_disconnect_cb(DBusMessage *message, void *user_data)
+{
+ const char *path = user_data;
+ struct iwd_network *iwdn;
+
+ iwdn = g_hash_table_lookup(networks, path);
+ if (!iwdn)
+ return;
+
+ if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_ERROR) {
+ const char *dbus_error = dbus_message_get_error_name(message);
+
+ if (!strcmp(dbus_error, "net.connman.iwd.NotConnected")) {
+ /* fall through */
+ } else {
+ DBG("%s disconnect failed: %s", path, dbus_error);
+ return;
+ }
+ }
+
+ /*
+ * We end up in a tight loop in the error case. That is
+ * when we can't connect, bail out in cm_network_connect_cb() with
+ * an error.
+ */
+ if (connman_network_get_connected(iwdn->network))
+ update_network_disconnected(iwdn);
+}
+
static int cm_network_disconnect(struct connman_network *network)
{
+ struct iwd_network *iwdn = connman_network_get_data(network);
+ struct iwd_device *iwdd;
+ const char *path;
+
+ if (!iwdn)
+ return -EINVAL;
+
+ path = g_dbus_proxy_get_path(iwdn->proxy);
+ if (!path)
+ return -EIO;
+
+ iwdd = g_hash_table_lookup(devices, iwdn->device);
+ if (!iwdd)
+ return -EIO;
+
+ if (!g_dbus_proxy_method_call(iwdd->proxy, "Disconnect",
+ NULL, cm_network_disconnect_cb, g_strdup(path), g_free))
+ return -EIO;
+
return -EINPROGRESS;
}
@@ -287,6 +424,124 @@ static struct connman_technology_driver tech_driver = {
.remove = cm_tech_remove,
};
+static unsigned char calculate_strength(int strength)
+{
+ unsigned char res;
+
+ /*
+ * Network's maximum signal strength expressed in 100 * dBm.
+ * The value is the range of 0 (strongest signal) to -10000
+ * (weakest signal)
+ *
+ * ConnMan expects it in the range from 100 (strongest) to 0
+ * (weakest).
+ */
+ res = (unsigned char)((strength * -10000) / 100);
+
+ return res;
+}
+
+static void _update_signal_strength(const char *path, int16_t signal_strength)
+{
+ struct iwd_network *iwdn;
+
+ iwdn = g_hash_table_lookup(networks, path);
+ if (!iwdn)
+ return;
+
+ if (!iwdn->network)
+ return;
+
+ connman_network_set_strength(iwdn->network,
+ calculate_strength(signal_strength));
+}
+
+static void ordered_networks_cb(DBusMessage *message, void *user_data)
+{
+ DBusMessageIter array, entry;
+
+ DBG("");
+
+ if (!dbus_message_iter_init(message, &array))
+ return;
+
+ if (dbus_message_iter_get_arg_type(&array) != DBUS_TYPE_ARRAY)
+ return;
+
+ dbus_message_iter_recurse(&array, &entry);
+ while (dbus_message_iter_get_arg_type(&entry) == DBUS_TYPE_STRUCT) {
+ DBusMessageIter value;
+ const char *path, *name, *type;
+ int16_t signal_strength;
+
+
+ dbus_message_iter_recurse(&entry, &value);
+
+ dbus_message_iter_get_basic(&value, &path);
+
+ dbus_message_iter_next(&value);
+ dbus_message_iter_get_basic(&value, &name);
+
+ dbus_message_iter_next(&value);
+ dbus_message_iter_get_basic(&value, &signal_strength);
+
+ dbus_message_iter_next(&value);
+ dbus_message_iter_get_basic(&value, &type);
+
+ _update_signal_strength(path, signal_strength);
+
+ dbus_message_iter_next(&entry);
+ }
+}
+
+static void update_signal_strength(struct iwd_device *iwdd)
+{
+ if (!g_dbus_proxy_method_call(iwdd->proxy,
+ "GetOrderedNetworks",
+ NULL, ordered_networks_cb,
+ NULL, NULL))
+ DBG("GetOrderedNetworks() failed");
+}
+
+static void add_network(const char *path, struct iwd_network *iwdn)
+{
+ struct iwd_device *iwdd;
+ const char *identifier;
+
+ iwdd = g_hash_table_lookup(devices, iwdn->device);
+ if (!iwdd)
+ return;
+
+ identifier = strrchr(path, '/');
+ identifier++; /* strip leading slash as well */
+ iwdn->network = connman_network_create(identifier,
+ CONNMAN_NETWORK_TYPE_WIFI);
+ connman_network_set_data(iwdn->network, iwdn);
+
+ connman_network_set_name(iwdn->network, iwdn->name);
+ connman_network_set_blob(iwdn->network, "WiFi.SSID", iwdn->name,
+ strlen(iwdn->name));
+ connman_network_set_string(iwdn->network, "WiFi.Security",
+ iwdn->type);
+
+ if (connman_device_add_network(iwdd->device, iwdn->network) < 0) {
+ connman_network_unref(iwdn->network);
+ iwdn->network = NULL;
+ }
+
+ connman_network_set_available(iwdn->network, true);
+ connman_network_set_group(iwdn->network, identifier);
+}
+
+static void remove_network(struct iwd_network *iwdn)
+{
+ if (!iwdn->network)
+ return;
+
+ connman_network_unref(iwdn->network);
+ iwdn->network = NULL;
+}
+
static void add_device(const char *path, struct iwd_device *iwdd)
{
char ident[ETH_ALEN * 2 + 1];
@@ -306,6 +561,9 @@ static void add_device(const char *path, struct iwd_device
*iwdd)
}
connman_device_set_powered(iwdd->device, iwdd->powered);
+
+ if (iwdd->powered)
+ update_signal_strength(iwdd);
}
static void remove_device(struct iwd_device *iwdd)
@@ -378,6 +636,10 @@ static void device_property_change(GDBusProxy *proxy,
const char *name,
iwdd->scanning = scanning;
DBG("%s scanning %d", path, iwdd->scanning);
+
+ if (!iwdd->scanning)
+ update_signal_strength(iwdd);
+
}
}
@@ -399,6 +661,11 @@ static void network_property_change(GDBusProxy *proxy,
const char *name,
iwdn->connected = connected;
DBG("%s connected %d", path, iwdn->connected);
+
+ if (iwdn->connected)
+ update_network_connected(iwdn);
+ else
+ update_network_disconnected(iwdn);
}
}
@@ -442,6 +709,8 @@ static void network_free(gpointer data)
iwdn->proxy = NULL;
}
+ remove_network(iwdn);
+
g_free(iwdn->device);
g_free(iwdn->name);
g_free(iwdn->type);
@@ -572,7 +841,7 @@ static DBusMessage *agent_request_passphrase(DBusConnection
*dbus_conn,
if (!iwdn)
return get_reply_on_error(message, EINVAL);
- passwd = "mysecret";
+ passwd = connman_network_get_string(iwdn->network, "WiFi.Passphrase");
return g_dbus_create_reply(message, DBUS_TYPE_STRING, &passwd,
DBUS_TYPE_INVALID);
@@ -699,6 +968,8 @@ static void create_network(GDBusProxy *proxy)
g_dbus_proxy_set_property_watch(network->proxy,
network_property_change, NULL);
+
+ add_network(path, network);
}
static void object_added(GDBusProxy *proxy, void *user_data)
--
2.7.4
------------------------------
Message: 3
Date: Fri, 11 Nov 2016 16:53:12 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v1 4/7] iwd: Add Agent support
Message-ID: <[email protected]>
From: Daniel Wagner <[email protected]>
---
plugins/iwd.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 128 insertions(+)
diff --git a/plugins/iwd.c b/plugins/iwd.c
index bb351f07d3af..56b0d4b3943a 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -34,9 +34,11 @@
static DBusConnection *connection;
static GDBusClient *client;
+static GDBusProxy *agent_proxy;
static GHashTable *adapters;
static GHashTable *devices;
static GHashTable *networks;
+static bool agent_registered;
#define IWD_SERVICE "net.connman.iwd"
#define IWD_PATH "/"
@@ -45,6 +47,10 @@ static GHashTable *networks;
#define IWD_DEVICE_INTERFACE "net.connman.iwd.Device"
#define IWD_NETWORK_INTERFACE "net.connman.iwd.Network"
+#define IWD_AGENT_INTERFACE "net.connman.iwd.Agent"
+#define IWD_AGENT_ERROR_INTERFACE "net.connman.iwd.Agent.Error"
+#define AGENT_PATH "/net/connman/iwd_agent"
+
enum iwd_device_state {
IWD_DEVICE_STATE_UNKNOWN,
IWD_DEVICE_STATE_CONNECTED,
@@ -347,12 +353,132 @@ static void create_device(GDBusProxy *proxy)
device_property_change, NULL);
}
+static void unregister_agent();
+
+static DBusMessage *agent_release_method(DBusConnection *dbus_conn,
+ DBusMessage *message, void *user_data)
+{
+ unregister_agent();
+ return g_dbus_create_reply(message, DBUS_TYPE_INVALID);
+}
+
+static DBusMessage *get_reply_on_error(DBusMessage *message, int error)
+{
+ return g_dbus_create_error(message,
+ IWD_AGENT_ERROR_INTERFACE ".Failed", "Invalid parameters");
+}
+
+static DBusMessage *agent_request_passphrase(DBusConnection *dbus_conn,
+ DBusMessage *message,
+ void *user_data)
+{
+ struct iwd_network *iwdn;
+ DBusMessageIter iter;
+ const char *path, *passwd;
+
+ DBG("");
+
+ dbus_message_iter_init(message, &iter);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_OBJECT_PATH)
+ return get_reply_on_error(message, EINVAL);
+
+ dbus_message_iter_get_basic(&iter, &path);
+
+ iwdn = g_hash_table_lookup(networks, path);
+ if (!iwdn)
+ return get_reply_on_error(message, EINVAL);
+
+ passwd = "mysecret";
+
+ return g_dbus_create_reply(message, DBUS_TYPE_STRING, &passwd,
+ DBUS_TYPE_INVALID);
+}
+
+static DBusMessage *agent_cancel(DBusConnection *dbus_conn,
+ DBusMessage *message, void *user_data)
+{
+ DBusMessageIter iter;
+ const char *reason;
+
+ dbus_message_iter_init(message, &iter);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
+ return get_reply_on_error(message, EINVAL);
+
+ dbus_message_iter_get_basic(&iter, &reason);
+
+ DBG("cancel: %s", reason);
+ /* XXX stop connection attempt, which one? */
+
+ return g_dbus_create_reply(message, DBUS_TYPE_INVALID);
+}
+
+static const GDBusMethodTable agent_methods[] = {
+ { GDBUS_METHOD("Release", NULL, NULL, agent_release_method) },
+ { GDBUS_METHOD("RequestPassphrase",
+ GDBUS_ARGS({ "path", "o" }),
+ GDBUS_ARGS({ "passphrase", "s" }),
+ agent_request_passphrase)},
+ { GDBUS_METHOD("Cancel",
+ GDBUS_ARGS({ "reason", "s" }),
+ NULL, agent_cancel) },
+ { },
+};
+
+static void agent_register_builder(DBusMessageIter *iter, void *user_data)
+{
+ const char *path = AGENT_PATH;
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
+ &path);
+}
+
static void register_agent(GDBusProxy *proxy)
{
+ if (!g_dbus_proxy_method_call(proxy,
+ "RegisterAgent",
+ agent_register_builder,
+ NULL, NULL, NULL))
+ return;
+
+ agent_proxy = g_dbus_proxy_ref(proxy);
}
static void unregister_agent()
{
+ if (!agent_proxy)
+ return;
+
+ g_dbus_proxy_method_call(agent_proxy,
+ "UnregisterAgent",
+ agent_register_builder,
+ NULL, NULL, NULL);
+
+ g_dbus_proxy_unref(agent_proxy);
+ agent_proxy = NULL;
+}
+
+static void iwd_is_present(DBusConnection *conn, void *user_data)
+{
+ if (agent_registered)
+ return;
+
+ if (!g_dbus_register_interface(connection, AGENT_PATH,
+ IWD_AGENT_INTERFACE, agent_methods,
+ NULL, NULL, NULL, NULL))
+ return;
+
+ agent_registered = true;
+}
+
+static void iwd_is_out(DBusConnection *conn, void *user_data)
+{
+ if (agent_registered) {
+ g_dbus_unregister_interface(connection,
+ AGENT_PATH, IWD_AGENT_INTERFACE);
+ agent_registered = false;
+ }
}
static void create_network(GDBusProxy *proxy)
@@ -461,6 +587,8 @@ static int iwd_init(void)
goto out;
}
+ g_dbus_client_set_connect_watch(client, iwd_is_present, NULL);
+ g_dbus_client_set_disconnect_watch(client, iwd_is_out, NULL);
g_dbus_client_set_proxy_handlers(client, object_added, object_removed,
NULL, NULL);
--
2.7.4
------------------------------
Message: 4
Date: Fri, 11 Nov 2016 17:53:15 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>
Subject: [PATCH v4 0/4] Add AlwaysConnectedTechnologies feature
Message-ID: <[email protected]>
Content-Type: text/plain
Changes since v3 (based on Daniel's feedback):
* Updated manpage to document the new main.conf option
* Fixed a typo in the last condition modified in auto_connect_service
(added a negation to the always_connect call)
* Split the more complex auto_connect_service conditionals into their
own function and added comments to make them easier to understand
* Minor whitespace cleanups
Ioan-Adrian Ratiu (4):
main: add new AlwaysConnectedTechnologies list option
service: implement AlwaysConnectedTechnologies option
service: abstract the more complex autoconnect conditionals
main.conf: document AlwaysConnectedTechnologies option
doc/connman.conf.5.in | 6 ++++++
src/main.c | 18 ++++++++++++++++++
src/main.conf | 7 +++++++
src/service.c | 49 +++++++++++++++++++++++++++++++++++++++++++++----
4 files changed, 76 insertions(+), 4 deletions(-)
--
2.10.2
------------------------------
Message: 5
Date: Fri, 11 Nov 2016 17:53:16 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>
Subject: [PATCH v4 1/4] main: add new AlwaysConnectedTechnologies list
option
Message-ID: <[email protected]>
Content-Type: text/plain
This option is a list of technologies which should always connect,
by default it's empty and each element in the list depends on having
AutoConnect=true.
---
src/main.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/main.c b/src/main.c
index fdb4f72..462ac15 100644
--- a/src/main.c
+++ b/src/main.c
@@ -67,6 +67,7 @@ static struct {
char **pref_timeservers;
unsigned int *auto_connect;
unsigned int *preferred_techs;
+ unsigned int *always_connected_techs;
char **fallback_nameservers;
unsigned int timeout_inputreq;
unsigned int timeout_browserlaunch;
@@ -81,6 +82,7 @@ static struct {
.pref_timeservers = NULL,
.auto_connect = NULL,
.preferred_techs = NULL,
+ .always_connected_techs = NULL,
.fallback_nameservers = NULL,
.timeout_inputreq = DEFAULT_INPUT_REQUEST_TIMEOUT,
.timeout_browserlaunch = DEFAULT_BROWSER_LAUNCH_TIMEOUT,
@@ -95,6 +97,7 @@ static struct {
#define CONF_BG_SCAN "BackgroundScanning"
#define CONF_PREF_TIMESERVERS "FallbackTimeservers"
#define CONF_AUTO_CONNECT "DefaultAutoConnectTechnologies"
+#define CONF_ALWAYS_CONNECTED_TECHS "AlwaysConnectedTechnologies"
#define CONF_PREFERRED_TECHS "PreferredTechnologies"
#define CONF_FALLBACK_NAMESERVERS "FallbackNameservers"
#define CONF_TIMEOUT_INPUTREQ "InputRequestTimeout"
@@ -110,6 +113,7 @@ static const char *supported_options[] = {
CONF_BG_SCAN,
CONF_PREF_TIMESERVERS,
CONF_AUTO_CONNECT,
+ CONF_ALWAYS_CONNECTED_TECHS,
CONF_PREFERRED_TECHS,
CONF_FALLBACK_NAMESERVERS,
CONF_TIMEOUT_INPUTREQ,
@@ -295,6 +299,17 @@ static void parse_config(GKeyFile *config)
g_clear_error(&error);
str_list = __connman_config_get_string_list(config, "General",
+ CONF_ALWAYS_CONNECTED_TECHS, &len, &error);
+
+ if (!error)
+ connman_settings.always_connected_techs =
+ parse_service_types(str_list, len);
+
+ g_strfreev(str_list);
+
+ g_clear_error(&error);
+
+ str_list = __connman_config_get_string_list(config, "General",
CONF_FALLBACK_NAMESERVERS, &len, &error);
if (!error)
@@ -572,6 +587,9 @@ unsigned int *connman_setting_get_uint_list(const char *key)
if (g_str_equal(key, CONF_PREFERRED_TECHS))
return connman_settings.preferred_techs;
+ if (g_str_equal(key, CONF_ALWAYS_CONNECTED_TECHS))
+ return connman_settings.always_connected_techs;
+
return NULL;
}
--
2.10.2
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 13, Issue 16
***************************************