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. Re: [PATCH] wifi:Get interface name provided by netlink in
      src/device.c (Patrik Flykt)
   2. Re: [PATCH] client: Corrected format specifier for
      DBUS_TYPE_UINT64. (Patrik Flykt)
   3. Re: [PATCHv3 0/5] vpn: Add support for tap devices (Patrik Flykt)
   4. Re: [PATCH] connman.service: Add CAP_SYS_MODULE to enable
      module loading (Patrik Flykt)
   5. Re: [PATCH] test: Correct format specifier used in printf for
      int and unsigned int (Patrik Flykt)
   6. Re: [PATCH] iptables-unit: Fixed dereferencing null pointer
      in assert_rule() (Patrik Flykt)
   7. Re: [PATCH] Fix memory leak when realloc fails (Patrik Flykt)
   8. [PATCHv2] Fix memory leak when realloc fails (Nishant Chaprana)


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

Message: 1
Date: Tue, 08 Mar 2016 13:49:15 +0200
From: Patrik Flykt <[email protected]>
To: Niraj Kumar Goit <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] wifi:Get interface name provided by netlink in
        src/device.c
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Fri, 2016-03-04 at 11:18 +0530, Niraj Kumar Goit wrote:
> connman/TODO: Instead of using ioctls in connman_inet_ifname,
> utilize the information already provided by netlink in src/device.c.
> ---
>  plugins/wifi.c |    8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/plugins/wifi.c b/plugins/wifi.c
> index bb1cabc..1e5ec52 100644
> --- a/plugins/wifi.c
> +++ b/plugins/wifi.c
> @@ -1479,25 +1479,21 @@ static void interface_create_callback(int result,
>  static int wifi_enable(struct connman_device *device)
>  {
>       struct wifi_data *wifi = connman_device_get_data(device);
> -     int index;
> -     char *interface;
> +     const char *interface = connman_device_get_string(device, "Interface");

This won't work. It will return the interface name at the time of
creation of struct connman_device. RTNL can update this at any later
point, and therefore the interface name might not exist anymore as it is
not updated.

>       const char *driver = connman_option_get_string("wifi");
>       int ret;
>  
>       DBG("device %p %p", device, wifi);
>  
> -     index = connman_device_get_index(device);

There is a TODO file entry for implementing this in a non-ioctl way.

> -     if (!wifi || index < 0)
> +     if (!wifi)
>               return -ENODEV;
>  
>       if (is_p2p_connecting())
>               return -EINPROGRESS;
>  
> -     interface = connman_inet_ifname(index);
>       ret = g_supplicant_interface_create(interface, driver, NULL,
>                                               interface_create_callback,
>                                                       wifi);
> -     g_free(interface);
>  
>       if (ret < 0)
>               return ret;

        Patrik



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

Message: 2
Date: Tue, 08 Mar 2016 13:49:52 +0200
From: Patrik Flykt <[email protected]>
To: Niraj Kumar Goit <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] client: Corrected format specifier for
        DBUS_TYPE_UINT64.
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Fri, 2016-03-04 at 12:02 +0530, Niraj Kumar Goit wrote:
> ---
>  client/dbus_helpers.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/client/dbus_helpers.c b/client/dbus_helpers.c
> index 461266c..1ba7e6f 100644
> --- a/client/dbus_helpers.c
> +++ b/client/dbus_helpers.c
> @@ -116,7 +116,7 @@ void __connmanctl_dbus_print(DBusMessageIter *iter, const 
> char *pre,
>  
>               case DBUS_TYPE_UINT64:
>                       dbus_message_iter_get_basic(iter, &u64);
> -                     fprintf(stdout, "%lu", u64);
> +                     fprintf(stdout, "%llu", u64);

No. grep for PRIu64 in the code.

>                       break;
>  
>               case DBUS_TYPE_DOUBLE:

        Patrik



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

Message: 3
Date: Tue, 08 Mar 2016 16:00:22 +0200
From: Patrik Flykt <[email protected]>
To: Hendrik Donner <[email protected]>
Cc: [email protected]
Subject: Re: [PATCHv3 0/5] vpn: Add support for tap devices
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Wed, 2016-03-02 at 23:31 +0100, Hendrik Donner wrote:
> Updated patch series for VPN tap device support.
> 
> The first three patches add general support for tap device creation and the 
> OpenVPN configuration part. I successfully tested this part against my own 
> OpenVPN server.
> 
> The last two patches add the VPNC configuration part. I could only compile 
> test those changes.
> 
> v3:
> - rename VPNC.InterfaceMode to VPNC.DeviceType 
> - only allow tun or tap for {OpenVPN,VPNC}.DeviceType, fallback to tun and 
> print
>   a warning for bad values
> - rework VPNC device handling to mirror the OpenVPN device handling, that 
> should
>   actually work now

Applied, many thanks! I also updated the commit message on patch 5/5.

        Patrik



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

Message: 4
Date: Tue, 08 Mar 2016 16:00:42 +0200
From: Patrik Flykt <[email protected]>
To: [email protected]
Subject: Re: [PATCH] connman.service: Add CAP_SYS_MODULE to enable
        module loading
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Tue, 2016-03-08 at 12:11 +0200, Patrik Flykt wrote:
> If iptables functionality is built as modules and the modules are not yet
> loaded, add CAP_SYS_MODULE capability to allow ConnMan to load any
> modules necessary when tethering.
> 
> Reported by Brian H. Anderson

Applied.

        Patrik



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

Message: 5
Date: Tue, 08 Mar 2016 16:07:15 +0200
From: Patrik Flykt <[email protected]>
To: Nishant Chaprana <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] test: Correct format specifier used in printf for
        int and unsigned int
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Mon, 2016-02-29 at 17:23 +0530, Nishant Chaprana wrote:
> ---
>  tools/addr-test.c  | 2 +-
>  tools/stats-tool.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/addr-test.c b/tools/addr-test.c
> index 273ab02..5d53fa7 100644
> --- a/tools/addr-test.c
> +++ b/tools/addr-test.c
> @@ -59,7 +59,7 @@ int main(int argc, char *argv[])
>       for (i = 0; i < 4; i++) {
>               len = (i + 1) * 8;
>               addr.s_addr = htonl(~(0xfffffffflu >> len));
> -             printf("prefixlen %-2u  netmask %s\n", len, inet_ntoa(addr));
> +             printf("prefixlen %-2d  netmask %s\n", len, inet_ntoa(addr));
>       }
>  
>       return 0;
> diff --git a/tools/stats-tool.c b/tools/stats-tool.c
> index b076478..f773413 100644
> --- a/tools/stats-tool.c
> +++ b/tools/stats-tool.c
> @@ -277,9 +277,9 @@ static void stats_hdr_info(struct stats_file *file)
>               get_index(file, begin), hdr->begin);
>       printf("  end             [%d] 0x%08x\n",
>               get_index(file, end), hdr->end);
> -     printf("  home            [%d] 0x%08x\n",
> +     printf("  home            [%u] 0x%08x\n",
>               home_idx, hdr->home);
> -     printf("  roaming         [%d] 0x%08x\n\n",
> +     printf("  roaming         [%u] 0x%08x\n\n",
>               roaming_idx, hdr->roaming);
>  

There is some additional confusion in the tools code. roaming_idx and
home_idx are unsigned ints, but get_index() is returning an int so
something more needs fixing.

        Patrik






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

Message: 6
Date: Tue, 08 Mar 2016 16:13:39 +0200
From: Patrik Flykt <[email protected]>
To: Nishant Chaprana <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] iptables-unit: Fixed dereferencing null pointer
        in assert_rule()
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Tue, 2016-03-01 at 15:18 +0530, Nishant Chaprana wrote:
> ---
>  tools/iptables-unit.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/iptables-unit.c b/tools/iptables-unit.c
> index 9c09867..d261106 100644
> --- a/tools/iptables-unit.c
> +++ b/tools/iptables-unit.c
> @@ -43,15 +43,14 @@ static bool assert_rule(const char *table_name, const 
> char *rule)
>  
>       for (i = 0; lines[i]; i++) {
>               DBG("lines[%02d]: %s\n", i, lines[i]);
> -             if (g_strcmp0(lines[i], rule) == 0)
> -                     break;
> +             if (g_strcmp0(lines[i], rule) == 0) {
> +                     g_strfreev(lines);
> +                     return true;
> +             }
>       }
> -     g_strfreev(lines);
> -
> -     if (!lines[i])
> -             return false;
>  
> -     return true;
> +     g_strfreev(lines);
> +     return false;
>  }

