[PATCH] service: Fix minor memory leak on exit

2015-10-20 Thread Slava Monich
services_notify->add and services_notify->remove are always created and have to be always destroyed. --- src/service.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/service.c b/src/service.c index 196f6b5..02a6844 100644 --- a/src/service.c +++ b/src/service.c @@ -71

Re: [PATCH 1/5] service: Add function to remove empty strings

2015-07-15 Thread Slava Monich
> Hi Jaakko, > > On ke, 2015-07-15 at 11:35 +0300, Jaakko Hannikainen wrote: >> This helper function takes in a heap-allocated buffer of heap-allocated >> strings. If no strings should be removed, return the buffer. Else, free >> all empty strings, place nonempty strings to a new container and ret

Re: RFC: D-Bus access to all configured services

2015-07-10 Thread Slava Monich
On 10/07/15 16:07, Tomasz Bursztyka wrote: > Hi Slava, > >> connman is a piece of middleware, its >> job is to provide the functionality and leave it to UI designers to >> decide what to show, what not to show and how to present it to the user. > > That's a debate on its own. > > Actually, I don'

Re: RFC: D-Bus access to all configured services

2015-07-10 Thread Slava Monich
On 10/07/15 14:56, Tomasz Bursztyka wrote: > Hi Slava, > >> All D-Bus calls (except for "Connect" >> obviously) would work for unavailable service just as they do for >> available services. >> >> The main use case is wifi. The user has to be able to see the list of >> configured wifi networks, edit

Re: RFC: D-Bus access to all configured services

2015-07-10 Thread Slava Monich
On 10/07/15 14:51, Marcel Holtmann wrote: > Hi Slava, > >> Does upstream have any interest in providing D-Bus access to all >> configured services, including those that have no network associated >> with it? Before I start writing any code, I would like to know whether >> it's going to be accepted

RFC: D-Bus access to all configured services

2015-07-10 Thread Slava Monich
Does upstream have any interest in providing D-Bus access to all configured services, including those that have no network associated with it? Before I start writing any code, I would like to know whether it's going to be accepted upstream or will remain part of our fork. Basically the idea is to

[PATCH] service: Add __connman_service_ipconfig_indicate_states function

2015-07-09 Thread Slava Monich
Calling __connman_service_ipconfig_indicate_state for both IPv4 and IPv6 is a fairly common pattern on connman. It makes sense to combine these two calls into one function. --- src/connman.h | 2 ++ src/network.c | 17 - src/service.c | 34 +++--- 3 fil

Re: [PATCH] service: Reset state to idle when disassociating service from the network.

2015-07-09 Thread Slava Monich
On 09/07/15 13:03, Tomasz Bursztyka wrote: > Hi Slava, > >> It only does the job for the networks that have been connected: >> >> if (network->connected) >> set_disconnected(network); > > Why not adding there a test on > network->associating/network->connecting as well? > Because __

Re: [PATCH] service: Reset state to idle when disassociating service from the network.

2015-07-09 Thread Slava Monich
On 09/07/15 11:14, Patrik Flykt wrote: > On Wed, 2015-07-08 at 17:05 +0300, Slava Monich wrote: >> Otherwise, service may get stuck in the ASSOCIATION state forever and >> update_from_network() won't do anything because is_connecting() keeps >> returning true, making reco

[PATCH] service: Reset state to idle when disassociating service from the network.

2015-07-08 Thread Slava Monich
Otherwise, service may get stuck in the ASSOCIATION state forever and update_from_network() won't do anything because is_connecting() keeps returning true, making recovery impossible. --- src/service.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/service.c b/src/service.c index 2d

Re: DHCP timers

2015-06-23 Thread Slava Monich
On 20/06/15 05:22, Naveen Singh wrote: > I realized that timers used in dhcp plugin use monotonic timers which does > not progress during suspend duration of device. Because of this the devices > which are sleepy in nature never get to renew IP address and causes lot of > communication failures. >

[PATCH] gsupplicant: Add support for SignalPoll

2015-06-20 Thread Slava Monich
Unlike Scan, SignalPoll is not supposed to disturb active connections or affect throughput in any way. The primary use case is querying the signal strength of the AP we are currently connected to. --- gsupplicant/gsupplicant.h | 14 ++ gsupplicant/supplicant.c | 121 +

