[PATCH] bluetooth: Remove Bluez 4.x support
by Patrik Flykt
Remove Bluez 4.x support as the 4.x versions have been discontinued
for quite some time already. Bluez 5.x versions have been supported
since ConnMan 1.11 and are actively maintained.
---
Makefile.plugins | 2 -
plugins/bluetooth_legacy.c | 1385 --------------------------------------------
2 files changed, 1387 deletions(-)
delete mode 100644 plugins/bluetooth_legacy.c
diff --git a/Makefile.plugins b/Makefile.plugins
index e90ad19..b01fd80 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -27,8 +27,6 @@ builtin_sources += plugins/wifi.c $(gsupplicant_sources)
endif
if BLUETOOTH
-builtin_modules += bluetooth_legacy
-builtin_sources += plugins/bluetooth_legacy.c
builtin_modules += bluetooth
builtin_sources += plugins/bluetooth.c
endif
diff --git a/plugins/bluetooth_legacy.c b/plugins/bluetooth_legacy.c
deleted file mode 100644
index 2d7a9e0..0000000
--- a/plugins/bluetooth_legacy.c
+++ /dev/null
@@ -1,1385 +0,0 @@
-/*
- *
- * Connection Manager
- *
- * Copyright (C) 2007-2013 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netinet/ether.h>
-
-#include <gdbus.h>
-
-#define CONNMAN_API_SUBJECT_TO_CHANGE
-#include <connman/plugin.h>
-#include <connman/technology.h>
-#include <connman/device.h>
-#include <connman/inet.h>
-#include <connman/dbus.h>
-#include <connman/log.h>
-
-#define BLUEZ_SERVICE "org.bluez"
-#define BLUEZ_MANAGER_INTERFACE BLUEZ_SERVICE ".Manager"
-#define BLUEZ_ADAPTER_INTERFACE BLUEZ_SERVICE ".Adapter"
-#define BLUEZ_DEVICE_INTERFACE BLUEZ_SERVICE ".Device"
-#define BLUEZ_NETWORK_INTERFACE BLUEZ_SERVICE ".Network"
-#define BLUEZ_NETWORK_SERVER BLUEZ_SERVICE ".NetworkServer"
-
-#define LIST_ADAPTERS "ListAdapters"
-#define ADAPTER_ADDED "AdapterAdded"
-#define ADAPTER_REMOVED "AdapterRemoved"
-#define DEVICE_REMOVED "DeviceRemoved"
-
-#define PROPERTY_CHANGED "PropertyChanged"
-#define GET_PROPERTIES "GetProperties"
-#define SET_PROPERTY "SetProperty"
-
-#define CONNECT "Connect"
-#define DISCONNECT "Disconnect"
-
-#define REGISTER "Register"
-#define UNREGISTER "Unregister"
-
-#define UUID_NAP "00001116-0000-1000-8000-00805f9b34fb"
-
-#define TIMEOUT 60000
-
-static DBusConnection *connection;
-
-static GHashTable *bluetooth_devices = NULL;
-static GHashTable *bluetooth_networks = NULL;
-static GHashTable *pending_networks = NULL;
-
-static int pan_probe(struct connman_network *network)
-{
- GHashTableIter iter;
- gpointer key, val;
-
- g_hash_table_iter_init(&iter, bluetooth_networks);
- while (g_hash_table_iter_next(&iter, &key, &val)) {
- struct connman_network *known = val;
-
- if (network != known)
- continue;
-
- DBG("network %p", network);
-
- return 0;
- }
-
- return -EOPNOTSUPP;
-}
-
-static void pan_remove(struct connman_network *network)
-{
- DBG("network %p", network);
-}
-
-static void connect_reply(DBusPendingCall *call, void *user_data)
-{
- char *path = user_data;
- struct connman_network *network;
- DBusMessage *reply;
- DBusError error;
- const char *interface = NULL;
- int index;
-
- network = g_hash_table_lookup(bluetooth_networks, path);
- if (!network)
- return;
-
- DBG("network %p", network);
-
- reply = dbus_pending_call_steal_reply(call);
-
- dbus_error_init(&error);
-
- if (dbus_set_error_from_message(&error, reply)) {
- connman_error("%s", error.message);
- dbus_error_free(&error);
-
- goto err;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_STRING,
- &interface, DBUS_TYPE_INVALID)) {
- if (dbus_error_is_set(&error)) {
- connman_error("%s", error.message);
- dbus_error_free(&error);
- } else
- connman_error("Wrong arguments for connect");
- goto err;
- }
-
- if (!interface)
- goto err;
-
- DBG("interface %s", interface);
-
- index = connman_inet_ifindex(interface);
-
- connman_network_set_index(network, index);
-
- connman_network_set_connected(network, true);
-
- dbus_message_unref(reply);
-
- dbus_pending_call_unref(call);
-
- return;
-err:
-
- connman_network_set_connected(network, false);
-
- dbus_message_unref(reply);
-
- dbus_pending_call_unref(call);
-}
-
-static int pan_connect(struct connman_network *network)
-{
- const char *path = connman_network_get_string(network, "Path");
- const char *uuid = "nap";
- DBusMessage *message;
- DBusPendingCall *call;
-
- DBG("network %p", network);
-
- if (!path)
- return -EINVAL;
-
- message = dbus_message_new_method_call(BLUEZ_SERVICE, path,
- BLUEZ_NETWORK_INTERFACE, CONNECT);
- if (!message)
- return -ENOMEM;
-
- dbus_message_set_auto_start(message, FALSE);
-
- dbus_message_append_args(message, DBUS_TYPE_STRING, &uuid,
- DBUS_TYPE_INVALID);
-
- if (!dbus_connection_send_with_reply(connection, message,
- &call, TIMEOUT * 10)) {
- connman_error("Failed to connect service");
- dbus_message_unref(message);
- return -EINVAL;
- }
-
- if (!call) {
- connman_error("D-Bus connection not available");
- dbus_message_unref(message);
- return -EINVAL;
- }
-
- dbus_pending_call_set_notify(call, connect_reply, g_strdup(path),
- g_free);
-
- dbus_message_unref(message);
-
- return -EINPROGRESS;
-}
-
-static void disconnect_reply(DBusPendingCall *call, void *user_data)
-{
- char *path = user_data;
- struct connman_network *network;
- DBusMessage *reply;
- DBusError error;
-
- network = g_hash_table_lookup(bluetooth_networks, path);
- if (!network)
- return;
-
- DBG("network %p", network);
-
- reply = dbus_pending_call_steal_reply(call);
-
- dbus_error_init(&error);
-
- if (dbus_set_error_from_message(&error, reply)) {
- connman_error("%s", error.message);
- dbus_error_free(&error);
- goto done;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID)) {
- if (dbus_error_is_set(&error)) {
- connman_error("%s", error.message);
- dbus_error_free(&error);
- } else
- connman_error("Wrong arguments for disconnect");
- goto done;
- }
-
- connman_network_set_connected(network, false);
-
-done:
- dbus_message_unref(reply);
-
- dbus_pending_call_unref(call);
-
- connman_network_unref(network);
-}
-
-static int pan_disconnect(struct connman_network *network)
-{
- const char *path = connman_network_get_string(network, "Path");
- DBusMessage *message;
- DBusPendingCall *call;
-
- DBG("network %p", network);
-
- if (!path)
- return -EINVAL;
-
- message = dbus_message_new_method_call(BLUEZ_SERVICE, path,
- BLUEZ_NETWORK_INTERFACE, DISCONNECT);
- if (!message)
- return -ENOMEM;
-
- dbus_message_set_auto_start(message, FALSE);
-
- dbus_message_append_args(message, DBUS_TYPE_INVALID);
-
- if (!dbus_connection_send_with_reply(connection, message,
- &call, TIMEOUT)) {
- connman_error("Failed to disconnect service");
- dbus_message_unref(message);
- return -EINVAL;
- }
-
- if (!call) {
- connman_error("D-Bus connection not available");
- dbus_message_unref(message);
- return -EINVAL;
- }
-
- connman_network_ref(network);
-
- connman_network_set_associating(network, false);
-
- dbus_pending_call_set_notify(call, disconnect_reply, g_strdup(path),
- g_free);
-
- dbus_message_unref(message);
-
- return 0;
-}
-
-static struct connman_network_driver pan_driver = {
- .name = "bluetooth_legacy-pan",
- .type = CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN,
- .priority = CONNMAN_NETWORK_PRIORITY_LOW,
- .probe = pan_probe,
- .remove = pan_remove,
- .connect = pan_connect,
- .disconnect = pan_disconnect,
-};
-
-static gboolean network_changed(DBusConnection *conn,
- DBusMessage *message, void *user_data)
-{
- const char *path = dbus_message_get_path(message);
- struct connman_network *network;
- DBusMessageIter iter, value;
- const char *key;
-
- DBG("path %s", path);
-
- network = g_hash_table_lookup(bluetooth_networks, path);
- if (!network)
- return TRUE;
-
- if (!dbus_message_iter_init(message, &iter))
- return TRUE;
-
- dbus_message_iter_get_basic(&iter, &key);
-
- dbus_message_iter_next(&iter);
- dbus_message_iter_recurse(&iter, &value);
-
- if (g_str_equal(key, "Connected")) {
- dbus_bool_t connected;
-
- dbus_message_iter_get_basic(&value, &connected);
-
- if (connected)
- return TRUE;
-
- connman_network_set_associating(network, false);
- connman_network_set_connected(network, false);
- }
-
- return TRUE;
-}
-
-static void extract_properties(DBusMessage *reply, const char **parent,
- const char **address,
- const char **name,
- const char **alias,
- dbus_bool_t *powered,
- dbus_bool_t *scanning,
- DBusMessageIter *uuids,
- DBusMessageIter *networks)
-{
- DBusMessageIter array, dict;
-
- if (!dbus_message_iter_init(reply, &array))
- return;
-
- if (dbus_message_iter_get_arg_type(&array) != DBUS_TYPE_ARRAY)
- return;
-
- dbus_message_iter_recurse(&array, &dict);
-
- while (dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_DICT_ENTRY) {
- DBusMessageIter entry, value;
- const char *key;
-
- dbus_message_iter_recurse(&dict, &entry);
- dbus_message_iter_get_basic(&entry, &key);
-
- dbus_message_iter_next(&entry);
- dbus_message_iter_recurse(&entry, &value);
-
- if (g_str_equal(key, "Adapter")) {
- if (parent)
- dbus_message_iter_get_basic(&value, parent);
- } else if (g_str_equal(key, "Address")) {
- if (address)
- dbus_message_iter_get_basic(&value, address);
- } else if (g_str_equal(key, "Name")) {
- if (name)
- dbus_message_iter_get_basic(&value, name);
- } else if (g_str_equal(key, "Alias")) {
- if (alias)
- dbus_message_iter_get_basic(&value, alias);
- } else if (g_str_equal(key, "Powered")) {
- if (powered)
- dbus_message_iter_get_basic(&value, powered);
- } else if (g_str_equal(key, "Discovering")) {
- if (scanning)
- dbus_message_iter_get_basic(&value, scanning);
- } else if (g_str_equal(key, "Devices")) {
- if (networks)
- memcpy(networks, &value, sizeof(value));
- } else if (g_str_equal(key, "UUIDs")) {
- if (uuids)
- memcpy(uuids, &value, sizeof(value));
- }
-
- dbus_message_iter_next(&dict);
- }
-}
-
-static dbus_bool_t has_pan(DBusMessageIter *array)
-{
- DBusMessageIter value;
-
- if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)
- return FALSE;
-
- dbus_message_iter_recurse(array, &value);
-
- while (dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_STRING) {
- const char *uuid;
-
- dbus_message_iter_get_basic(&value, &uuid);
-
- if (g_strcmp0(uuid, UUID_NAP) == 0)
- return TRUE;
-
- dbus_message_iter_next(&value);
- }
-
- return FALSE;
-}
-
-static void network_properties_reply(DBusPendingCall *call, void *user_data)
-{
- char *path = user_data;
- struct connman_device *device;
- struct connman_network *network;
- DBusMessage *reply;
- DBusMessageIter uuids;
- const char *parent = NULL, *address = NULL, *name = NULL;
- struct ether_addr addr;
- char ident[13];
-
- reply = dbus_pending_call_steal_reply(call);
-
- extract_properties(reply, &parent, &address, NULL, &name,
- NULL, NULL, &uuids, NULL);
-
- if (!parent)
- goto done;
-
- device = g_hash_table_lookup(bluetooth_devices, parent);
- if (!device)
- goto done;
-
- if (!address)
- goto done;
-
- ether_aton_r(address, &addr);
-
- snprintf(ident, 13, "%02x%02x%02x%02x%02x%02x",
- addr.ether_addr_octet[0],
- addr.ether_addr_octet[1],
- addr.ether_addr_octet[2],
- addr.ether_addr_octet[3],
- addr.ether_addr_octet[4],
- addr.ether_addr_octet[5]);
-
- if (!has_pan(&uuids))
- goto done;
-
- network = connman_device_get_network(device, ident);
- if (network)
- goto done;
-
- network = connman_network_create(ident,
- CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN);
- if (!network)
- goto done;
-
- connman_network_set_string(network, "Path", path);
-
- connman_network_set_name(network, name);
-
- g_hash_table_replace(bluetooth_networks, g_strdup(path), network);
-
- connman_device_add_network(device, network);
-
- connman_network_set_group(network, ident);
-
-done:
- dbus_message_unref(reply);
-
- dbus_pending_call_unref(call);
-}
-
-static void add_network(const char *path)
-{
- DBusMessage *message;
- DBusPendingCall *call;
-
- DBG("path %s", path);
-
- message = dbus_message_new_method_call(BLUEZ_SERVICE, path,
- BLUEZ_DEVICE_INTERFACE, GET_PROPERTIES);
- if (!message)
- return;
-
- dbus_message_set_auto_start(message, FALSE);
-
- if (!dbus_connection_send_with_reply(connection, message,
- &call, TIMEOUT)) {
- connman_error("Failed to get network properties for %s", path);
- goto done;
- }
-
- if (!call) {
- connman_error("D-Bus connection not available");
- goto done;
- }
-
- dbus_pending_call_set_notify(call, network_properties_reply,
- g_strdup(path), g_free);
-
-done:
- dbus_message_unref(message);
-}
-
-static void check_networks(DBusMessageIter *array)
-{
- DBusMessageIter value;
-
- if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)
- return;
-
- dbus_message_iter_recurse(array, &value);
-
- while (dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_OBJECT_PATH) {
- const char *path;
-
- dbus_message_iter_get_basic(&value, &path);
-
- add_network(path);
-
- dbus_message_iter_next(&value);
- }
-}
-
-static void check_pending_networks(const char *adapter)
-{
- GSList *networks, *list;
-
- networks = g_hash_table_lookup(pending_networks, adapter);
- if (!networks)
- return;
-
- for (list = networks; list; list = list->next) {
- char *path = list->data;
-
- add_network(path);
- }
-
- g_hash_table_remove(pending_networks, adapter);
-}
-
-static gboolean adapter_changed(DBusConnection *conn,
- DBusMessage *message, void *user_data)
-{
- const char *path = dbus_message_get_path(message);
- struct connman_device *device;
- DBusMessageIter iter, value;
- const char *key;
-
- DBG("path %s", path);
-
- device = g_hash_table_lookup(bluetooth_devices, path);
- if (!device)
- return TRUE;
-
- if (!dbus_message_iter_init(message, &iter))
- return TRUE;
-
- dbus_message_iter_get_basic(&iter, &key);
-
- dbus_message_iter_next(&iter);
- dbus_message_iter_recurse(&iter, &value);
-
- if (g_str_equal(key, "Powered")) {
- dbus_bool_t val;
-
- dbus_message_iter_get_basic(&value, &val);
- connman_device_set_powered(device, val);
- if (val)
- check_pending_networks(path);
- } else if (g_str_equal(key, "Discovering")) {
- dbus_bool_t val;
-
- dbus_message_iter_get_basic(&value, &val);
- connman_device_set_scanning(device,
- CONNMAN_SERVICE_TYPE_BLUETOOTH, val);
- } else if (g_str_equal(key, "Devices")) {
- check_networks(&value);
- }
-
- return TRUE;
-}
-
-static gboolean device_removed(DBusConnection *conn,
- DBusMessage *message, void *user_data)
-{
- const char *network_path;
- struct connman_network *network;
- struct connman_device *device;
- DBusMessageIter iter;
-
- DBG("");
-
- if (!dbus_message_iter_init(message, &iter))
- return TRUE;
-
- dbus_message_iter_get_basic(&iter, &network_path);
-
- network = g_hash_table_lookup(bluetooth_networks, network_path);
- if (!network)
- return TRUE;
-
- device = connman_network_get_device(network);
- if (!device)
- return TRUE;
-
- g_hash_table_remove(bluetooth_networks, network_path);
-
- return TRUE;
-}
-
-static gboolean device_changed(DBusConnection *conn,
- DBusMessage *message, void *user_data)
-{
- const char *path = dbus_message_get_path(message);
- DBusMessageIter iter, value;
- const char *key;
-
- DBG("path %s", path);
-
- if (!dbus_message_iter_init(message, &iter))
- return TRUE;
-
- dbus_message_iter_get_basic(&iter, &key);
-
- dbus_message_iter_next(&iter);
- dbus_message_iter_recurse(&iter, &value);
-
- DBG("key %s", key);
-
- if (g_str_equal(key, "UUIDs"))
- add_network(path);
-
- return TRUE;
-}
-
-static void remove_device_networks(struct connman_device *device)
-{
- GHashTableIter iter;
- gpointer key, value;
- GSList *key_list = NULL;
- GSList *list;
-
- if (!bluetooth_networks)
- return;
-
- g_hash_table_iter_init(&iter, bluetooth_networks);
-
- while (g_hash_table_iter_next(&iter, &key, &value)) {
- struct connman_network *network = value;
-
- if (connman_network_get_device(network) != device)
- continue;
-
- key_list = g_slist_prepend(key_list, key);
- }
-
- for (list = key_list; list; list = list->next) {
- const char *network_path = list->data;
-
- g_hash_table_remove(bluetooth_networks, network_path);
- }
-
- g_slist_free(key_list);
-}
-
-static void add_pending_networks(const char *adapter, DBusMessageIter *array)
-{
- DBusMessageIter value;
- GSList *list = NULL;
-
- if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)
- return;
-
- dbus_message_iter_recurse(array, &value);
-
- while (dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_OBJECT_PATH) {
- const char *path;
-
- dbus_message_iter_get_basic(&value, &path);
-
- list = g_slist_prepend(list, g_strdup(path));
-
- dbus_message_iter_next(&value);
- }
-
- if (!list)
- return;
-
- g_hash_table_replace(pending_networks, g_strdup(adapter), list);
-}
-
-static void adapter_properties_reply(DBusPendingCall *call, void *user_data)
-{
- char *path = user_data;
- struct connman_device *device;
- DBusMessage *reply;
- DBusMessageIter networks;
- const char *address = NULL, *name = NULL;
- dbus_bool_t powered = FALSE, scanning = FALSE;
- struct ether_addr addr;
- char ident[13];
-
- DBG("path %s", path);
-
- reply = dbus_pending_call_steal_reply(call);
-
- if (!path)
- goto done;
-
- extract_properties(reply, NULL, &address, &name, NULL,
- &powered, &scanning, NULL, &networks);
-
- if (!address)
- goto done;
-
- if (g_strcmp0(address, "00:00:00:00:00:00") == 0)
- goto done;
-
- device = g_hash_table_lookup(bluetooth_devices, path);
- if (device)
- goto update;
-
- ether_aton_r(address, &addr);
-
- snprintf(ident, 13, "%02x%02x%02x%02x%02x%02x",
- addr.ether_addr_octet[0],
- addr.ether_addr_octet[1],
- addr.ether_addr_octet[2],
- addr.ether_addr_octet[3],
- addr.ether_addr_octet[4],
- addr.ether_addr_octet[5]);
-
- device = connman_device_create("bluetooth_legacy",
- CONNMAN_DEVICE_TYPE_BLUETOOTH);
- if (!device)
- goto done;
-
- g_hash_table_insert(bluetooth_devices, g_strdup(path), device);
-
- connman_device_set_ident(device, ident);
-
- connman_device_set_string(device, "Path", path);
-
- if (connman_device_register(device) < 0) {
- connman_device_unref(device);
- g_hash_table_remove(bluetooth_devices, path);
- goto done;
- }
-
-update:
- connman_device_set_string(device, "Address", address);
- connman_device_set_string(device, "Name", name);
- connman_device_set_string(device, "Path", path);
-
- connman_device_set_powered(device, powered);
- connman_device_set_scanning(device,
- CONNMAN_SERVICE_TYPE_BLUETOOTH, scanning);
-
- if (!powered) {
- remove_device_networks(device);
- add_pending_networks(path, &networks);
- } else
- check_networks(&networks);
-
-done:
- dbus_message_unref(reply);
-
- dbus_pending_call_unref(call);
-}
-
-static void add_adapter(DBusConnection *conn, const char *path)
-{
- DBusMessage *message;
- DBusPendingCall *call;
-
- DBG("path %s", path);
-
- message = dbus_message_new_method_call(BLUEZ_SERVICE, path,
- BLUEZ_ADAPTER_INTERFACE, GET_PROPERTIES);
- if (!message)
- return;
-
- dbus_message_set_auto_start(message, FALSE);
-
- if (!dbus_connection_send_with_reply(conn, message, &call, TIMEOUT)) {
- connman_error("Failed to get adapter properties for %s", path);
- goto done;
- }
-
- if (!call) {
- connman_error("D-Bus connection not available");
- goto done;
- }
-
- dbus_pending_call_set_notify(call, adapter_properties_reply,
- g_strdup(path), g_free);
-
-done:
- dbus_message_unref(message);
-}
-
-static gboolean adapter_added(DBusConnection *conn, DBusMessage *message,
- void *user_data)
-{
- const char *path;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID);
- add_adapter(conn, path);
- return TRUE;
-}
-
-static void remove_adapter(DBusConnection *conn, const char *path)
-{
- DBG("path %s", path);
-
- g_hash_table_remove(bluetooth_devices, path);
- g_hash_table_remove(pending_networks, path);
-}
-
-static gboolean adapter_removed(DBusConnection *conn, DBusMessage *message,
- void *user_data)
-{
- const char *path;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID);
- remove_adapter(conn, path);
- return TRUE;
-}
-
-static void list_adapters_reply(DBusPendingCall *call, void *user_data)
-{
- DBusMessage *reply;
- DBusError error;
- char **adapters;
- int i, num_adapters;
-
- DBG("");
-
- reply = dbus_pending_call_steal_reply(call);
-
- dbus_error_init(&error);
-
- if (dbus_set_error_from_message(&error, reply)) {
- connman_error("%s", error.message);
- dbus_error_free(&error);
- goto done;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_ARRAY,
- DBUS_TYPE_OBJECT_PATH, &adapters,
- &num_adapters, DBUS_TYPE_INVALID)) {
- if (dbus_error_is_set(&error)) {
- connman_error("%s", error.message);
- dbus_error_free(&error);
- } else
- connman_error("Wrong arguments for adapter list");
- goto done;
- }
-
- for (i = 0; i < num_adapters; i++)
- add_adapter(connection, adapters[i]);
-
- g_strfreev(adapters);
-
-done:
- dbus_message_unref(reply);
-
- dbus_pending_call_unref(call);
-}
-
-static void unregister_device(gpointer data)
-{
- struct connman_device *device = data;
-
- DBG("");
-
- remove_device_networks(device);
-
- connman_device_unregister(device);
- connman_device_unref(device);
-}
-
-static void remove_network(gpointer data)
-{
- struct connman_network *network = data;
- struct connman_device *device;
-
- DBG("network %p", network);
-
- device = connman_network_get_device(network);
- if (device)
- connman_device_remove_network(device, network);
-
- connman_network_unref(network);
-}
-
-static void remove_pending_networks(gpointer data)
-{
- GSList *list = data;
-
- g_slist_free_full(list, g_free);
-}
-
-static void bluetooth_connect(DBusConnection *conn, void *user_data)
-{
- DBusMessage *message;
- DBusPendingCall *call;
-
- DBG("connection %p", conn);
-
- bluetooth_devices = g_hash_table_new_full(g_str_hash, g_str_equal,
- g_free, unregister_device);
-
- bluetooth_networks = g_hash_table_new_full(g_str_hash, g_str_equal,
- g_free, remove_network);
-
- pending_networks = g_hash_table_new_full(g_str_hash, g_str_equal,
- g_free, remove_pending_networks);
-
- message = dbus_message_new_method_call(BLUEZ_SERVICE, "/",
- BLUEZ_MANAGER_INTERFACE, LIST_ADAPTERS);
- if (!message)
- return;
-
- dbus_message_set_auto_start(message, FALSE);
-
- if (!dbus_connection_send_with_reply(conn, message, &call, TIMEOUT)) {
- connman_error("Failed to get Bluetooth adapters");
- goto done;
- }
-
- if (!call) {
- connman_error("D-Bus connection not available");
- goto done;
- }
-
- dbus_pending_call_set_notify(call, list_adapters_reply, NULL, NULL);
-
-done:
- dbus_message_unref(message);
-}
-
-static void bluetooth_disconnect(DBusConnection *conn, void *user_data)
-{
- DBG("connection %p", conn);
-
- if (!bluetooth_devices)
- return;
-
- g_hash_table_destroy(bluetooth_networks);
- bluetooth_networks = NULL;
- g_hash_table_destroy(bluetooth_devices);
- bluetooth_devices = NULL;
- g_hash_table_destroy(pending_networks);
- pending_networks = NULL;
-}
-
-static int bluetooth_probe(struct connman_device *device)
-{
- GHashTableIter iter;
- gpointer key, value;
-
- DBG("device %p", device);
-
- if (!bluetooth_devices)
- return -ENOTSUP;
-
- g_hash_table_iter_init(&iter, bluetooth_devices);
-
- while (g_hash_table_iter_next(&iter, &key, &value)) {
- struct connman_device *device_pan = value;
-
- if (device == device_pan)
- return 0;
- }
-
- return -ENOTSUP;
-}
-
-static void bluetooth_remove(struct connman_device *device)
-{
- DBG("device %p", device);
-}
-
-static void powered_reply(DBusPendingCall *call, void *user_data)
-{
- DBusError error;
- DBusMessage *reply;
-
- DBG("");
-
- reply = dbus_pending_call_steal_reply(call);
-
- dbus_error_init(&error);
-
- if (dbus_set_error_from_message(&error, reply)) {
- connman_error("%s", error.message);
- dbus_error_free(&error);
- dbus_message_unref(reply);
- dbus_pending_call_unref(call);
- return;
- }
-
- dbus_message_unref(reply);
- dbus_pending_call_unref(call);
-
- add_adapter(connection, user_data);
-}
-
-static int change_powered(DBusConnection *conn, const char *path,
- dbus_bool_t powered)
-{
- DBusMessage *message;
- DBusMessageIter iter;
- DBusPendingCall *call;
-
- DBG("");
-
- if (!path)
- return -EINVAL;
-
- message = dbus_message_new_method_call(BLUEZ_SERVICE, path,
- BLUEZ_ADAPTER_INTERFACE, SET_PROPERTY);
- if (!message)
- return -ENOMEM;
-
- dbus_message_set_auto_start(message, FALSE);
-
- dbus_message_iter_init_append(message, &iter);
- connman_dbus_property_append_basic(&iter, "Powered",
- DBUS_TYPE_BOOLEAN, &powered);
-
- if (!dbus_connection_send_with_reply(conn, message, &call, TIMEOUT)) {
- connman_error("Failed to change Powered property");
- dbus_message_unref(message);
- return -EINVAL;
- }
-
- if (!call) {
- connman_error("D-Bus connection not available");
- dbus_message_unref(message);
- return -EINVAL;
- }
-
- dbus_pending_call_set_notify(call, powered_reply,
- g_strdup(path), g_free);
-
- dbus_message_unref(message);
-
- return -EINPROGRESS;
-}
-
-static int bluetooth_enable(struct connman_device *device)
-{
- const char *path = connman_device_get_string(device, "Path");
-
- DBG("device %p", device);
-
- return change_powered(connection, path, TRUE);
-}
-
-static int bluetooth_disable(struct connman_device *device)
-{
- const char *path = connman_device_get_string(device, "Path");
-
- DBG("device %p", device);
-
- return change_powered(connection, path, FALSE);
-}
-
-static struct connman_device_driver bluetooth_driver = {
- .name = "bluetooth_legacy",
- .type = CONNMAN_DEVICE_TYPE_BLUETOOTH,
- .probe = bluetooth_probe,
- .remove = bluetooth_remove,
- .enable = bluetooth_enable,
- .disable = bluetooth_disable,
-};
-
-static int tech_probe(struct connman_technology *technology)
-{
- return 0;
-}
-
-static void tech_remove(struct connman_technology *technology)
-{
-}
-
-static void server_register_reply(DBusPendingCall *call, void *user_data)
-{
- struct connman_technology *technology = user_data;
- DBusError error;
- DBusMessage *reply;
-
- DBG("");
-
- reply = dbus_pending_call_steal_reply(call);
-
- dbus_error_init(&error);
-
- if (dbus_set_error_from_message(&error, reply)) {
- connman_error("%s", error.message);
- dbus_error_free(&error);
- dbus_message_unref(reply);
- dbus_pending_call_unref(call);
- return;
- }
-
- dbus_message_unref(reply);
- dbus_pending_call_unref(call);
-
- connman_technology_tethering_notify(technology, true);
-}
-
-static void server_unregister_reply(DBusPendingCall *call, void *user_data)
-{
- struct connman_technology *technology = user_data;
- DBusError error;
- DBusMessage *reply;
-
- DBG("");
-
- reply = dbus_pending_call_steal_reply(call);
-
- dbus_error_init(&error);
-
- if (dbus_set_error_from_message(&error, reply)) {
- connman_error("%s", error.message);
- dbus_error_free(&error);
- dbus_message_unref(reply);
- dbus_pending_call_unref(call);
- return;
- }
-
- dbus_message_unref(reply);
- dbus_pending_call_unref(call);
-
- connman_technology_tethering_notify(technology, false);
-}
-
-
-static void server_register(const char *path, const char *uuid,
- struct connman_technology *technology,
- const char *bridge, bool enabled)
-{
- DBusMessage *message;
- DBusPendingCall *call;
- char *command;
-
- DBG("path %s enabled %d", path, enabled);
-
- command = enabled ? REGISTER : UNREGISTER;
-
- message = dbus_message_new_method_call(BLUEZ_SERVICE, path,
- BLUEZ_NETWORK_SERVER, command);
- if (!message)
- return;
-
- dbus_message_set_auto_start(message, FALSE);
-
- dbus_message_append_args(message, DBUS_TYPE_STRING, &uuid,
- DBUS_TYPE_INVALID);
-
- if (enabled)
- dbus_message_append_args(message, DBUS_TYPE_STRING, &bridge,
- DBUS_TYPE_INVALID);
-
- if (!dbus_connection_send_with_reply(connection, message,
- &call, TIMEOUT)) {
- connman_error("Failed to enable PAN server");
- dbus_message_unref(message);
- return;
- }
-
- if (!call) {
- connman_error("D-Bus connection not available");
- dbus_message_unref(message);
- return;
- }
-
- if (enabled)
- dbus_pending_call_set_notify(call, server_register_reply,
- technology, NULL);
- else
- dbus_pending_call_set_notify(call, server_unregister_reply,
- technology, NULL);
-
- dbus_message_unref(message);
-}
-
-struct tethering_info {
- struct connman_technology *technology;
- const char *bridge;
-};
-
-static void enable_nap(gpointer key, gpointer value, gpointer user_data)
-{
- struct tethering_info *info = user_data;
- struct connman_device *device = value;
- const char *path;
-
- DBG("");
-
- path = connman_device_get_string(device, "Path");
-
- server_register(path, "nap", info->technology, info->bridge, true);
-}
-
-static void disable_nap(gpointer key, gpointer value, gpointer user_data)
-{
- struct tethering_info *info = user_data;
- struct connman_device *device = value;
- const char *path;
-
- DBG("");
-
- path = connman_device_get_string(device, "Path");
-
- server_register(path, "nap", info->technology, info->bridge, false);
-}
-
-static int tech_set_tethering(struct connman_technology *technology,
- const char *identifier, const char *passphrase,
- const char *bridge, bool enabled)
-{
- struct tethering_info info = {
- .technology = technology,
- .bridge = bridge,
- };
-
- DBG("bridge %s", bridge);
-
- if (!bluetooth_devices)
- return -ENOTCONN;
-
- if (enabled)
- g_hash_table_foreach(bluetooth_devices, enable_nap, &info);
- else
- g_hash_table_foreach(bluetooth_devices, disable_nap, &info);
-
- return 0;
-}
-
-static struct connman_technology_driver tech_driver = {
- .name = "bluetooth_legacy",
- .type = CONNMAN_SERVICE_TYPE_BLUETOOTH,
- .priority = -10,
- .probe = tech_probe,
- .remove = tech_remove,
- .set_tethering = tech_set_tethering,
-};
-
-static guint watch;
-static guint added_watch;
-static guint removed_watch;
-static guint adapter_watch;
-static guint device_watch;
-static guint device_removed_watch;
-static guint network_watch;
-
-static int bluetooth_init(void)
-{
- int err;
-
- connection = connman_dbus_get_connection();
- if (!connection)
- return -EIO;
-
- watch = g_dbus_add_service_watch(connection, BLUEZ_SERVICE,
- bluetooth_connect, bluetooth_disconnect, NULL, NULL);
-
- added_watch = g_dbus_add_signal_watch(connection, BLUEZ_SERVICE, NULL,
- BLUEZ_MANAGER_INTERFACE,
- ADAPTER_ADDED, adapter_added,
- NULL, NULL);
-
- removed_watch = g_dbus_add_signal_watch(connection, BLUEZ_SERVICE, NULL,
- BLUEZ_MANAGER_INTERFACE,
- ADAPTER_REMOVED, adapter_removed,
- NULL, NULL);
-
- adapter_watch = g_dbus_add_signal_watch(connection, BLUEZ_SERVICE,
- NULL, BLUEZ_ADAPTER_INTERFACE,
- PROPERTY_CHANGED, adapter_changed,
- NULL, NULL);
-
- device_removed_watch = g_dbus_add_signal_watch(connection,
- BLUEZ_SERVICE, NULL,
- BLUEZ_ADAPTER_INTERFACE,
- DEVICE_REMOVED, device_removed,
- NULL, NULL);
-
- device_watch = g_dbus_add_signal_watch(connection, BLUEZ_SERVICE, NULL,
- BLUEZ_DEVICE_INTERFACE,
- PROPERTY_CHANGED, device_changed,
- NULL, NULL);
-
- network_watch = g_dbus_add_signal_watch(connection, BLUEZ_SERVICE,
- NULL, BLUEZ_NETWORK_INTERFACE,
- PROPERTY_CHANGED, network_changed,
- NULL, NULL);
-
- if (watch == 0 || added_watch == 0 || removed_watch == 0
- || adapter_watch == 0 || network_watch == 0
- || device_watch == 0
- || device_removed_watch == 0) {
- err = -EIO;
- goto remove;
- }
-
- err = connman_network_driver_register(&pan_driver);
- if (err < 0)
- goto remove;
-
- err = connman_device_driver_register(&bluetooth_driver);
- if (err < 0) {
- connman_network_driver_unregister(&pan_driver);
- goto remove;
- }
-
- err = connman_technology_driver_register(&tech_driver);
- if (err < 0) {
- connman_device_driver_unregister(&bluetooth_driver);
- connman_network_driver_unregister(&pan_driver);
- goto remove;
- }
-
- return 0;
-
-remove:
- g_dbus_remove_watch(connection, watch);
- g_dbus_remove_watch(connection, added_watch);
- g_dbus_remove_watch(connection, removed_watch);
- g_dbus_remove_watch(connection, adapter_watch);
- g_dbus_remove_watch(connection, device_removed_watch);
- g_dbus_remove_watch(connection, device_watch);
- g_dbus_remove_watch(connection, network_watch);
-
- dbus_connection_unref(connection);
-
- return err;
-}
-
-static void bluetooth_exit(void)
-{
- g_dbus_remove_watch(connection, watch);
- g_dbus_remove_watch(connection, added_watch);
- g_dbus_remove_watch(connection, removed_watch);
- g_dbus_remove_watch(connection, adapter_watch);
- g_dbus_remove_watch(connection, device_removed_watch);
- g_dbus_remove_watch(connection, device_watch);
- g_dbus_remove_watch(connection, network_watch);
-
- /*
- * We unset the disabling of the Bluetooth device when shutting down
- * so that non-PAN BT connections are not affected.
- */
- bluetooth_driver.disable = NULL;
-
- bluetooth_disconnect(connection, NULL);
-
- connman_technology_driver_unregister(&tech_driver);
-
- connman_device_driver_unregister(&bluetooth_driver);
- connman_network_driver_unregister(&pan_driver);
-
- dbus_connection_unref(connection);
-}
-
-CONNMAN_PLUGIN_DEFINE(bluetooth_legacy, "Bluetooth technology plugin (legacy)",
- VERSION, CONNMAN_PLUGIN_PRIORITY_LOW,
- bluetooth_init, bluetooth_exit)
--
2.1.4
6 years, 1 month
[PATCH] vpn: Add an optional configuration option to the VPN plugin for choosing the device type.
by Hendrik Donner
This allows to use virtual tap devices and removes the hardcoded default to
virtual tun devices.
Signed-off-by: Hendrik Donner <hendrik(a)rennod.org>
---
Only tested with OpenVPN. I have no idea if one of the other VPN plugins
would benefit from tap device support.
doc/connman-vpn-provider.config.5.in | 6 +++++-
doc/vpn-config-format.txt | 2 ++
vpn/plugins/openvpn.c | 2 +-
vpn/plugins/vpn.c | 18 ++++++++++++------
4 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/doc/connman-vpn-provider.config.5.in b/doc/connman-vpn-provider.config.5.in
index 5393260..c50fc46 100644
--- a/doc/connman-vpn-provider.config.5.in
+++ b/doc/connman-vpn-provider.config.5.in
@@ -48,12 +48,16 @@ VPN server IP address.
.BI Domain= domain
Domain name for the VPN service.
.TP
-The following field is optional:
+The following fields are optional:
.TP
.BI Networks= network / netmask / gateway [,...]
Networks behind the VPN. If all traffic should go through the VPN, this
field can be left out. The gateway can be left out. For IPv6 addresses,
only the prefix length is accepted as the netmask.
+.TP
+.BI DeviceType= tun \fR|\fB tap
+Whether the VPN should use a tun (OSI layer 3) or tap (OSI layer 2) device.
+Defaults to tun if omitted.
.SS OpenConnect
The following keys can be used for \fBopenconnect\fP(8) networks:
.TP
diff --git a/doc/vpn-config-format.txt b/doc/vpn-config-format.txt
index 1f5bac8..e33acfc 100644
--- a/doc/vpn-config-format.txt
+++ b/doc/vpn-config-format.txt
@@ -44,6 +44,8 @@ VPN related parameters (M = mandatory, O = optional):
is network/netmask/gateway. The gateway can be left out. (O)
Example: 192.168.100.0/24/10.1.0.1,192.168.200.0/255.255.255.0/10.1.0.2
For IPv6 addresses only prefix length is accepted like this 2001:db8::1/64
+- DeviceType: Whether the VPN should use a tun (OSI layer 3) or tap
+ (OSI layer 2) device. Value is "tun" (default) or "tap" (O)
OpenConnect VPN supports following options (see openconnect(8) for details):
Option name OpenConnect option Description
diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c
index 9ee5795..c920dc3 100644
--- a/vpn/plugins/openvpn.c
+++ b/vpn/plugins/openvpn.c
@@ -71,6 +71,7 @@ struct {
{ "OpenVPN.CompLZO", "--comp-lzo", 0 },
{ "OpenVPN.RemoteCertTls", "--remote-cert-tls", 1 },
{ "OpenVPN.ConfigFile", "--config", 1 },
+ { "DeviceType", "--dev-type", 1 },
};
struct nameserver_entry {
@@ -362,7 +363,6 @@ static int ov_connect(struct vpn_provider *provider,
connman_task_get_path(task));
connman_task_add_argument(task, "--dev", if_name);
- connman_task_add_argument(task, "--dev-type", "tun");
connman_task_add_argument(task, "--persist-tun", NULL);
diff --git a/vpn/plugins/vpn.c b/vpn/plugins/vpn.c
index 1b5af6e..a031c42 100644
--- a/vpn/plugins/vpn.c
+++ b/vpn/plugins/vpn.c
@@ -56,6 +56,7 @@ struct vpn_data {
unsigned int watch;
enum vpn_state state;
struct connman_task *task;
+ int tun_flags;
};
struct vpn_driver_data {
@@ -89,7 +90,7 @@ static int stop_vpn(struct vpn_provider *provider)
return 0;
memset(&ifr, 0, sizeof(ifr));
- ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
+ ifr.ifr_flags = data->tun_flags | IFF_NO_PI;
sprintf(ifr.ifr_name, "%s", data->if_name);
fd = open("/dev/net/tun", O_RDWR | O_CLOEXEC);
@@ -335,7 +336,7 @@ static DBusMessage *vpn_notify(struct connman_task *task,
return NULL;
}
-static int vpn_create_tun(struct vpn_provider *provider)
+static int vpn_create_tun(struct vpn_provider *provider, int flags)
{
struct vpn_data *data = vpn_provider_get_data(provider);
struct ifreq ifr;
@@ -355,7 +356,7 @@ static int vpn_create_tun(struct vpn_provider *provider)
}
memset(&ifr, 0, sizeof(ifr));
- ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
+ ifr.ifr_flags = flags | IFF_NO_PI;
for (i = 0; i < 256; i++) {
sprintf(ifr.ifr_name, "vpn%d", i);
@@ -371,6 +372,7 @@ static int vpn_create_tun(struct vpn_provider *provider)
goto exist_err;
}
+ data->tun_flags = flags;
data->if_name = (char *)g_strdup(ifr.ifr_name);
if (!data->if_name) {
connman_error("Failed to allocate memory");
@@ -411,8 +413,8 @@ static int vpn_connect(struct vpn_provider *provider,
{
struct vpn_data *data = vpn_provider_get_data(provider);
struct vpn_driver_data *vpn_driver_data;
- const char *name;
- int ret = 0;
+ const char *name, *tun;
+ int ret = 0, tun_flags = IFF_TUN;
enum vpn_state state = VPN_STATE_UNKNOWN;
if (data)
@@ -460,7 +462,11 @@ static int vpn_connect(struct vpn_provider *provider,
}
if (vpn_driver_data->vpn_driver->flags != VPN_FLAG_NO_TUN) {
- ret = vpn_create_tun(provider);
+ tun = vpn_provider_get_string(provider, "DeviceType");
+ if (g_str_equal(tun, "tap")) {
+ tun_flags = IFF_TAP;
+ }
+ ret = vpn_create_tun(provider, tun_flags);
if (ret < 0)
goto exist_err;
}
--
2.7.0
6 years, 2 months
[RFC] vpn: Restrict connman-vpnd capabilities
by Patrik Flykt
Have systemd set /home and /run/users read only as VPN certificates can
be stored also in these directories. Protect other directories in the
system by making also them read only. The directory options affect also
all VPN applications started by connman-vpnd.
Restrict capabilities to a subset necessary for normal operations.
---
ProtectSystem=full means the VPN applications cannot write anything to
/usr or /etc. Let's hope this works out for all VPN daemons.
Please test,
Patrik
vpn/connman-vpn.service.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/vpn/connman-vpn.service.in b/vpn/connman-vpn.service.in
index 120245e..e98fb71 100644
--- a/vpn/connman-vpn.service.in
+++ b/vpn/connman-vpn.service.in
@@ -6,6 +6,9 @@ Type=dbus
BusName=net.connman.vpn
ExecStart=@sbindir@/connman-vpnd -n
StandardOutput=null
+CapabilityBoundingSet=CAP_KILL CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
+ProtectHome=read-only
+ProtectSystem=full
[Install]
WantedBy=multi-user.target
--
2.1.4
6 years, 2 months
[RFC] service: Move service to state ready if defaultroute is removed
by Patrik Flykt
When the default route is removed, it is more than likely that the
corresponding service cannot be in state online anymore. Downgrade
the affected service state. This in turn will trigger a new online
check and resolve the state back to online if at all possible.
---
This might fix the issue with dhcp_failure() reported by Naveen Singh.
Please test!
Patrik
src/service.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/service.c b/src/service.c
index abf0899..3fa5ae5 100644
--- a/src/service.c
+++ b/src/service.c
@@ -6380,12 +6380,27 @@ static void service_ip_release(struct connman_ipconfig *ipconfig,
settings_changed(service, ipconfig);
}
-static void service_route_changed(struct connman_ipconfig *ipconfig,
+static void service_defaultroute_set(struct connman_ipconfig *ipconfig,
const char *ifname)
{
struct connman_service *service = __connman_ipconfig_get_data(ipconfig);
- DBG("%s route changed", ifname);
+ DBG("service %p %s defaultroute set", service, ifname);
+
+ settings_changed(service, ipconfig);
+}
+
+static void service_defaultroute_unset(struct connman_ipconfig *ipconfig,
+ const char *ifname)
+{
+ struct connman_service *service = __connman_ipconfig_get_data(ipconfig);
+
+ DBG("service %p %s defaultroute unset", service, ifname);
+
+ if (service->state == CONNMAN_SERVICE_STATE_ONLINE)
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_READY,
+ __connman_ipconfig_get_config_type(ipconfig));
settings_changed(service, ipconfig);
}
@@ -6397,8 +6412,8 @@ static const struct connman_ipconfig_ops service_ops = {
.lower_down = service_lower_down,
.ip_bound = service_ip_bound,
.ip_release = service_ip_release,
- .route_set = service_route_changed,
- .route_unset = service_route_changed,
+ .route_set = service_defaultroute_set,
+ .route_unset = service_defaultroute_unset,
};
static struct connman_ipconfig *create_ip4config(struct connman_service *service,
--
2.1.4
6 years, 2 months
[PATCH] gdhcp: use opened listening socket to send DHCP renew request
by Feng Wang
It fix DHCP ACK lost issue when doing DHCP renewal.
When doing DHCP renew, 2 sockets are opened. One is for
listening DHCP ACK, the other is for transmitting DHCP request
which is closed immediately after transmitting is done. But in
some cases, the socket is closed after the DHCP ACK is received.
The kernel will route the packet to the transmitting socket
because it has a better match result(dst ip/port etc). And the
packet was dropped when the socket was closed.
---
gdhcp/client.c | 6 ++++--
gdhcp/common.c | 60 +++++++++++++++++++++++++++++++++++-----------------------
gdhcp/common.h | 2 +-
3 files changed, 41 insertions(+), 27 deletions(-)
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 3bf8cb2..ad587b1 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -502,7 +502,8 @@ static int send_request(GDHCPClient *dhcp_client)
if (dhcp_client->state == RENEWING)
return dhcp_send_kernel_packet(&packet,
dhcp_client->requested_ip, CLIENT_PORT,
- dhcp_client->server_ip, SERVER_PORT);
+ dhcp_client->server_ip, SERVER_PORT,
+ dhcp_client->listener_sockfd);
return dhcp_send_raw_packet(&packet, INADDR_ANY, CLIENT_PORT,
INADDR_BROADCAST, SERVER_PORT,
@@ -526,7 +527,8 @@ static int send_release(GDHCPClient *dhcp_client,
dhcp_add_option_uint32(&packet, DHCP_SERVER_ID, server);
return dhcp_send_kernel_packet(&packet, ciaddr, CLIENT_PORT,
- server, SERVER_PORT);
+ server, SERVER_PORT,
+ dhcp_client->listener_sockfd);
}
static gboolean ipv4ll_probe_timeout(gpointer dhcp_data);
diff --git a/gdhcp/common.c b/gdhcp/common.c
index f3d4677..f0a9aa6 100644
--- a/gdhcp/common.c
+++ b/gdhcp/common.c
@@ -626,44 +626,56 @@ int dhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt,
int dhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
uint32_t source_ip, int source_port,
- uint32_t dest_ip, int dest_port)
+ uint32_t dest_ip, int dest_port, int fd)
{
struct sockaddr_in client;
- int fd, n, opt = 1;
+ int n, opt = 1;
enum {
DHCP_SIZE = sizeof(struct dhcp_packet) -
EXTEND_FOR_BUGGY_SERVERS,
};
- fd = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP);
- if (fd < 0)
- return -errno;
+ if (fd < 0) {
+ /* no socket opened, open a new socket to tx the packet and close it */
+ fd = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP);
+ if (fd < 0)
+ return -errno;
+
+ setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+
+ memset(&client, 0, sizeof(client));
+ client.sin_family = AF_INET;
+ client.sin_port = htons(source_port);
+ client.sin_addr.s_addr = htonl(source_ip);
+ if (bind(fd, (struct sockaddr *) &client, sizeof(client)) < 0) {
+ close(fd);
+ return -errno;
+ }
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+ memset(&client, 0, sizeof(client));
+ client.sin_family = AF_INET;
+ client.sin_port = htons(dest_port);
+ client.sin_addr.s_addr = htonl(dest_ip);
+ if (connect(fd, (struct sockaddr *) &client, sizeof(client)) < 0) {
+ close(fd);
+ return -errno;
+ }
- memset(&client, 0, sizeof(client));
- client.sin_family = AF_INET;
- client.sin_port = htons(source_port);
- client.sin_addr.s_addr = htonl(source_ip);
- if (bind(fd, (struct sockaddr *) &client, sizeof(client)) < 0) {
- close(fd);
- return -errno;
- }
+ n = write(fd, dhcp_pkt, DHCP_SIZE);
- memset(&client, 0, sizeof(client));
- client.sin_family = AF_INET;
- client.sin_port = htons(dest_port);
- client.sin_addr.s_addr = htonl(dest_ip);
- if (connect(fd, (struct sockaddr *) &client, sizeof(client)) < 0) {
close(fd);
- return -errno;
+ } else {
+ /* Using existed socket to transmit the packet */
+ memset(&client, 0, sizeof(client));
+ client.sin_family = AF_INET;
+ client.sin_port = htons(dest_port);
+ client.sin_addr.s_addr = htonl(dest_ip);
+
+ n = sendto(fd, dhcp_pkt, DHCP_SIZE, MSG_DONTWAIT,
+ (struct sockaddr *) &client, sizeof(client));
}
- n = write(fd, dhcp_pkt, DHCP_SIZE);
-
- close(fd);
-
if (n < 0)
return -errno;
diff --git a/gdhcp/common.h b/gdhcp/common.h
index 75abc18..b92d214 100644
--- a/gdhcp/common.h
+++ b/gdhcp/common.h
@@ -209,7 +209,7 @@ int dhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt,
int dhcpv6_send_packet(int index, struct dhcpv6_packet *dhcp_pkt, int len);
int dhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
uint32_t source_ip, int source_port,
- uint32_t dest_ip, int dest_port);
+ uint32_t dest_ip, int dest_port, int fd);
int dhcp_l3_socket(int port, const char *interface, int family);
int dhcp_recv_l3_packet(struct dhcp_packet *packet, int fd);
int dhcpv6_recv_l3_packet(struct dhcpv6_packet **packet, unsigned char *buf,
--
2.7.0.rc3.207.g0ac5344
6 years, 3 months
[PATCH] gdhcp: use opened listening socket to send DHCP renew request
by Feng Wang
DHCP Renew Failure:
When connmand doing DHCP renew, we found out sometimes the DHCP ACK was lost.
But the DHCP ACK packet was received in the IP layer. The tcpdump shows the packet,
but the packet isn't passed to the glib and connmand.
Failure Reason:
The packet was routed to the wrong socket. Connmand created 2 sockets to do the DHCP renew.
One is for listening the received DHCP ACK(dhcp_l3_socket), the other is to transmit the
DHCP request(dhcp_send_kernel_packet). The transmit socket is closed immediately when the
request is transmitted. Normally, the socket is closed before DHCP ACK is received, so the
DHCP ACK is routed to the listening socket. But when adding some debug information in the kernel,
we found in some cases, the socket was closed after DHCP ACK arrived. In this case, the packet
was routed to the transmitting socket, because it has a better match result. But the connmand
only listen on the listening socket, and this packet was dropped when the socket was closed.
Proposed Fix:
Use one socket to listen and transmit similar to NTP implementation. When doing the DHCP renew,
use the listening socket to transmit request. The new code will create a new socket if no socket
opened(current code) in the DHCP release case, else it will use existing socket in the DHCP renew case.
I attached the patch in the next email.
6 years, 3 months
Fwd: observed memory leak in wpa_supplicant
by Naveen Singh
Hi All
This is the response that I got from hostapd community about the proposed
fix for memory leak.
Regards
Naveen
---------- Forwarded message ----------
From: Dan Williams <dcbw(a)redhat.com>
Date: Thu, Jan 28, 2016 at 8:21 AM
Subject: Re: observed memory leak in wpa_supplicant
To: Naveen Singh <naveensingh0977(a)gmail.com>, hostap(a)lists.infradead.org
On Wed, 2016-01-27 at 22:06 -0800, Naveen Singh wrote:
> Hi All
> We have been running some stress test of sending a deauth with reason
> code 6 and 7 from an AP to an associated client and monitoring the
> memory usage of wpa_supplicant. In our setup wpa_supplicant talks to
> connman over dbus. Running this stress test reveals memory leak in
> wpa
> supplicant (memory usage of wpa supplicant keeps on growing).
>
> For connection after getting disconnected connman does "AddNetwork"
> DBUS call to the previously connected SSID. This ends up causing
> memory to be allocated for struct wpa_ssid (os_zalloc called). At
> this
> time there is already a structure allocated for same SSID as a result
> of previous connection. Every connection ends up creating a memory
> which is never freed.
>
> This surely causes memory usage of wpa_supplicant to go up. Should
> not
> we be allocating memory only if that profile (for that SSID does not
> exist?)
The AddNetwork D-Bus call creates a new network configuration (eg, a
wpa_ssid). It is the responsibility of the thing calling AddNetwork
(eg, connman) to track what network configurations it has already added
and to remove them when they are no longer in use.
Continuously calling AddNetwork without ever removing networks
previously created with AddNetwork would certainly lead to a memory
leak, but that is mis-use of the supplicant's API.
Connman does call RemoveNetwork when the internal network object is
disconnected, but that can happen in any number of cases. I'd suggest
filing a bug with the Connman team to see if they can track it down.
Dan
> I am talking about this function:struct wpa_ssid *
> wpa_config_add_network(struct wpa_config *config)
> {
> int id;
> struct wpa_ssid *ssid, *last = NULL;
>
> id = -1;
> ssid = config->ssid;
> while (ssid) {
> wpa_printf(MSG_ERROR, "wpa_config_add_network existing ssid
> is
> %p", ssid);
> if (ssid->id > id)
> id = ssid->id;
> last = ssid;
> ssid = ssid->next;
> }
> id++;
>
> ssid = os_zalloc(sizeof(*ssid));
> if (ssid == NULL)
> return NULL;
> ssid->id = id;
> if (last)
> last->next = ssid;
> else
> config->ssid = ssid;
> wpa_printf(MSG_ERROR, "wpa_config_add_network added %p size
> %d", ssid, sizeof(*ssid));
>
> wpa_config_update_prio_list(config);
>
> return ssid;
> }
> Regards
>
> _______________________________________________
> Hostap mailing list
> Hostap(a)lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/hostap
6 years, 3 months
[RFC 1/2] Storage based service retrieval
by MANIEZZO Marco (MM)
Hello,
I'm proposing changes related to the attached discussion, on retrieval of stored services information, in two RFC proposals:
RFC (1): Add a method GetKnownServices to the Manager that has similar behavior of GetServices but the source is not the active services list but the services stored in STORAGEDIR.
RFC (2): Deletion of stored service: as far as I understood, provisioned services (the one with a .config file) cannot be deleted with Remove method of Service, but after testing of the WiFi technology I saw that it is not possible to remove (STORAGEDIR)/service_folder/settings even if there is no .config file, with the Remove method of a Service. This will lead to an increasing storage unless manually file deletion is done. The RFC then is to change the _connman_service_remove function to actually delete folders and files, when possible, meaning I would preserve current conditions to return false in _connman_service_remove and moreover the .config files in (STORAGEDIR) won't be touched.
This email is to start with the RFC (1) modifications and see if my ideas are approved, because I made some assumptions that I hope are not a misunderstanding:
a) currently from Service component, using Storage component it is possible to access only information stored in (STORAGEDIR)/service_folder/settings and not (STORAGEDIR)/files.config. The latter is only accessed by Config component
b) the user can create a .config file in STORAGEDIR containing the information of connection (including passphrase for WiFi) of the services he already knows, so connman can connect (or autoconnect) to them without interaction. If a connection is made to these services with success, then a corresponding folder with a settings file will be created in (STORAGEDIR)/, that will reflects the .config file. Until a connection is done, only the .config file will exists. For services that don't have a .config file, after the user succeeds to connect to them the (STORAGEDIR)/service_folder/settings will be created.
Basing on the above assumption, mainly for (a) which would require further modifications, the GetKnownServices only retrieves the services that have (STORAGEDIR)/service_folder/settings; it will not read the content of the .config files. For our personal usage this is not a limitation because we won't have .config files, moreover the Remove method won't be able to remove them, but I'm open to change if you have suggestions.
Here's my proposal for RFC (1):
client/commands.c | 13 ++++++++++++
doc/connmanctl.1.in | 11 ++++++++++
doc/manager-api.txt | 18 ++++++++++++++++
src/connman.h | 1 +
src/manager.c | 23 +++++++++++++++++++++
src/service.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/manager-api.c | 33 ++++++++++++++++++++++++++++++
7 files changed, 158 insertions(+)
diff --git a/client/commands.c b/client/commands.c
index db24d16..313174a 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -348,6 +348,17 @@ static int object_properties(DBusMessageIter *iter,
return 0;
}
+static int cmd_known_services(char *args[], int num, struct connman_option *options)
+{
+ if (num > 1)
+ return -E2BIG;
+
+ return __connmanctl_dbus_method_call(connection,
+ CONNMAN_SERVICE, CONNMAN_PATH,
+ "net.connman.Manager", "GetKnownServices",
+ services_list, NULL, NULL, NULL);
+}
+
static int cmd_services(char *args[], int num, struct connman_option *options)
{
char *service_name = NULL;
@@ -2549,6 +2560,8 @@ static const struct {
lookup_tether },
{ "services", "[<service>]", service_options, cmd_services,
"Display services", lookup_service_arg },
+ { "known-services", NULL, NULL, cmd_known_services,
+ "Display known services", NULL },
{ "peers", "[peer]", NULL, cmd_peers,
"Display peers", lookup_peer_arg },
{ "scan", "<technology>", NULL, cmd_scan,
diff --git a/doc/connmanctl.1.in b/doc/connmanctl.1.in
index 0f891bd..fe7359c 100644
--- a/doc/connmanctl.1.in
+++ b/doc/connmanctl.1.in
@@ -12,6 +12,7 @@ SYNOPSIS
.BI tether \ technology\ \fRon|off\ |
.BI tether\fR\ wifi\ on|off\ ssid\ passphrase\fR\ |
.BR services \ [\fIservice\fR]\ |
+.BR known-services\fR\ |
.BI peers \ peer\fR\ |
.BI scan \ technology\fR\ |
.RI \fBconnect \ service | peer \ |
@@ -103,6 +104,16 @@ Only the service path (e.g. wifi_6834534139723_managed_none)
is accepted as a parameter.
.PP
.TP
+.B known-services
+Returns a sorted list of tuples with service object path and dictionary of service
+properties, for the known services having their own directory in STORAGEDIR; it
+does not read .config files in root STORAGEDIR. With this principle, it will return
+only services that have been connected at least one time.
+This list will not contain sensitive information like passphrases etc.
+The object path can be used as string to retrieve main properties concatenated
+(for WiFi it includes SSID an security of the AP).
+.PP
+.TP
.BI scan \ technology
Scans for new services on the given technology.
.PP
diff --git a/doc/manager-api.txt b/doc/manager-api.txt
index 31e137c..509eac9 100644
--- a/doc/manager-api.txt
+++ b/doc/manager-api.txt
@@ -45,6 +45,24 @@ Methods dict GetProperties()
and dictionary of peer properties
Possible Errors: [service].Error.InvalidArguments
+
+ array{object,dict} GetKnownServices() [experimental]
+
+ Returns a sorted list of tuples with service
+ object path and dictionary of service properties,
+ for the known services having their own directory in
+ STORAGEDIR; it does not read .config files in root STORAGEDIR.
+ With this principle, it will return only services that
+ have been connected at least one time.
+
+ This list will not contain sensitive information
+ like passphrases etc.
+
+ The object path can be used as string to retrieve main
+ properties concatenated (for WiFi it includes SSID an
+ security of the AP).
+
+ Possible Errors: [service].Error.InvalidArguments
object ConnectProvider(dict provider) [deprecated]
diff --git a/src/connman.h b/src/connman.h
index 447bdd7..041b191 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -654,6 +654,7 @@ int __connman_service_init(void);
void __connman_service_cleanup(void);
int __connman_service_load_modifiable(struct connman_service *service);
+void __connman_known_service_list_struct(DBusMessageIter *iter);
void __connman_service_list_struct(DBusMessageIter *iter);
int __connman_service_compare(const struct connman_service *a,
diff --git a/src/manager.c b/src/manager.c
index d15ce20..1f59644 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -175,6 +175,11 @@ static struct connman_notifier technology_notifier = {
.idle_state = idle_state,
};
+static void append_known_service_structs(DBusMessageIter *iter, void *user_data)
+{
+ __connman_known_service_list_struct(iter);
+}
+
static void append_service_structs(DBusMessageIter *iter, void *user_data)
{
__connman_service_list_struct(iter);
@@ -195,6 +200,21 @@ static DBusMessage *get_services(DBusConnection *conn,
return reply;
}
+static DBusMessage *get_known_services(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ DBusMessage *reply;
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return NULL;
+
+ __connman_dbus_append_objpath_dict_array(reply,
+ append_known_service_structs, NULL);
+
+ return reply;
+}
+
static void append_peer_structs(DBusMessageIter *iter, void *user_data)
{
__connman_peer_list_struct(iter);
@@ -513,6 +533,9 @@ static const GDBusMethodTable manager_methods[] = {
{ GDBUS_DEPRECATED_METHOD("RemoveProvider",
GDBUS_ARGS({ "provider", "o" }), NULL,
remove_provider) },
+ { GDBUS_METHOD("GetKnownServices",
+ NULL, GDBUS_ARGS({ "knownServices", "a(oa{sv})" }),
+ get_known_services) },
{ GDBUS_METHOD("GetServices",
NULL, GDBUS_ARGS({ "services", "a(oa{sv})" }),
get_services) },
diff --git a/src/service.c b/src/service.c
index a93aebf..e18caa0 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2431,6 +2431,65 @@ static void append_struct(gpointer value, gpointer user_data)
append_struct_service(iter, append_dict_properties, service);
}
+void __connman_known_service_list_struct(DBusMessageIter *iter)
+{
+ gchar **services = NULL;
+ gchar **serviceIDParts = NULL;
+ int i = 0;
+ struct connman_service *service = NULL;
+
+ DBG("listing known services");
+
+ services = connman_storage_get_services();
+ if (services == NULL)
+ return;
+
+ for (i = 0; i < g_strv_length(services); i++)
+ {
+ service = connman_service_create();
+ if (service == NULL)
+ {
+ connman_error("connman_service_create() allocation failed");
+ return ;
+ }
+ service->identifier = g_strdup(services[i]);
+ serviceIDParts = g_strsplit(services[i], "_", -1);
+ if(serviceIDParts != NULL)
+ {
+ service->type = __connman_service_string2type(serviceIDParts[0]);
+ service->path = g_strdup_printf("%s/service/%s", CONNMAN_PATH, service->identifier);
+ if(service->type == CONNMAN_SERVICE_TYPE_WIFI)
+ service->security = __connman_service_string2security(serviceIDParts[g_strv_length(serviceIDParts)-1]);
+
+ if(service->path != NULL)
+ {
+ if(find_service(service->path) != NULL)
+ service->state = (find_service(service->path))->state;
+ if(service->type == CONNMAN_SERVICE_TYPE_ETHERNET && find_service(service->path) != NULL)
+ service->name = (find_service(service->path))->name;
+
+ if (0 != service_load(service))
+ {
+ connman_error("service_load() returned error");
+ g_free(service);
+ g_strfreev(serviceIDParts);
+ g_strfreev(services);
+ return;
+ }
+
+ append_struct_service(iter, append_dict_properties, service);
+ }
+
+ g_strfreev(serviceIDParts);
+ }
+ g_free(service);
+
+ }
+
+ g_strfreev(services);
+}
+
+
void __connman_service_list_struct(DBusMessageIter *iter)
{
g_list_foreach(service_list, append_struct, iter);
diff --git a/tools/manager-api.c b/tools/manager-api.c
index e082962..9e97f70 100644
--- a/tools/manager-api.c
+++ b/tools/manager-api.c
@@ -64,6 +64,39 @@ static DBusMessage *set_property(DBusConnection *connection,
return reply;
}
+DBusMessage *manager_get_known_services(DBusConnection *connection)
+{
+ DBusMessage *message, *reply;
+ DBusError error;
+
+ message = dbus_message_new_method_call(CONNMAN_SERVICE,
+ CONNMAN_MANAGER_PATH,
+ CONNMAN_MANAGER_INTERFACE,
+ "GetKnownServices");
+
+ if (!message)
+ return NULL;
+
+ dbus_error_init(&error);
+
+ reply = dbus_connection_send_with_reply_and_block(connection,
+ message, -1, &error);
+ if (!reply) {
+ if (dbus_error_is_set(&error)) {
+ LOG("%s", error.message);
+ dbus_error_free(&error);
+ } else {
+ LOG("Failed to get known services");
+ }
+ dbus_message_unref(message);
+ return NULL;
+ }
+
+ dbus_message_unref(message);
+
+ return reply;
+}
+
DBusMessage *manager_get_services(DBusConnection *connection)
{
DBusMessage *message, *reply;
--
1.9.1
Regards,
Marco
________________________________
VISITA IL NOSTRO NUOVO SITO WEB! - VISIT OUR NEW WEB SITE! www.magnetimarelli.com
Confidential Notice: This message - including its attachments - may contain proprietary, confidential and/or legally protected information and is intended solely for the use of the designated addressee(s) above. If you are not the intended recipient be aware that any downloading, copying, disclosure, distribution or use of the contents of the above information is strictly prohibited.
If you have received this communication by mistake, please forward the message back to the sender at the email address above, delete the message from all mailboxes and any other electronic storage medium and destroy all copies.
Disclaimer Notice: Internet communications cannot be guaranteed to be safe or error-free. Therefore we do not assure that this message is complete or accurate and we do not accept liability for any errors or omissions in the contents of this message.
6 years, 3 months
[PATCHv3] gdhcp: Don't try to remove timer again
by Saurav Babu
GLib-CRITICAL warning message is obtained in below scenario:
1. service is connected and link local address is obtained.
2. Try to disconnect service.
(connmand:8377): GLib-CRITICAL **: Source ID 289 was not found when
attempting to remove it
(connmand:8377): GLib-CRITICAL **: Source ID 303 was not found when
attempting to remove it
When Link Local IP address is obtained then both dhcp_client->timeout
assigned for DISCOVER_TIMEOUT and ANNOUNCE_INTERVAL are already removed
when discover_timeout() and ipv4ll_announce_timeout() function returns
FALSE but the dhcp_client->timeout is not assigned to 0. Now when
dhcp_release() calls remove_timeouts() function then
dhcp_client->timeout is tried to remove again resulting in GLib-CRITICAL
warning. This patch removes all possible remaing timeouts in
g_dhcp_client_start() and explicitly sets dhcp_client->timeout to 0 in
ipv4ll_announce_timeout() function.
---
v3: Removes any possible remaining timeouts in g_dhcp_client_start() instead of
assigning dhcp_client->timeout to 0 just before calling g_dhcp_client_start()
in discover_timeout
gdhcp/client.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gdhcp/client.c b/gdhcp/client.c
index f9cba89..6b24679 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -2681,6 +2681,7 @@ static gboolean ipv4ll_announce_timeout(gpointer dhcp_data)
dhcp_client->ipv4ll_available_cb(dhcp_client,
dhcp_client->ipv4ll_available_data);
dhcp_client->conflicts = 0;
+ dhcp_client->timeout = 0;
return FALSE;
}
@@ -2713,6 +2714,9 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const char *last_address)
uint32_t addr;
uint64_t rand;
+ /* Remove any possible remaining timeout before proceeding further */
+ remove_timeouts(dhcp_client);
+
if (dhcp_client->type == G_DHCP_IPV6) {
if (dhcp_client->information_req_cb) {
dhcp_client->state = INFORMATION_REQ;
--
1.9.1
6 years, 3 months
[PATCHv2] client: Fix Memory Leak
by Niraj Kumar Goit
Allocate memory to services structure after error checks to fix memory
leak.
---
v2: To fix memory leak instead of free memory in case of error, allocate
memory to services after all error checks.
client/commands.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/client/commands.c b/client/commands.c
index db24d16..95343e3 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -795,7 +795,6 @@ static int cmd_service_move_before(char *args[], int num,
struct connman_option *options)
{
const char *iface = "net.connman.Service";
- struct move_service *services = g_new(struct move_service, 1);
if (num > 3)
return -E2BIG;
@@ -806,6 +805,8 @@ static int cmd_service_move_before(char *args[], int num,
if (check_dbus_name(args[1]) == false)
return -EINVAL;
+ struct move_service *services = g_new(struct move_service, 1);
+
services->service = g_strdup_printf("/net/connman/service/%s", args[1]);
services->target = g_strdup_printf("/net/connman/service/%s", args[2]);
--
1.7.9.5
6 years, 3 months