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] doc: Fix typos in doc/vpn-config-format.txt (Saurav Babu)
2. [PATCH] tethering: Fixed Memory Leak (Saurav Babu)
3. [PATCH v3 2/9] connmand-wait-online: Monitor Manager
PropertyChanged signals (Patrik Flykt)
4. [PATCH v3 4/9] connmand-wait-online: Add command line options
(Patrik Flykt)
5. [PATCH v3 1/9] connmand-wait-online: Add program and initial
main loop (Patrik Flykt)
6. [PATCH v3 0/9] connmand-wait-online (Patrik Flykt)
7. [PATCH v3 3/9] connmand-wait-online: Get Manager properties
on startup (Patrik Flykt)
8. [PATCH v3 8/9] build: Add connman-wait-online.service
(Patrik Flykt)
----------------------------------------------------------------------
Message: 1
Date: Mon, 07 Dec 2015 09:12:12 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] doc: Fix typos in doc/vpn-config-format.txt
Message-ID: <[email protected]>
---
doc/vpn-config-format.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/vpn-config-format.txt b/doc/vpn-config-format.txt
index 3d0abcc..1f5bac8 100644
--- a/doc/vpn-config-format.txt
+++ b/doc/vpn-config-format.txt
@@ -135,9 +135,9 @@ L2TP VPN supports following options (see xl2tpd.conf(5) and
pppd(8) for details)
if not set here (O)
L2TP.Password - L2TP password, asked from the user
if not set here (O)
- L2TP.BPS bps Max bandwith to use (O)
- L2TP.TXBPS tx bps Max transmit bandwith to use (O)
- L2TP.RXBPS rx bps Max receive bandwith to use (O)
+ L2TP.BPS bps Max bandwidth to use (O)
+ L2TP.TXBPS tx bps Max transmit bandwidth to use (O)
+ L2TP.RXBPS rx bps Max receive bandwidth to use (O)
L2TP.LengthBit length bit Use length bit (O)
L2TP.Challenge challenge Use challenge authentication (O)
L2TP.DefaultRoute defaultroute Default route (O)
--
1.9.1
------------------------------
Message: 2
Date: Mon, 07 Dec 2015 11:08:50 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] tethering: Fixed Memory Leak
Message-ID: <[email protected]>
pn->owner is allocated memory but not freed in case of error.
---
src/tethering.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/tethering.c b/src/tethering.c
index ceeec74..3153349 100644
--- a/src/tethering.c
+++ b/src/tethering.c
@@ -505,6 +505,8 @@ error:
close(fd);
g_free(iface);
g_free(path);
+ if (pn)
+ g_free(pn->owner);
g_free(pn);
return err;
}
--
1.9.1
------------------------------
Message: 3
Date: Mon, 7 Dec 2015 10:51:28 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [PATCH v3 2/9] connmand-wait-online: Monitor Manager
PropertyChanged signals
Message-ID:
<[email protected]>
Consider ConnMan to be "online" in systemd terms when a service
gets connected with 'ready' or 'online' state. Monitor Manager
PropertyChanged signals to notice when this happens.
---
src/connmand-wait-online.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/src/connmand-wait-online.c b/src/connmand-wait-online.c
index bf7c8db..d572f8c 100644
--- a/src/connmand-wait-online.c
+++ b/src/connmand-wait-online.c
@@ -24,16 +24,67 @@
#endif
#include <stdio.h>
+#include <string.h>
#include <glib.h>
#include <errno.h>
+#include <stdbool.h>
+#include <dbus/dbus.h>
#include <gdbus.h>
+#include <connman/dbus.h>
static DBusConnection *connection;
static GMainLoop *main_loop;
+static bool state_online(DBusMessageIter *iter)
+{
+ char *str;
+ DBusMessageIter variant;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return false;
+
+ dbus_message_iter_get_basic(iter, &str);
+ if (strcmp(str, "State"))
+ return false;
+
+ dbus_message_iter_next(iter);
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT)
+ return false;
+
+ dbus_message_iter_recurse(iter, &variant);
+
+ if (dbus_message_iter_get_arg_type(&variant) != DBUS_TYPE_STRING)
+ return false;
+
+ dbus_message_iter_get_basic(&variant, &str);
+ if (strcmp(str, "ready") && strcmp(str, "online"))
+ return false;
+
+ return true;
+}
+
+static DBusHandlerResult manager_property_changed(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ DBusMessageIter iter;
+
+ if (dbus_message_is_signal(message, CONNMAN_MANAGER_INTERFACE,
+ "PropertyChanged")) {
+ dbus_message_iter_init(message, &iter);
+
+ if (state_online(&iter))
+ g_main_loop_quit(main_loop);
+ }
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
int main(int argc, char *argv[])
{
+ const char *filter = "type='signal',interface='"
+ CONNMAN_MANAGER_INTERFACE "'";
int err = 0;
DBusError dbus_err;
@@ -49,8 +100,25 @@ int main(int argc, char *argv[])
main_loop = g_main_loop_new(NULL, FALSE);
+ dbus_connection_add_filter(connection, manager_property_changed,
+ NULL, NULL);
+
+ dbus_bus_add_match(connection, filter, &dbus_err);
+
+ if (dbus_error_is_set(&dbus_err)) {
+ fprintf(stderr, "Error: %s\n", dbus_err.message);
+
+ err = -ENOPROTOOPT;
+ goto cleanup;
+ }
+
g_main_loop_run(main_loop);
+cleanup:
+ dbus_bus_remove_match(connection, filter, NULL);
+ dbus_connection_remove_filter(connection, manager_property_changed,
+ NULL);
+
dbus_connection_unref(connection);
g_main_loop_unref(main_loop);
--
2.1.4
------------------------------
Message: 4
Date: Mon, 7 Dec 2015 10:51:30 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [PATCH v3 4/9] connmand-wait-online: Add command line options
Message-ID:
<[email protected]>
Add command line options for the application. Initially add
support for printing version information.
---
src/connmand-wait-online.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/connmand-wait-online.c b/src/connmand-wait-online.c
index 37394dc..eab8c7d 100644
--- a/src/connmand-wait-online.c
+++ b/src/connmand-wait-online.c
@@ -36,6 +36,14 @@
static DBusConnection *connection;
static GMainLoop *main_loop;
+static gboolean option_version = FALSE;
+
+static GOptionEntry options[] = {
+ { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
+ "Show version information and exit" },
+ { NULL },
+};
+
static bool state_online(DBusMessageIter *iter)
{
char *str;
@@ -150,7 +158,29 @@ int main(int argc, char *argv[])
const char *filter = "type='signal',interface='"
CONNMAN_MANAGER_INTERFACE "'";
int err = 0;
+ GError *g_err = NULL;
DBusError dbus_err;
+ GOptionContext *context;
+
+ context = g_option_context_new(NULL);
+ g_option_context_add_main_entries(context, options, NULL);
+
+ if (!g_option_context_parse(context, &argc, &argv, &g_err)) {
+ if (g_err) {
+ fprintf(stderr, "%s\n", g_err->message);
+ g_error_free(g_err);
+ } else
+ fprintf(stderr, "An unknown error occurred\n");
+
+ return EOPNOTSUPP;
+ }
+
+ g_option_context_free(context);
+
+ if (option_version) {
+ fprintf(stdout, "%s\n", VERSION);
+ return 0;
+ }
dbus_error_init(&dbus_err);
connection = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, &dbus_err);
--
2.1.4
------------------------------
Message: 5
Date: Mon, 7 Dec 2015 10:51:27 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [PATCH v3 1/9] connmand-wait-online: Add program and initial
main loop
Message-ID:
<[email protected]>
Add connmand-wait-online program that will return once ConnMan has
connected a service. The return value with a service connected is
zero; on error errno will be returned.
---
Makefile.am | 7 +++++-
src/connmand-wait-online.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 1 deletion(-)
create mode 100644 src/connmand-wait-online.c
diff --git a/Makefile.am b/Makefile.am
index 95082c1..5b0c2de 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -97,7 +97,7 @@ unit_objects =
MANUAL_PAGES =
-sbin_PROGRAMS = src/connmand
+sbin_PROGRAMS = src/connmand src/connmand-wait-online
src_connmand_SOURCES = $(gdhcp_sources) $(gweb_sources) \
$(builtin_sources) $(shared_sources) src/connman.ver \
@@ -125,6 +125,11 @@ src_connmand_LDADD = gdbus/libgdbus-internal.la
$(builtin_libadd) \
src_connmand_LDFLAGS = -Wl,--export-dynamic \
-Wl,--version-script=$(srcdir)/src/connman.ver
+src_connmand_wait_online_SOURCES = src/connmand-wait-online.c
+
+src_connmand_wait_online_LDADD = gdbus/libgdbus-internal.la \
+ @GLIB_LIBS@ @DBUS_LIBS@
+
if VPN
vpn_plugin_LTLIBRARIES =
diff --git a/src/connmand-wait-online.c b/src/connmand-wait-online.c
new file mode 100644
index 0000000..bf7c8db
--- /dev/null
+++ b/src/connmand-wait-online.c
@@ -0,0 +1,61 @@
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2015 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 <glib.h>
+#include <errno.h>
+
+#include <gdbus.h>
+
+static DBusConnection *connection;
+static GMainLoop *main_loop;
+
+int main(int argc, char *argv[])
+{
+ int err = 0;
+ DBusError dbus_err;
+
+ dbus_error_init(&dbus_err);
+ connection = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, &dbus_err);
+
+ if (dbus_error_is_set(&dbus_err)) {
+ fprintf(stderr, "Error: %s\n", dbus_err.message);
+
+ err = -ENOPROTOOPT;
+ goto fail;
+ }
+
+ main_loop = g_main_loop_new(NULL, FALSE);
+
+ g_main_loop_run(main_loop);
+
+ dbus_connection_unref(connection);
+ g_main_loop_unref(main_loop);
+
+fail:
+ dbus_error_free(&dbus_err);
+
+ return -err;
+}
--
2.1.4
------------------------------
Message: 6
Date: Mon, 7 Dec 2015 10:51:26 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [PATCH v3 0/9] connmand-wait-online
Message-ID:
<[email protected]>
Hi,
v3 adds systemd service file to systemdunit_DATA to patch 8 as this was
forgotten from the earlier versions. Fixed patches 4 and 5 to add 'goto free'
to the correct patch. This latter change worked in v1 but failed in v2.
Cheers,
Patrik
Patrik Flykt (9):
connmand-wait-online: Add program and initial main loop
connmand-wait-online: Monitor Manager PropertyChanged signals
connmand-wait-online: Get Manager properties on startup
connmand-wait-online: Add command line options
connmand-wait-online: Add command line switch for interfaces
connmand-wait-online: Add option to ignore interfaces
connmand-wait-online: Add timeout option
build: Add connman-wait-online.service
connman.service: Remove dependencies on remote-fs.target
Makefile.am | 15 +-
src/connman-wait-online.service.in | 15 ++
src/connman.service.in | 4 +-
src/connmand-wait-online.c | 461 +++++++++++++++++++++++++++++++++++++
4 files changed, 489 insertions(+), 6 deletions(-)
create mode 100644 src/connman-wait-online.service.in
create mode 100644 src/connmand-wait-online.c
--
2.1.4
------------------------------
Message: 7
Date: Mon, 7 Dec 2015 10:51:29 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [PATCH v3 3/9] connmand-wait-online: Get Manager properties
on startup
Message-ID:
<[email protected]>
When starting, request Manager properties to detect if a service
is already connected.
---
src/connmand-wait-online.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/src/connmand-wait-online.c b/src/connmand-wait-online.c
index d572f8c..37394dc 100644
--- a/src/connmand-wait-online.c
+++ b/src/connmand-wait-online.c
@@ -65,6 +65,70 @@ static bool state_online(DBusMessageIter *iter)
return true;
}
+static void manager_properties_online(DBusMessageIter *iter)
+{
+ DBusMessageIter array, dict_entry;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
+ return;
+
+ for (dbus_message_iter_recurse(iter, &array);
+ dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY;
+ dbus_message_iter_next(&array)) {
+
+ dbus_message_iter_recurse(&array, &dict_entry);
+
+ if (state_online(&dict_entry)) {
+ g_main_loop_quit(main_loop);
+ break;
+ }
+ }
+}
+
+static void manager_get_properties_return(DBusPendingCall *call, void
*user_data)
+{
+ DBusMessage *reply;
+ DBusMessageIter iter;
+
+ reply = dbus_pending_call_steal_reply(call);
+ if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
+ goto fail;
+
+ if (!dbus_message_iter_init(reply, &iter))
+ goto fail;
+
+ manager_properties_online(&iter);
+
+fail:
+ dbus_message_unref(reply);
+ dbus_pending_call_unref(call);
+}
+
+static void manager_get_properties(void)
+{
+ DBusMessage *message;
+ DBusPendingCall *call;
+
+ message = dbus_message_new_method_call(CONNMAN_SERVICE,
+ CONNMAN_MANAGER_PATH,
+ CONNMAN_MANAGER_INTERFACE,
+ "GetProperties");
+ if (!message)
+ return;
+
+ if (!dbus_connection_send_with_reply(connection, message, &call, -1))
+ goto fail;
+
+ if (!call)
+ goto fail;
+
+ dbus_pending_call_set_notify(call, manager_get_properties_return,
+ NULL, NULL);
+
+fail:
+ dbus_message_unref(message);
+}
+
static DBusHandlerResult manager_property_changed(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
@@ -112,6 +176,8 @@ int main(int argc, char *argv[])
goto cleanup;
}
+ manager_get_properties();
+
g_main_loop_run(main_loop);
cleanup:
--
2.1.4
------------------------------
Message: 8
Date: Mon, 7 Dec 2015 10:51:34 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: [PATCH v3 8/9] build: Add connman-wait-online.service
Message-ID:
<[email protected]>
Add systemd unit connmand-wait-online.service that can be enabled
so that the system waits until a network connection is established
before reaching network-online.target.
The service follows systemd-networkd-wait-online behavior and
matches systemd network "online" status with ConnMan service state
'ready' or 'online'.
Fixes CM-683
---
v3: add service file to systemdunit_DATA
Makefile.am | 8 +++++---
src/connman-wait-online.service.in | 15 +++++++++++++++
2 files changed, 20 insertions(+), 3 deletions(-)
create mode 100644 src/connman-wait-online.service.in
diff --git a/Makefile.am b/Makefile.am
index 5b0c2de..fb7c74e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -63,7 +63,7 @@ endif
if SYSTEMD
systemdunitdir = @SYSTEMD_UNITDIR@
-systemdunit_DATA = src/connman.service
+systemdunit_DATA = src/connman.service src/connman-wait-online.service
tmpfilesdir = @SYSTEMD_TMPFILESDIR@
nodist_tmpfiles_DATA = scripts/connman_resolvconf.conf
@@ -76,10 +76,12 @@ endif
service_files_sources = src/connman.service.in src/net.connman.service.in \
vpn/connman-vpn.service.in \
- vpn/net.connman.vpn.service.in
+ vpn/net.connman.vpn.service.in \
+ src/connman-wait-online.service.in
service_files = src/connman.service src/net.connman.service \
vpn/connman-vpn.service \
- vpn/net.connman.vpn.service
+ vpn/net.connman.vpn.service \
+ src/connman-wait-online.service
plugin_LTLIBRARIES =
diff --git a/src/connman-wait-online.service.in
b/src/connman-wait-online.service.in
new file mode 100644
index 0000000..c2ad5cc
--- /dev/null
+++ b/src/connman-wait-online.service.in
@@ -0,0 +1,15 @@
+[Unit]
+Description=Wait for network to be configured by ConnMan
+Requisite=connman.service
+After=connman.service
+Before=network-online.target
+DefaultDependencies=no
+Conflicts=shutdown.target
+
+[Service]
+Type=oneshot
+ExecStart=@sbindir@/connmand-wait-online
+RemainAfterExit=yes
+
+[Install]
+WantedBy=network-online.target
--
2.1.4
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 2, Issue 6
*************************************