[PATCH] ofono: Unref pending dbus calls after cancelling them

2015-04-29 Thread Slava Monich
dbus_pending_call_cancel() drops the dbus library's internal reference to DBusPendingCall but we also need to release the reference we got from dbus_connection_send_with_reply() --- plugins/ofono.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/ofono.c

[PATCH] ofono: Fix crash in modem_update_interfaces

2015-04-29 Thread Slava Monich
modem_update_interfaces could crash if "org.ofono.ConnectionManager" interface is removed right after it has been added, before GetContext call completes (or if it fails): connmand[5141]: plugins/ofono.c:modem_changed() /ril_0 Interfaces 0x05 connmand[5141]: plugins/ofono.c:modem_update_interfaces

Re: [PATCH] device: Add configurable DontBringDownAtStartup list

2015-04-27 Thread Slava Monich
On 27/04/15 08:54, Patrik Flykt wrote: > On Fri, 2015-04-24 at 16:53 +0300, Slava Monich wrote: >> connman brings down managed interfaces at startup. Sometimes it's unnecessary >> or even harmful. DontBringDownAtStartup list in main.conf allows to make >> exceptions for

[PATCH] device: Add configurable DontBringDownAtStartup list

2015-04-24 Thread Slava Monich
connman brings down managed interfaces at startup. Sometimes it's unnecessary or even harmful. DontBringDownAtStartup list in main.conf allows to make exceptions for some interfaces. --- src/device.c | 21 + src/main.c | 17 + 2 files changed, 38 insertions(+)

Re: supplicant.c memory leak etc.

2015-04-14 Thread Slava Monich
On 14/04/15 14:50, Tomasz Bursztyka wrote: > Hi Slava, > > This looks really suspicious. Such functions are always used to > agglomerate BSS into networks. > Which networks are then pushed to the wifi plugins through callbacks. > Some of these exist because of different behaviors of wpa_supplicant

supplicant.c memory leak etc.

2015-04-14 Thread Slava Monich
The memory leak shows up in valgrind like this: ==13796== 5,544 (1,848 direct, 3,696 indirect) bytes in 22 blocks are definitely lost in loss record 219 of 222 ==13796==at 0x483933C: malloc (vg_replace_malloc.c:296) ==13796==by 0x48B778F: g_try_malloc0 (gmem.c:280) ==13796==by 0x25C0B:

[PATCH] ipv6pd: Check timer_hash for NULL prior to destroying it

2015-04-07 Thread Slava Monich
GLib doesn't like NULL pointers. cleanup() may be invoked more than once after successful setup, first from dhcpv6_callback() and then from __connman_ipv6pd_cleanup() --- src/ipv6pd.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ipv6pd.c b/src/ipv6pd.c index 5ecda

Re: [PATCH] dnsproxy: request_data in request_list need the request data

2015-04-07 Thread Slava Monich
On 07/04/15 13:40, Jukka Rissanen wrote: > On ti, 2015-04-07 at 12:58 +0300, Slava Monich wrote: >> On 07/04/15 12:14, Patrik Flykt wrote: >>> Hi, >>> >>> On Thu, 2015-04-02 at 21:36 +0300, Slava Monich wrote: >>>> The ones received over UDP d

Re: [PATCH] service: remove_from_network should drop reference to the network