This were to be a bit shorter and less code paths with returning a value
set as 'ret = (lines && lines[i])'.

        Patrik

>  
>  static void assert_rule_exists(const char *table_name, const char *rule)




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

Message: 7
Date: Tue, 08 Mar 2016 16:18:23 +0200
From: Patrik Flykt <[email protected]>
To: Nishant Chaprana <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] Fix memory leak when realloc fails
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Thu, 2016-03-03 at 18:06 +0530, Nishant Chaprana wrote:
> ---
>  src/inet.c         |  8 +++++++-
>  vpn/vpn-provider.c | 11 +++++++++--
>  2 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/src/inet.c b/src/inet.c
> index dc788ea..f6b3466 100644
> --- a/src/inet.c
> +++ b/src/inet.c
> @@ -2648,8 +2648,14 @@ char **__connman_inet_get_running_interfaces(void)
>  
>       g_free(ifr);
>  
> -     if (count < numif)
> +     if (count < numif) {
> +             char **tmp_result = result;
>               result = g_try_realloc(result, (count + 1) * sizeof(char *));
> +             if (!result) {
> +                     g_free(tmp_result);

I'm nitpicking now, but 'tmp_result' sticks me in they eye as being of
any temporary kind and not something that needs to be taken care of. How
about renaming this to 'prev_result', so that it'd communicate something
that was there previously?

        Patrik


> +                     goto error;
> +             }
> +     }
>  
>       return result;
>  
> diff --git a/vpn/vpn-provider.c b/vpn/vpn-provider.c
> index afd7ca6..30c78db 100644
> --- a/vpn/vpn-provider.c
> +++ b/vpn/vpn-provider.c
> @@ -811,16 +811,20 @@ static gchar **create_network_list(GSList *networks, 
> gsize *count)
>  {
>       GSList *list;
>       gchar **result = NULL;
> +     gchar **tmp_result;
>       unsigned int num_elems = 0;
>  
>       for (list = networks; list; list = g_slist_next(list)) {
>               struct vpn_route *route = list->data;
>               int family;
>  
> +             tmp_result = result;
>               result = g_try_realloc(result,
>                               (num_elems + 1) * sizeof(gchar *));
> -             if (!result)
> +             if (!result) {
> +                     g_free(tmp_result);
>                       return NULL;
> +             }
>  
>               switch (route->family) {
>               case AF_INET:
> @@ -841,9 +845,12 @@ static gchar **create_network_list(GSList *networks, 
> gsize *count)
>               num_elems++;
>       }
>  
> +     tmp_result = result;
>       result = g_try_realloc(result, (num_elems + 1) * sizeof(gchar *));
> -     if (!result)
> +     if (!result) {
> +             g_free(tmp_result);
>               return NULL;
> +     }
>  
>       result[num_elems] = NULL;
>       *count = num_elems;




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

Message: 8
Date: Tue, 08 Mar 2016 20:23:18 +0530
From: Nishant Chaprana <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCHv2] Fix memory leak when realloc fails
Message-ID: <[email protected]>

---
 src/inet.c         |  8 +++++++-
 vpn/vpn-provider.c | 11 +++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/inet.c b/src/inet.c
index dc788ea..69ded19 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -2648,8 +2648,14 @@ char **__connman_inet_get_running_interfaces(void)
 
        g_free(ifr);
 
-       if (count < numif)
+       if (count < numif) {
+               char **prev_result = result;
                result = g_try_realloc(result, (count + 1) * sizeof(char *));
+               if (!result) {
+                       g_free(prev_result);
+                       goto error;
+               }
+       }
 
        return result;
 
diff --git a/vpn/vpn-provider.c b/vpn/vpn-provider.c
index afd7ca6..2c717fc 100644
--- a/vpn/vpn-provider.c
+++ b/vpn/vpn-provider.c
@@ -811,16 +811,20 @@ static gchar **create_network_list(GSList *networks, 
gsize *count)
 {
        GSList *list;
        gchar **result = NULL;
+       gchar **prev_result;
        unsigned int num_elems = 0;
 
        for (list = networks; list; list = g_slist_next(list)) {
                struct vpn_route *route = list->data;
                int family;
 
+               prev_result = result;
                result = g_try_realloc(result,
                                (num_elems + 1) * sizeof(gchar *));
-               if (!result)
+               if (!result) {
+                       g_free(prev_result);
                        return NULL;
+               }
 
                switch (route->family) {
                case AF_INET:
@@ -841,9 +845,12 @@ static gchar **create_network_list(GSList *networks, gsize 
*count)
                num_elems++;
        }
 
+       prev_result = result;
        result = g_try_realloc(result, (num_elems + 1) * sizeof(gchar *));
-       if (!result)
+       if (!result) {
+               g_free(prev_result);
                return NULL;
+       }
 
        result[num_elems] = NULL;
        *count = num_elems;
-- 
1.9.1



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

Subject: Digest Footer

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


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

End of connman Digest, Vol 5, Issue 11
**************************************

Reply via email to