[PATCH] [connman] gdbus: Drop message replies if the sender requested no reply
by Philip Withnall
If the sender flags a D-Bus message as not expecting a reply, it is
against system bus policy to send a reply — sending one will result in
errors being sent to us by dbus-daemon.
Magically drop all replies to messages which request no reply.
This is not a complete fix. In an ideal world, the existing check for
G_DBUS_METHOD_FLAG_NOREPLY would be dropped, as the server should be
prepared to return a reply to every method, if the client requests and
expects one — otherwise the client will time out. However, that’s a
much
bigger change with a much bigger risk of breaking things, so I’ll stick
with this for now.
Signed-off-by: Philip Withnall <philip.withnall(a)collabora.co.uk>
Reviewed-by: Simon McVittie <simon.mcvittie(a)collabora.co.uk>
---
gdbus/object.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdbus/object.c b/gdbus/object.c
index 96db516..146a255 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -258,7 +258,8 @@ static DBusHandlerResult
process_message(DBusConnection *connection,
reply = method->function(connection, message,
iface_user_data);
- if (method->flags & G_DBUS_METHOD_FLAG_NOREPLY) {
+ if (method->flags & G_DBUS_METHOD_FLAG_NOREPLY ||
+ dbus_message_get_no_reply(message)) {
if (reply != NULL)
dbus_message_unref(reply);
return DBUS_HANDLER_RESULT_HANDLED;
--
2.5.0
5 years, 1 month
[PATCH v2 1/4] gdbus: Fix Memory Leak
by Saurav Babu
Members of data are allocated memory but not freed only data is freed
---
gdbus/watch.c | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/gdbus/watch.c b/gdbus/watch.c
index b60f650..447e486 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -204,6 +204,30 @@ static gboolean remove_match(struct filter_data *data)
return TRUE;
}
+static void filter_data_free(struct filter_data *data)
+{
+ GSList *l;
+
+ /* Remove filter if there are no listeners left for the connection */
+ if (filter_data_find(data->connection) == NULL)
+ dbus_connection_remove_filter(data->connection, message_filter,
+ NULL);
+
+ for (l = data->callbacks; l != NULL; l = l->next)
+ g_free(l->data);
+
+ g_slist_free(data->callbacks);
+ g_dbus_remove_watch(data->connection, data->name_watch);
+ g_free(data->name);
+ g_free(data->owner);
+ g_free(data->path);
+ g_free(data->interface);
+ g_free(data->member);
+ g_free(data->argument);
+ dbus_connection_unref(data->connection);
+ g_free(data);
+}
+
static struct filter_data *filter_data_get(DBusConnection *connection,
DBusHandleMessageFunction filter,
const char *sender,
@@ -248,7 +272,7 @@ proceed:
data->argument = g_strdup(argument);
if (!add_match(data, filter)) {
- g_free(data);
+ filter_data_free(data);
return NULL;
}
@@ -277,30 +301,6 @@ static struct filter_callback *filter_data_find_callback(
return NULL;
}
-static void filter_data_free(struct filter_data *data)
-{
- GSList *l;
-
- /* Remove filter if there are no listeners left for the connection */
- if (filter_data_find(data->connection) == NULL)
- dbus_connection_remove_filter(data->connection, message_filter,
- NULL);
-
- for (l = data->callbacks; l != NULL; l = l->next)
- g_free(l->data);
-
- g_slist_free(data->callbacks);
- g_dbus_remove_watch(data->connection, data->name_watch);
- g_free(data->name);
- g_free(data->owner);
- g_free(data->path);
- g_free(data->interface);
- g_free(data->member);
- g_free(data->argument);
- dbus_connection_unref(data->connection);
- g_free(data);
-}
-
static void filter_data_call_and_free(struct filter_data *data)
{
GSList *l;
--
1.9.1
5 years, 1 month
[PATCH] connman.service: Start ConnMan after systemd-sysusers
by Patrik Flykt
Some setups may want to define specific system users before starting
ConnMan. Order startup after systemd-sysusers.service.
---
src/connman.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/connman.service.in b/src/connman.service.in
index 2198a19..09dfec9 100644
--- a/src/connman.service.in
+++ b/src/connman.service.in
@@ -3,7 +3,7 @@ Description=Connection service
DefaultDependencies=false
Conflicts=shutdown.target
RequiresMountsFor=@localstatedir@/lib/connman
-After=dbus.service network-pre.target
+After=dbus.service network-pre.target systemd-sysusers.service
Before=network.target multi-user.target shutdown.target
Wants=network.target
--
2.1.4
5 years, 1 month
[PATCH] gdbus: Move typedefs for interwork with strict compilers
by Patrik Flykt
From: Grant Erickson <marathon96(a)gmail.com>
Move enumeration type defintions AFTER the enumerations themselves are declared
and defined such that the header works with strict compilers.
This occurs when building a plugin, compiled with C++, and occurs on all of:
arm-none-linux-gnueabi-g++ (Sourcery G++ Lite 2010q1-202) 4.4.1
arm-poky-linux-gnueabi-g++ (GCC) 4.8.2
g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
---
Hi,
This patch came up on the ConnMan mailing list, applies to Bluez too.
The patch is rebased to latest upstream and commit message amended with
more information.
Cheers,
Patrik
gdbus/gdbus.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 9ece4b0..69fbc10 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -31,12 +31,6 @@ extern "C" {
#include <dbus/dbus.h>
#include <glib.h>
-typedef enum GDBusMethodFlags GDBusMethodFlags;
-typedef enum GDBusSignalFlags GDBusSignalFlags;
-typedef enum GDBusPropertyFlags GDBusPropertyFlags;
-typedef enum GDBusSecurityFlags GDBusSecurityFlags;
-typedef enum GDbusPropertyChangedFlags GDbusPropertyChangedFlags;
-
typedef struct GDBusArgInfo GDBusArgInfo;
typedef struct GDBusMethodTable GDBusMethodTable;
typedef struct GDBusSignalTable GDBusSignalTable;
@@ -120,6 +114,12 @@ enum GDbusPropertyChangedFlags {
G_DBUS_PROPERTY_CHANGED_FLAG_FLUSH = (1 << 0),
};
+typedef enum GDBusMethodFlags GDBusMethodFlags;
+typedef enum GDBusSignalFlags GDBusSignalFlags;
+typedef enum GDBusPropertyFlags GDBusPropertyFlags;
+typedef enum GDBusSecurityFlags GDBusSecurityFlags;
+typedef enum GDbusPropertyChangedFlags GDbusPropertyChangedFlags;
+
struct GDBusArgInfo {
const char *name;
const char *signature;
--
2.1.4
5 years, 1 month
[PATCH] tethering: Fixed Memory Leak
by Saurav Babu
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
5 years, 1 month
[PATCH] doc: Fix typos in doc/vpn-config-format.txt
by Saurav Babu
---
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
5 years, 1 month
[PATCH v3 0/9] connmand-wait-online
by Patrik Flykt
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
5 years, 1 month
[PATCH v2 0/9] connmand-wait-online
by Patrik Flykt
Hi,
v2 of this patch updates patches 1/9 and 4/9 according to comments.
Cheers,
Patrik
Hi,
Here is a new systemd service which waits until ConnMan gets to 'ready'
or 'online' state by placing itself before systemd's network-online.target.
This will cause services needing network to be run after the network
is actually up instead of being started after ConnMan as is the case
right now.
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 | 13 +-
src/connman-wait-online.service.in | 15 ++
src/connman.service.in | 4 +-
src/connmand-wait-online.c | 461 +++++++++++++++++++++++++++++++++++++
4 files changed, 488 insertions(+), 5 deletions(-)
create mode 100644 src/connman-wait-online.service.in
create mode 100644 src/connmand-wait-online.c
--
2.1.4
5 years, 1 month
[PATCH 0/9] connmand-wait-online
by Patrik Flykt
Hi,
Here is a new systemd service which waits until ConnMan gets to 'ready'
or 'online' state by placing itself before systemd's network-online.target.
This will cause services needing network to be run after the network
is actually up instead of being started after ConnMan as is the case
right now.
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 | 13 +-
src/connman-wait-online.service.in | 15 ++
src/connman.service.in | 4 +-
src/connmand-wait-online.c | 461 +++++++++++++++++++++++++++++++++++++
4 files changed, 488 insertions(+), 5 deletions(-)
create mode 100644 src/connman-wait-online.service.in
create mode 100644 src/connmand-wait-online.c
--
2.1.4
5 years, 1 month