2015-04-07 Thread Slava Monich
On 07/04/15 12:42, Patrik Flykt wrote: >> @@ -6863,6 +6868,11 @@ void __connman_service_remove_from_network(struct >> connman_network *network) >> __connman_connection_gateway_remove(service, >> CONNMAN_IPCONFIG_TYPE_ALL); >> >> +if (service->network

Re: [PATCH] dnsproxy: request_data in request_list need the request data

2015-04-07 Thread Slava Monich
On 07/04/15 12:14, Patrik Flykt wrote: > Hi, > > On Thu, 2015-04-02 at 21:36 +0300, Slava Monich wrote: >> The ones received over UDP didn't have it. >> --- >> src/dnsproxy.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git

Re: [PATCH] gsupplicant: Remove unused networks

2015-04-05 Thread Slava Monich
On 02/04/15 15:15, Tomasz Bursztyka wrote: >> There are some corner cases that I have been unable to catch so far, >> which result in connman_service holding a reference to connman_network >> in connecting/associating state (albeit with driver pointer being NULL) >> but those are quite rare. That s

[PATCH] service: remove_from_network should drop reference to the network

2015-04-05 Thread Slava Monich
Otherwise the service may remain associated with a dead network. In addition to that, update_from_network() now checks that session is associated with the correct network. Without this check, association with a dead network in the connecting state was unrecoverable. --- src/service.c | 10 +++

[PATCH] agent: corrected usage of g_list_delete_link

2015-04-02 Thread Slava Monich
To avoid memory leaks. --- src/agent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/agent.c b/src/agent.c index a340026..361a5e1 100644 --- a/src/agent.c +++ b/src/agent.c @@ -521,8 +521,8 @@ void connman_agent_cancel(void *user_context)

[PATCH] dnsproxy: request_data in request_list need the request data

2015-04-02 Thread Slava Monich
The ones received over UDP didn't have it. --- src/dnsproxy.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dnsproxy.c b/src/dnsproxy.c index 9787b68..0698387 100644 --- a/src/dnsproxy.c +++ b/src/dnsproxy.c @@ -3467,6 +3467,9 @@ static bool udp_listener_event(GIOChannel *channel, GI

Re: [PATCH] gsupplicant: Remove unused networks

2015-04-02 Thread Slava Monich
On 02/04/15 13:46, Tomasz Bursztyka wrote: > Hi Slava, > It appears that the client is responsible for removing network configurations it has created, which makes sense to me. In an environment with unstable wifi reception, connman may end up creating hundreds of those in just o

Re: [PATCH] gsupplicant: Remove unused networks

2015-04-02 Thread Slava Monich
On 02/04/15 12:35, Tomasz Bursztyka wrote: > Hi Slava, > >> It appears that the client is responsible for removing network >> configurations it has created, which makes sense to me. In an >> environment with unstable wifi reception, connman may end up creating >> hundreds of those in just one day o

Re: [PATCH] inet: fixed the check of inet_pton return value

2015-04-02 Thread Slava Monich
On 02/04/15 09:14, Patrik Flykt wrote: > @@ -634,17 +634,15 @@ int connman_inet_add_ipv6_network_route(int index, > const char *host, > > rt.rtmsg_dst_len = prefix_len; > > - if (inet_pton(AF_INET6, host, &rt.rtmsg_dst) < 0) { > + if (inet_pton(AF_INET6, host, &rt.rtmsg_dst) < 1)

Re: [PATCH] gsupplicant: Remove unused networks

2015-04-02 Thread Slava Monich
On 02/04/15 09:25, Patrik Flykt wrote: > @@ -4041,6 +4046,15 @@ static void interface_add_network_result(const char > *error, > > SUPPLICANT_DBG("PATH: %s", path); > > + if (interface->network_path && strcmp(interface->network_path, path)) { > + /* Prevent unused wpa_supp

[PATCH] inet: fixed the check of inet_pton return value

2015-04-01 Thread Slava Monich
--- src/inet.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/inet.c b/src/inet.c index cd220ff..fae36a0 100644 --- a/src/inet.c +++ b/src/inet.c @@ -634,17 +634,15 @@ int connman_inet_add_ipv6_network_route(int index, const char *host, rt.rtmsg_dst_len

[PATCH] dhcpv6: fixed the check of inet_pton return value

2015-04-01 Thread Slava Monich
--- src/dhcpv6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dhcpv6.c b/src/dhcpv6.c index bdb3b98..dcf91f6 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -950,7 +950,7 @@ static void do_dad(GDHCPClient *dhcp_client, struct connman_dhcpv6 *dhcp) ref_

[PATCH] network: fixed memory leak in check_dhcpv6

2015-04-01 Thread Slava Monich
--- src/network.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/network.c b/src/network.c index f61f698..badb770 100644 --- a/src/network.c +++ b/src/network.c @@ -471,10 +471,12 @@ static void check_dhcpv6(struct nd_router_advert *reply, */ if (r

[PATCH] gsupplicant: Remove unused networks

2015-03-24 Thread Slava Monich
Remove previously created network after creating a new one. This prevents wpa_supplicant network objects (wpa_cli list_net) from piling up. --- gsupplicant/supplicant.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index cd9

[PATCH] gsupplicant: Use OPEN auth_alg for open wifi networks

2015-01-29 Thread Slava Monich
With auth_alg set to "OPEN SHARED" some drivers (particularly bcmdhd) won't connect to open wifi access points. --- gsupplicant/supplicant.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index e02a8d5..cd91f95

[PATCH] dnsproxy: Don't try to destroy NULL hashtable on exit

2015-01-28 Thread Slava Monich
glib doesn't like it. --- src/dnsproxy.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dnsproxy.c b/src/dnsproxy.c index 9d7ba61..9787b68 100644 --- a/src/dnsproxy.c +++ b/src/dnsproxy.c @@ -3872,8 +3872,10 @@ void __connman_dnsproxy_cleanup(void) ca

[PATCH] service: Hold a reference to the service while disconnecting

2015-01-21 Thread Slava Monich
Otherwise it could be deallocated by __connman_network_disconnect meaning that all subsequent references to it will access freed memory --- src/service.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/service.c b/src/service.c index 9bba227..7e6cd7a 10064

[PATCH] Hold a reference to the service while disconnecting

2015-01-21 Thread Slava Monich
=5339== by 0x57DAB: __connman_device_disable (device.c:247) ... Slava Monich (1): service: Hold a reference to the service while disconnecting src/service.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) -- 1.8.3.2 ___ connm

Re: [PATCH 1/2] plugins: Add logcontrol plugin

2015-01-20 Thread Slava Monich
This plugin implements net.connman.DebugLog D-Bus interface which allows changing debug log settings at runtime without restarting connman. --- Makefile.plugins | 5 ++ configure.ac | 5 ++ plugins/logcontrol.c | 198 +++ 3 fil

[PATCH 2/2] doc: Add net.connman.DebugLog API documentation

2015-01-19 Thread Slava Monich
--- doc/logcontrol-api.txt | 22 ++ 1 file changed, 22 insertions(+) create mode 100644 doc/logcontrol-api.txt diff --git a/doc/logcontrol-api.txt b/doc/logcontrol-api.txt new file mode 100644 index 000..c9fdae3 --- /dev/null +++ b/doc/logcontrol-api.txt @@ -0,0 +1,22 @@

[PATCH 1/2] plugins: Add logcontrol plugin

2015-01-19 Thread Slava Monich
[enable_tools=${enableval}]) diff --git a/plugins/logcontrol.c b/plugins/logcontrol.c new file mode 100644 index 000..203fe7b --- /dev/null +++ b/plugins/logcontrol.c @@ -0,0 +1,198 @@ +/* + * + * Connection Manager + * + * Copyright (C) 2015 Jolla Ltd. All rights reserved. +

[PATCH 0/2] Debug log control API

2015-01-19 Thread Slava Monich
n the situations when connman breaks in the production environment, where logs are not enabled at startup. By default this plugin is not compiled in. It needs to be explicitely enabled with --enable-logcontrol configure switch. Slava Monich (2): plugins: Add logcontrol plugin doc

[PATCH] ofono: Fix memory leak

2014-11-07 Thread Slava Monich
Free connman_ipaddress prior to allocating the new one. --- plugins/ofono.c | 8 1 file changed, 8 insertions(+) diff --git a/plugins/ofono.c b/plugins/ofono.c index 7af551b..7a8442b 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -755,6 +755,10 @@ static void extract_ipv4_settings

[PATCH] gweb: Don't close socket descriptor handed over to GIOChannel

2014-09-18 Thread Slava Monich
Otherwise the channel will close it again when being deallocated. --- gweb/gweb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gweb/gweb.c b/gweb/gweb.c index f6828cf..dcb0549 100644 --- a/gweb/gweb.c +++ b/gweb/gweb.c @@ -1075,7 +1075,8 @@ static int connect_session_trans

[PATCH pacrunner] client: Detach threads since they are never joined

2014-09-03 Thread Slava Monich
By default, a new thread is created in a joinable state. --- src/client.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client.c b/src/client.c index d354c2b..603f4a6 100644 --- a/src/client.c +++ b/src/client.c @@ -84,6 +84,8 @@ static DBusMessage *find_proxy_for_

Re: [PATCH] client: Detach threads since they are never joined

2014-09-01 Thread Slava Monich
On 01/09/14 16:23, Patrik Flykt wrote: Hi, On Mon, 2014-09-01 at 15:52 +0300, Slava Monich wrote: On 01/09/14 13:16, Patrik Flykt wrote: On Sat, 2014-08-30 at 15:15 +0300, Slava Monich wrote: This is for pacrunner. More motivation in here why this patch is good, please. Cheers

Re: [PATCH] client: Detach threads since they are never joined

2014-09-01 Thread Slava Monich
On 01/09/14 13:16, Patrik Flykt wrote: On Sat, 2014-08-30 at 15:15 +0300, Slava Monich wrote: This is for pacrunner. More motivation in here why this patch is good, please. Cheers, Patrik A thread may either be/joinable/ or/detached/. If a thread is joinable, then

[PATCH] client: Detach threads since they are never joined

2014-08-30 Thread Slava Monich
This is for pacrunner. --- src/client.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client.c b/src/client.c index d354c2b..8d1e22b 100644 --- a/src/client.c +++ b/src/client.c @@ -84,6 +84,7 @@ static DBusMessage *find_proxy_for_url(DBusConnection *conn,

Re: [PATCH] service: cancel agent requests prior to deleting wispr context

2014-06-26 Thread Slava Monich
On 26/06/14 11:12, Tomasz Bursztyka wrote: Hi, - connman_agent_cancel(service); >+__connman_wispr_stop(service); Just adding __connman_wispr_stop() should do the trick here. It could. However, if connman_agent_cancel() must be invoked every time __connman_wispr_stop() is called then

Re: [PATCH] service: cancel agent requests prior to deleting wispr context

2014-06-26 Thread Slava Monich
On 26/06/14 10:30, Tomasz Bursztyka wrote: Hi, -connman_agent_cancel(service); >+__connman_wispr_stop(service); Just adding __connman_wispr_stop() should do the trick here. It could. However, if connman_agent_cancel() must be invoked every time __connman_wispr_stop() is called the

Re: [PATCH] service: cancel agent requests prior to deleting wispr context

2014-06-26 Thread Slava Monich
On 26/06/14 10:13, Patrik Flykt wrote: On Wed, 2014-06-25 at 18:56 +0300, Slava Monich wrote: Calling __connman_wispr_stop() without connman_agent_cancel() allows pending wispr requests to complete later which results in a read/write access to the freed memory and a subsequent crash. Which

[PATCH] service: cancel agent requests prior to deleting wispr context

2014-06-25 Thread Slava Monich
Calling __connman_wispr_stop() without connman_agent_cancel() allows pending wispr requests to complete later which results in a read/write access to the freed memory and a subsequent crash. Calling connman_agent_cancel() without __connman_wispr_stop() stops the wispr sequence which renders the wi

Re: [PATCH] service: check service->pending for NULL

2014-06-24 Thread Slava Monich
Hi, +++ b/src/service.c @@ -4022,8 +4022,10 @@ static DBusMessage *connect_service(DBusConnection *conn, if (err == -EINPROGRESS) return NULL; -dbus_message_unref(service->pending); -service->pending = NULL; +if (service->pending) { +dbus_message_unref(s

[PATCH] service: check service->pending for NULL

2014-06-24 Thread Slava Monich
connect_service() calls __connman_service_connect() which may in turn call reply_pending() which unrefs service->pending and sets it to NULL. Therefore, connect_service() needs to check service->pending for NULL prior to calling dbus_message_unref() on it. --- src/service.c | 6 -- 1 file chan

[PATCH] log: allow disabling certain logs

2014-06-06 Thread Slava Monich
Log patterns prefixed with ! disable the logging. That makes it possible to enable logs everywhere except for the specific files which don't interest the person doing the debugging. --- src/log.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/log.c b/