Re: [PATCH] inet: Properly remove IPv4 address and set interface down
On Tue, 2012-08-28 at 10:51 +0300, patrik.fl...@linux.intel.com wrote: From: Patrik Flykt patrik.fl...@linux.intel.com The interface was not properly set down and thus the services were not removed. Fixes BMC#25659 Applied. Patrik ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
Re: [PATCH 00/12] New CLI v3
Hi Tudor, some general comments below On 08/29/2012 03:05 AM, Tudor Marcu wrote: This patch set introduces a new CLI for Connman to use with the current tree. The new files in the client directory compile under a single executable called cmn, which provides a larger range of functions. It consists of patches that add the new client and documentation, remove the old client, and update the Makefile.am and other associated files. The first 6 patches add the files containing the functions used in the CLI, and the main CLI file and the files for interactive mode. The seventh patch includes a new man page for cmn, and changes to TODO, AUTHORS, and .gitignore. The last patch removes the old client and updates the Makefile.am to compile the client and install the man page. - git am complains about whitespace errors (blank lines at eof), just check that you do not have extra newlines at the end of the files. Use checkpatch.pl script from kernel sources to check the patches before sending. - when generating patch please do something like this git format-patch -o patches --cover-letter \ --subject-prefix=PATCH vXX HEAD~YY where XX is the patchset version (your next one is 4) And the patch sending should be done like this git send-email patches/0*.patch and press enter when asked what what is the message-id, this way you will get nicely threaded mails where individual patches are under the cover letter mail - client still uses dbus-glib (includes dbus-glib-lowlevel.h) but does not require that in configure, why do we need dbus-glib anyway? Connmand works just fine without it. Something like this could be used instead diff --git a/Makefile.am b/Makefile.am index fee2e7a..68c0b96 100644 --- a/Makefile.am +++ b/Makefile.am @@ -146,7 +146,7 @@ client_cmn_SOURCES = $(gdbus_sources) src/log.c include/log.h src/dbus.c \ client/interactive.h client/monitor.c \ client/monitor.h client/main.c -client_cmn_LDADD = @DBUS_LIBS@ @GLIB_LIBS@ -ldbus-glib-1 -lreadline -ldl +client_cmn_LDADD = @DBUS_LIBS@ @GLIB_LIBS@ -lreadline -ldl endif if WISPR diff --git a/client/main.c b/client/main.c index 45808c6..38aa4b8 100644 --- a/client/main.c +++ b/client/main.c @@ -29,7 +29,7 @@ #include glib.h #include dbus/dbus.h -#include dbus/dbus-glib-lowlevel.h +#include gdbus.h #include client/data_manager.h #include client/services.h @@ -110,7 +110,12 @@ static int monitor_connman(DBusConnection *connection, char *interface, DBusError err; dbus_error_init(err); - dbus_connection_setup_with_g_main(connection, NULL); + g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, err); + if (dbus_error_is_set(err)) { + fprintf(stderr, Bus setup error: %s\n, err.message); + return -1; + } + dbus_bus_add_match(connection, rule, err); if (dbus_error_is_set(err)) { @@ -342,7 +347,6 @@ int main(int argc, char *argv[]) {0, 0, 0, 0} }; - g_type_init(); main_loop = g_main_loop_new(NULL, TRUE); dbus_error_init(err); diff --git a/client/monitor.c b/client/monitor.c index 2cb5f76..757edf1 100644 --- a/client/monitor.c +++ b/client/monitor.c @@ -29,7 +29,6 @@ #include glib.h #include dbus/dbus.h -#include dbus/dbus-glib-lowlevel.h #include client/monitor.h #include client/services.h - cmn services shows * ARO foobar . The 'O'nline or 'R'eady state chars are mutually exclusive so it is either R or O, not both at the same time. - cmn tech is a bit weird command, should we name it to cmn technology and allow shorter version also. This is also true for other commands meaning that we should match shorter command names also, like cmn conf would match cmn config, but cmn con would give error because there are two options now cmn connect and cmn config. So work the same way as ip command from iproute package where you can say ip r g 1.2.3.4 instead of ip route get 1.2.3.4. This is not top level priority but nice to have. - in interactive mode, the ctrl-d should exit the mode like in normal shell - cmn scan foobar returns 0 even thou there was an error - cmn config foobar returns 255 for errors but for example cmn config foobar --proxy manual servers 1.2.3.4 excludes 2.3.4.5 says foobar is not a valid service but returns still 0. So as a general rule, if the command fails, we need to return != 0 value. - cmn services --properties ethernet_001122334455_cable returns the properties like this [Nameservers] 1.2.3.4 5.6.7.8 NULL do we need the NULL here (especially at the end of the array)? Also if the property is empty, we can just print empty line instead of lonely NULL. This works ok for dicts which do not print any NULLs if the dict is empty. Cheers, Jukka ___ connman mailing list connman@connman.net
Re: [PATCH 01/12] Add service files for new client.
Hi Tudor, some nitpicks below On 08/29/2012 03:07 AM, Tudor Marcu wrote: The services section handles all of the dbus parsing and appending in order to manipulate services. The function set_service_property is responsible for configuring properties that contain an array or dictionary. Functions are provided for iterating through connman's dbus messages and extracting the properties in a useful manner. Specific properties can be appended to messages to send to connman with the append functions. A couple functions such as find service are given to provide more flexibility in user input. --- client/services.c | 489 + client/services.h | 57 +++ 2 files changed, 546 insertions(+) create mode 100644 client/services.c create mode 100644 client/services.h diff --git a/client/services.c b/client/services.c new file mode 100644 index 000..45caee0 --- /dev/null +++ b/client/services.c @@ -0,0 +1,489 @@ +/* + * + * Connection Manager + * + * Copyright (C) 2012 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 + * + */ + +#include stdio.h +#include stdlib.h +#include stdint.h +#include string.h +#include unistd.h + +#include client/services.h +#include connman.h + +static void append_property_array(DBusMessageIter *iter, char *property, + char **data, int num_args) +{ + DBusMessageIter value, array; + int i; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, property); + + connman_dbus_array_open(iter, value); + dbus_message_iter_open_container(value, DBUS_TYPE_ARRAY, +DBUS_TYPE_STRING_AS_STRING, array); + + for (i = 0; i num_args; i++) { + dbus_message_iter_append_basic(array, DBUS_TYPE_STRING, + data[i]); + printf(Added: %s\n, data[i]); + } + dbus_message_iter_close_container(value, array); + dbus_message_iter_close_container(iter, value); +} + +static void append_property_dict(DBusMessageIter *iter, char *property, + char **keys, char **data, int num_args) +{ + DBusMessageIter value, dict, entry, dict_key; + int i; + unsigned char prefix; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, property); + + /* Top most level is a{sv} */ + connman_dbus_dict_open_variant(iter, value); + + connman_dbus_dict_open(value, dict); + + for (i = 0; i num_args; i++) { + dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY, + NULL, entry); + dbus_message_iter_append_basic(entry, DBUS_TYPE_STRING, + keys[i]); + + if (strcmp(property, IPv6.Configuration) == 0 i == 2) { + prefix = atoi(data[i]); + + dbus_message_iter_open_container(entry, + DBUS_TYPE_VARIANT, + DBUS_TYPE_BYTE_AS_STRING, + dict_key); + dbus_message_iter_append_basic(dict_key, + DBUS_TYPE_BYTE, prefix); + } else { + dbus_message_iter_open_container(entry, +DBUS_TYPE_VARIANT, +DBUS_TYPE_STRING_AS_STRING, +dict_key); + dbus_message_iter_append_basic(dict_key, + DBUS_TYPE_STRING, + data[i]); + } + dbus_message_iter_close_container(entry, dict_key); + dbus_message_iter_close_container(dict, entry); + } + /* Close {sv}, then close a{sv} */ + connman_dbus_dict_close(value, dict); + connman_dbus_dict_close(iter, value); +} + +static void iterate_array(DBusMessageIter *iter) +{ + DBusMessageIter array_item; + dbus_bool_t key_bool; + char
Re: [PATCH 04/12] Add connman monitor files.
Hi Tudor, I noticed that if connmand is killed when I have cmn monitor running, the monitor dumps core as there is a dbus message != NULL check that fails. On 08/29/2012 03:08 AM, Tudor Marcu wrote: The client is able to be run as a monitor to connman. When cmn is started with the monitor option, it will wait for any signals from connman and display them in the terminal. It is useful if one wants to have some realtime verbose output of connman, and how it reacts to various input, e.g setting ipv4 to use dhcp. --- client/monitor.c | 214 ++ client/monitor.h | 40 ++ 2 files changed, 254 insertions(+) create mode 100644 client/monitor.c create mode 100644 client/monitor.h diff --git a/client/monitor.c b/client/monitor.c new file mode 100644 index 000..2cb5f76 --- /dev/null +++ b/client/monitor.c @@ -0,0 +1,214 @@ +/* + * + * Connection Manager + * + * Copyright (C) 2012 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 + * + */ + +#include stdio.h +#include stdlib.h +#include unistd.h +#include string.h +#include stdint.h + +#include glib.h + +#include dbus/dbus.h +#include dbus/dbus-glib-lowlevel.h + +#include client/monitor.h +#include client/services.h +#include client/technology.h +#include client/data_manager.h +#include connman.h + +static const char *get_service_name(DBusMessage *message, char *dbus_path) +{ + DBusMessageIter iter, array; + + dbus_message_iter_init(message, iter); + dbus_message_iter_recurse(iter, array); + + while (dbus_message_iter_get_arg_type(array) == DBUS_TYPE_STRUCT) { + DBusMessageIter entry, dict; + struct service_data service; + char *path; + + dbus_message_iter_recurse(array, entry); + dbus_message_iter_get_basic(entry, path); + + if (strncmp(path, dbus_path, strlen(path)) == 0) { + dbus_message_iter_next(entry); + dbus_message_iter_recurse(entry, dict); + extract_service_name(dict, service); + return service.name; + } else { + dbus_message_iter_next(array); + } + } + return NULL; +} + +static void extract_tech_signal(DBusMessage *message) +{ + DBusMessageIter iter, dict; + char *path; + + dbus_message_iter_init(message, iter); + + if (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_OBJECT_PATH) { + dbus_message_iter_get_basic(iter, path); + printf( { %s }\n, path); + } + dbus_message_iter_next(iter); + + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_INVALID) { + dbus_message_iter_recurse(iter, dict); + extract_properties(dict); + } +} + +static void extract_signal_args(DBusMessage *message) +{ + DBusMessageIter iter, array, dict; + char *string, *value; + uint16_t key_int; + dbus_bool_t bvalue; + + value = NULL; + key_int = 0; + + dbus_message_iter_init(message, iter); + + while (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_INVALID) { + if (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_STRING) { + dbus_message_iter_get_basic(iter, string); + printf(\n[%s] was set to the values:\n, + string); + } + dbus_message_iter_next(iter); + if (dbus_message_iter_get_arg_type(iter) != + DBUS_TYPE_INVALID) { + dbus_message_iter_recurse(iter, array); + if (dbus_message_iter_get_arg_type(array) == + DBUS_TYPE_STRING) { + dbus_message_iter_get_basic(array, value); + printf(%s\n, value); + continue; + } else if (dbus_message_iter_get_arg_type(array) == + DBUS_TYPE_BOOLEAN) { + dbus_message_iter_get_basic(array, bvalue); + printf(
Re: [PATCH 00/12] New CLI v3
Hi, On Tue, 2012-08-28 at 17:05 -0700, Tudor Marcu wrote: This patch set introduces a new CLI for Connman to use with the current tree. Please fix up blank lines EOF in patches 1-5,7 and 9. I spent quite a while with 'git am' on this and it's quite annoying with .gitconfig '[apply]' section containing 'whitespace = error'. There are still some strncmp found, please fix. Cheers, Patrik ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
Re: [PATCH 05/12] Add interactive mode files.
On Tue, 2012-08-28 at 17:08 -0700, Tudor Marcu wrote: When the client is started with the interactive option, it should drop into an interactive shell mode. These files handle all the interactive commands using readline, and provide quick functionality that is similar to plain synchronous command. Invalid input will be ignored, and the input is tokenized to allow for various input errors. --- client/interactive.c | 202 ++ client/interactive.h | 30 2 files changed, 232 insertions(+) create mode 100644 client/interactive.c create mode 100644 client/interactive.h diff --git a/client/interactive.c b/client/interactive.c new file mode 100644 index 000..96cc02b --- /dev/null +++ b/client/interactive.c @@ -0,0 +1,202 @@ +/* + * + * Connection Manager + * + * Copyright (C) 2012 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 + * + */ + +#include stdio.h +#include stdlib.h +#include string.h +#include readline/readline.h +#include readline/history.h + +#include glib.h + +#include client/interactive.h +#include client/services.h +#include client/technology.h +#include client/data_manager.h + +static void show_help(void) +{ + printf(\n\t\t\t[Welcome to Connman interactive mode]\n\n + enable Enables given technology\n + technology\n + offlinemode Enables OfflineMode\n + disableDisables given technology\n + technology\n + offlinemode Disables OfflineMode\n + state Shows if the system is online or offline\n + services Display list of all services\n + tech Current technology on the system\n + scan technology Scans for new services on the given technology\n + connect service Connect to a given service\n + disconnect service Disconnect from service\n + help, hShow this dialogue\n + quit, q, exit Exit program\n); +} + +static int handle_commands(DBusConnection *connection, char *token) +{ + DBusMessage *message; + gchar *prev_command = NULL; + + for (;;) { + if (strcmp(token, quit) == 0 || strcmp(token, exit) == 0 || + strcmp(token, q) == 0) { + g_free(prev_command); + free(token); + return 0; + } + + if (strcmp(token, help) == 0 || strcmp(token, h) == 0) { + show_help(); + add_history(token); + } + + if (strcmp(token, services) == 0) { + list_properties(connection, GetServices, NULL); + add_history(token); + } + + if (strcmp(token, state) == 0) { + list_properties(connection, GetProperties, NULL); + add_history(token); + } + + if (strcmp(token, tech) == 0) { + list_properties(connection, GetTechnologies, NULL); + add_history(token); + } + + if (strcmp(token, scan) == 0) { + prev_command = g_strdup(token); + token = strtok(NULL, ); + if (token == NULL) { + fprintf(stderr, ! Please input a technology + to scan\n); + break; + } + message = get_message(connection, GetTechnologies); + scan_technology(connection, message, token); + dbus_message_unref(message); + prev_command = g_strdup_printf(%s %s, prev_command, + token); + add_history(prev_command); + /* FIXME: add function to receive and read the + * ServicesChanged signal
Re: [PATCH 00/12] New CLI v3
Hi, Noticed a few things while testing: client/cmn services --properties service produces a really sparse output of the service properties. I'd like to have it similar to test/list-services and client/cmn tech. It's also good to print empty arrays and dictionaries as '[ ]' and '{ }' respectively. client/cmn scan outputs 'Scan requires an argument, see help'. Since we know a technology name is wanted, the message should be about that. client/cmn scan ethernet will return an net.connman.Error.NotSupported error containing a text string Not supported, since ethernet does not support scanning. Please print out the error and/or text and give some other return value than zero. This might be true for other commands as well, please check them also. client/cmn scan foobar and client/cmn enable/disable foobar should complain nicely that 'foobar' is an unknown technology and return an appropriate non-zero value. client/cmn state is heavily indented without any visible clues why. client/cmn monitor could also just print out e.g. [Powered] = True just like client/cmn tech does. client/cmn monitor --services doesn't seem to be reacting to ServicesChanged, it seems to only print out WiFi signal changes after a while. Despite the above, the command line client starts to be quite promising! Cheers, Patrik ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
Wlantest 1.0 : An automatic wireless tool for ConnMan
Hi, I have been working for the last 2 month with Julien Massot on Wlantest, an automatic wireless testing tool written in Python for ConnMann. I think it might be relevant for some people working with Connman to have a look at the first release (1.0). Github link : https://github.com/aldebaran/wlantest It was initially designed to be run on a daily basis on Nao robots to check ConnMan stability. We are currently running Wlantest inside a Nao virtual machine where we setup virtual interfaces with mac80211_hwsim. What is Wlantest ? Basically, Wlantest will setup two wireless interfaces an will check if ConnMan manages to establish the connection between both: -An AP iface on which hostapd is running and that ConnMan will ignore -An STA iface on which ConnMan is operating The sample test plan provided takes ~15min to complete, and tests 15 different wifi setup: open,wep64/128 raw/pass, wpa-psk, wpa2-psk, hidden service, ieee8021x (wpa/wpa2, peap/ttls), all in manual and auto-connect. The test plan could be easily extended with new .cfg files (README provides more info on syntax and wifi support) What could be improved ? To test the connectivity, Wlantest actually read the Status of the corresponding service through dbus ConnMan. The point is that the result is ConnMan dependant. They are a few time.sleep() calls in the main which may be optimized or questionned. TLS is not yet implemented. Any feedback would be much appreciated, Thanks ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
[PATCH 1/1] service: Do not report error twice
From: Alok Barsode alok.bars...@linux.intel.com In request_input_cb, __connman_service_indicate_error() does reports an error via agent after determing the service state. There is no need for a explicit error reporting. --- src/service.c |3 --- 1 file changed, 3 deletions(-) diff --git a/src/service.c b/src/service.c index e2fa389..48187c4 100644 --- a/src/service.c +++ b/src/service.c @@ -4872,9 +4872,6 @@ static void request_input_cb (struct connman_service *service, } else if (err == -ENOKEY) { __connman_service_indicate_error(service, CONNMAN_SERVICE_ERROR_INVALID_KEY); - __connman_agent_report_error(service, - error2string(service-error), - report_error_cb, NULL); } else { /* It is not relevant to stay on Failure state * when failing is due to wrong user input */ -- 1.7.9.5 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
Re: [PATCH 00/12] New CLI v3
Hi Tudor, This patch set introduces a new CLI for Connman to use with the current tree. The new files in the client directory compile under a single executable called cmn, which provides a larger range of functions. It consists of patches that add the new client and documentation, remove the old client, and update the Makefile.am and other associated files. I do not really like the name cmn. I can not even make out what it is suppose to be standing for. So either just short cm as it is right now or connmanctl to follow in line with what we have with systemctl, journalctl etc. Regards Marcel ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
Re: [PATCH 00/12] New CLI v3
On Wednesday, August 29, 2012, Marcel Holtmann mar...@holtmann.org wrote: Hi Tudor, This patch set introduces a new CLI for Connman to use with the current tree. The new files in the client directory compile under a single executable called cmn, which provides a larger range of functions. It consists of patches that add the new client and documentation, remove the old client, and update the Makefile.am and other associated files. I do not really like the name cmn. I can not even make out what it is suppose to be standing for. So either just short cm as it is right now or connmanctl to follow in line with what we have with systemctl, journalctl etc. Agreed. I'm partial to connmanctl myself... Auke ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
Testing Agent API for WiFi
Hi All, I need to understand how the Agent API works and write a test client or reuse any apart from the python simple-agent. there is a limitation on our embedded platform in terms of executing the Pyhton gobject calls because of Pygobject missing. I think the only way of doing a wifi connect() to a service is using the Agent API. Is there an easy way to write a test client using agent API in order to just emulate the dialog box without using any GTK or Qt related dialog boxes.. I mean replace the actual RequestInput dialog box with something which fills in the passphrase/WPS pin automatically instead of using Widgets or any GUI (like gnome-connman) Is there an easy way to do that, like for building on top of some existing reusable code. I just need a starting point Thanks, Alfred. ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
Re: [PATCH 00/12] New CLI v3
On Wednesday, August 29, 2012, Kok, Auke-jan H wrote: On Wednesday, August 29, 2012, Marcel Holtmann mar...@holtmann.orgjavascript:; wrote: Hi Tudor, This patch set introduces a new CLI for Connman to use with the current tree. The new files in the client directory compile under a single executable called cmn, which provides a larger range of functions. It consists of patches that add the new client and documentation, remove the old client, and update the Makefile.am and other associated files. I do not really like the name cmn. I can not even make out what it is suppose to be standing for. So either just short cm as it is right now or connmanctl to follow in line with what we have with systemctl, journalctl etc. Agreed. I'm partial to connmanctl myself... Me too While at that, an auto-pager like git and systemd would be nice... Some output I'd big enough to be annoying without it :-) Auke ___ connman mailing list connman@connman.net javascript:; http://lists.connman.net/listinfo/connman -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -- MSN: barbi...@gmail.com Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman
RE: Wlantest 1.0 : An automatic wireless tool for ConnMan
Hi Maxence Viallon Hi, I have been working for the last 2 month with Julien Massot on Wlantest, an automatic wireless testing tool written in Python for ConnMann. I think it might be relevant for some people working with Connman to have a look at the first release (1.0). Github link : https://github.com/aldebaran/wlantest It was initially designed to be run on a daily basis on Nao robots to check ConnMan stability. We are currently running Wlantest inside a Nao virtual machine where we setup virtual interfaces with mac80211_hwsim. It's great to see wlantest. Yes configuring AP is a key issue to prevent wifi autotest. And mac80211_hwsim + hostapd is a good solution. I have several questions: 1. Do you plan to run wlantest regularly? 2. Is wlantest and connman run in host machine, and mac80211_hwsim run in VM? I thought that mac80211_hwsim just supports operations between virtual hwsim interfaces in the same machine. 3. If both connman and mac80211_hwsim run in the same machine, will connman automatically manage the virtual interface for hostapd? If this is true, is there conflict for IP address between connman and hostapd+dhcpd? Bests Jeff ___ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman