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. [PATCHv2] gdhcp: Don't try to remove timer again (Saurav Babu)
   2. [PATCH] config: Use g_try_malloc0 instead of g_malloc0
      (Niraj Kumar Goit)
   3. Re: [PATCHv2] gdhcp: Don't try to remove timer again
      (Patrik Flykt)
   4. [PATCHv2] gdhcp: Don't try to remove timer again (Saurav Babu)
   5. Re: [PATCH] config: Use g_try_malloc0 instead of g_malloc0
      (Patrik Flykt)


----------------------------------------------------------------------

Message: 1
Date: Mon, 25 Jan 2016 16:28:37 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCHv2] gdhcp: Don't try to remove timer again
Message-ID:
        <[email protected]>

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 explicitly sets dhcp_client->timeout to 0 in
discover_timeout() and ipv4ll_announce_timeout() function.
---
 gdhcp/client.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdhcp/client.c b/gdhcp/client.c
index f9cba89..a0adb65 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -2625,6 +2625,7 @@ static gboolean discover_timeout(gpointer user_data)
         * if the server is non-authoritative it will ignore the request if the
         * option is present.
         */
+       dhcp_client->timeout = 0;
        g_dhcp_client_start(dhcp_client, NULL);
 
        return FALSE;
@@ -2681,6 +2682,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;
 }
-- 
1.9.1



------------------------------

Message: 2
Date: Mon, 25 Jan 2016 17:40:05 +0530
From: Niraj Kumar Goit <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] config: Use g_try_malloc0 instead of g_malloc0
Message-ID: <[email protected]>

---
 src/config.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/config.c b/src/config.c
index 344b8ce..3e30847 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1328,7 +1328,10 @@ static int try_provision_service(struct 
connman_config_service *config,
        if (config->virtual) {
                struct connect_virtual *virtual;
 
-               virtual = g_malloc0(sizeof(struct connect_virtual));
+               virtual = g_try_malloc0(sizeof(struct connect_virtual));
+               if(!virtual)
+                       return -ENOMEM;
+
                virtual->service = service;
                virtual->vfile = config->virtual_file;
 
-- 
1.7.9.5




------------------------------

Message: 3
Date: Mon, 25 Jan 2016 14:24:18 +0200
From: Patrik Flykt <[email protected]>
To: Saurav Babu <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCHv2] gdhcp: Don't try to remove timer again
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Mon, 2016-01-25 at 16:28 +0530, Saurav Babu wrote:
> 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 explicitly sets dhcp_client->timeout to 0 in
> discover_timeout() and ipv4ll_announce_timeout() function.
> ---

The commit message may still be correct for both versions of the patch,
but please add an explanation about the differences between these two
versions here after the '--'. Usually a new version requires some part
of the commit message to be amended...

Cheers,

        Patrik

>  gdhcp/client.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/gdhcp/client.c b/gdhcp/client.c
> index f9cba89..a0adb65 100644
> --- a/gdhcp/client.c
> +++ b/gdhcp/client.c
> @@ -2625,6 +2625,7 @@ static gboolean discover_timeout(gpointer user_data)
>        * if the server is non-authoritative it will ignore the request if the
>        * option is present.
>        */
> +     dhcp_client->timeout = 0;
>       g_dhcp_client_start(dhcp_client, NULL);
>  
>       return FALSE;
> @@ -2681,6 +2682,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;
>  }




------------------------------

Message: 4
Date: Mon, 25 Jan 2016 18:04:15 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCHv2] gdhcp: Don't try to remove timer again
Message-ID: <[email protected]>

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 explicitly sets dhcp_client->timeout to 0 in
discover_timeout() and ipv4ll_announce_timeout() function.
---

dhcp_client->timeout must be assigned to 0 before g_dhcp_client_start() because
there is a possibility that dhcp_client->timeout is started again in
g_dhcp_client_start() if dhcp_client->retry_times is not equal to 
DISCOVER_RETRIES.
In earlier patch dhcp_client->timeout value was again set to 0 after the 
timeout was
started properly.
 gdhcp/client.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdhcp/client.c b/gdhcp/client.c
index f9cba89..a0adb65 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -2625,6 +2625,7 @@ static gboolean discover_timeout(gpointer user_data)
         * if the server is non-authoritative it will ignore the request if the
         * option is present.
         */
+       dhcp_client->timeout = 0;
        g_dhcp_client_start(dhcp_client, NULL);
 
        return FALSE;
@@ -2681,6 +2682,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;
 }
-- 
1.9.1



------------------------------

Message: 5
Date: Mon, 25 Jan 2016 14:38:04 +0200
From: Patrik Flykt <[email protected]>
To: Niraj Kumar Goit <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] config: Use g_try_malloc0 instead of g_malloc0
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"


        Hi,

On Mon, 2016-01-25 at 17:40 +0530, Niraj Kumar Goit wrote:
> ---
>  src/config.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/config.c b/src/config.c
> index 344b8ce..3e30847 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -1328,7 +1328,10 @@ static int try_provision_service(struct 
> connman_config_service *config,
>       if (config->virtual) {
>               struct connect_virtual *virtual;
>  
> -             virtual = g_malloc0(sizeof(struct connect_virtual));
> +             virtual = g_try_malloc0(sizeof(struct connect_virtual));

ConnMan is in really big trouble if allocation of 16 bytes fails.
Nothing will work if the memory is exahausted anyway, so aborting from
g_malloc0 is a reasonable option here.

> +             if(!virtual)
> +                     return -ENOMEM;
> +

That said, these checks are then totally unnecessary for small sizes.
Especially here, as the allocation lives only for one iteration over the
main loop using g_timeout_add(0, ...).

When the requested size with g_malloc is always greater than zero, it
must have succeeded if we can check it... So these patches should
instead clean up unnecessary NULL checks when using g_malloc on small
memory allocations.

>               virtual->service = service;
>               virtual->vfile = config->virtual_file;
>  

        Patrik



------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 3, Issue 19
**************************************

Reply via email to