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] Add the missing function item of xtables to match
      iptables1.6 (Wu Zheng)
   2. Re: [PATCH] Add the missing function item of xtables to match
      iptables1.6 (Patrik Flykt)
   3. Re: [PATCH] commands: Fix memory leak (Patrik Flykt)
   4. Re: [PATCH] commands: Fix memory leak (Patrik Flykt)
   5. Re: [PATCHv2] gdhcp: Don't try to remove timer again
      (Patrik Flykt)
   6. [PATCH] Add the missing function item of xtables to match
      iptables1.6 (Wu Zheng)
   7. Re: [PATCH] guspplicant: Fix dereferencing of NULL pointer.
      (Patrik Flykt)
   8. Re: [PATCH] iptables: Fix possible memory leak (Patrik Flykt)
   9. Re: [PATCH] bluetooth: Fix Memory Leak (Patrik Flykt)
  10. Re: [PATCH] Add the missing function item of xtables to match
      iptables1.6 (Patrik Flykt)


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

Message: 1
Date: Thu, 28 Jan 2016 11:34:57 +0800
From: Wu Zheng <[email protected]>
To: [email protected]
Subject: [PATCH] Add the missing function item of xtables to match
        iptables1.6
Message-ID: <[email protected]>

The struct of xtables_globals has been modified in iptables1.6.
If connman runs with iptables1.6, it can crash.

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
0xb7dea89c in xtables_find_target () from /usr/lib/libxtables.so.11
0xb7deac1c in ?? () from /usr/lib/libxtables.so.11
0xb7dea793 in xtables_find_target () from /usr/lib/libxtables.so.11

The the missing function item of xtables is added to xtables_globals.
It can fix the above issue.
---
 Makefile.am    | 7 ++++---
 configure.ac   | 7 +++++++
 src/iptables.c | 3 +++
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index d70725c..f855d60 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -206,7 +206,7 @@ build_vpn_plugindir = $(vpn_plugindir)
 endif
 endif
 
-AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
+AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ @XTABLES_160_CFLAGS@ \
                                @GNUTLS_CFLAGS@ $(builtin_cflags) \
                                -DCONNMAN_PLUGIN_BUILTIN \
                                -DSTATEDIR=\""$(statedir)"\" \
@@ -223,7 +223,8 @@ else
 AM_CPPFLAGS = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/gdbus
 endif
 
-src_connmand_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
+src_connmand_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \
+                               @XTABLES_CFLAGS@ @XTABLES_160_CFLAGS@ \
                                @GNUTLS_CFLAGS@ $(builtin_cflags) \
                                -DCONNMAN_PLUGIN_BUILTIN \
                                -DSTATEDIR=\""$(statedir)"\" \
@@ -341,7 +342,7 @@ tools_session_test_SOURCES = $(backtrace_sources) src/log.c 
src/dbus.c src/error
 tools_session_test_LDADD = gdbus/libgdbus-internal.la \
                                @GLIB_LIBS@ @DBUS_LIBS@ -ldl
 
-tools_iptables_unit_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
+tools_iptables_unit_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ 
@XTABLES_160_CFLAGS@ \
                -DIPTABLES_SAVE=\""${IPTABLES_SAVE}"\"
 tools_iptables_unit_SOURCES = $(backtrace_sources) src/log.c \
                 src/iptables.c src/firewall.c src/nat.c tools/iptables-unit.c
diff --git a/configure.ac b/configure.ac
index 9a5a70e..ff1fee7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -270,6 +270,13 @@ PKG_CHECK_MODULES(XTABLES, xtables >= 1.4.11, dummy=yes,
 AC_SUBST(XTABLES_CFLAGS)
 AC_SUBST(XTABLES_LIBS)
 
+PKG_CHECK_MODULES(XTABLES_160, xtables >= 1.6.0, xtables_compat=1,
+                               xtables_compat=0)
+if test "$xtables_compat" -ne 0; then
+       XTABLES_160_CFLAGS="-DXTCOMPAT"
+       AC_SUBST(XTABLES_160_CFLAGS)
+fi
+
 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
                [enable test/example scripts]), [enable_test=${enableval}])
 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
diff --git a/src/iptables.c b/src/iptables.c
index fa2f05b..0ac1a9a 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -1566,6 +1566,9 @@ struct xtables_globals iptables_globals = {
        .option_offset = 0,
        .opts = iptables_opts,
        .orig_opts = iptables_opts,
+#ifdef XTCOMPAT
+       .compat_rev = xtables_compatible_revision,
+#endif
 };
 
 static struct xtables_target *prepare_target(struct connman_iptables *table,
-- 
2.1.4



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

Message: 2
Date: Thu, 28 Jan 2016 11:13:40 +0200
From: Patrik Flykt <[email protected]>
To: Wu Zheng <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] Add the missing function item of xtables to match
        iptables1.6
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Thu, 2016-01-28 at 11:34 +0800, Wu Zheng wrote:
> The struct of xtables_globals has been modified in iptables1.6.
> If connman runs with iptables1.6, it can crash.
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000 in ?? ()
> 0xb7dea89c in xtables_find_target () from /usr/lib/libxtables.so.11
> 0xb7deac1c in ?? () from /usr/lib/libxtables.so.11
> 0xb7dea793 in xtables_find_target () from /usr/lib/libxtables.so.11
> 
> The the missing function item of xtables is added to xtables_globals.
> It can fix the above issue.
> ---
>  Makefile.am    | 7 ++++---
>  configure.ac   | 7 +++++++
>  src/iptables.c | 3 +++
>  3 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index d70725c..f855d60 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -206,7 +206,7 @@ build_vpn_plugindir = $(vpn_plugindir)
>  endif
>  endif
>  
> -AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
> +AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ 
> @XTABLES_160_CFLAGS@ \
>                               @GNUTLS_CFLAGS@ $(builtin_cflags) \
>                               -DCONNMAN_PLUGIN_BUILTIN \
>                               -DSTATEDIR=\""$(statedir)"\" \
> @@ -223,7 +223,8 @@ else
>  AM_CPPFLAGS = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/gdbus
>  endif
>  
> -src_connmand_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
> +src_connmand_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \
> +                             @XTABLES_CFLAGS@ @XTABLES_160_CFLAGS@ \
>                               @GNUTLS_CFLAGS@ $(builtin_cflags) \
>                               -DCONNMAN_PLUGIN_BUILTIN \
>                               -DSTATEDIR=\""$(statedir)"\" \
> @@ -341,7 +342,7 @@ tools_session_test_SOURCES = $(backtrace_sources) 
> src/log.c src/dbus.c src/error
>  tools_session_test_LDADD = gdbus/libgdbus-internal.la \
>                               @GLIB_LIBS@ @DBUS_LIBS@ -ldl
>  
> -tools_iptables_unit_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
> +tools_iptables_unit_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ 
> @XTABLES_160_CFLAGS@ \
>               -DIPTABLES_SAVE=\""${IPTABLES_SAVE}"\"
>  tools_iptables_unit_SOURCES = $(backtrace_sources) src/log.c \
>                src/iptables.c src/firewall.c src/nat.c tools/iptables-unit.c
> diff --git a/configure.ac b/configure.ac
> index 9a5a70e..ff1fee7 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -270,6 +270,13 @@ PKG_CHECK_MODULES(XTABLES, xtables >= 1.4.11, dummy=yes,
>  AC_SUBST(XTABLES_CFLAGS)
>  AC_SUBST(XTABLES_LIBS)
>  
> +PKG_CHECK_MODULES(XTABLES_160, xtables >= 1.6.0, xtables_compat=1,
> +                             xtables_compat=0)
> +if test "$xtables_compat" -ne 0; then
> +     XTABLES_160_CFLAGS="-DXTCOMPAT"
> +     AC_SUBST(XTABLES_160_CFLAGS)
> +fi
> +
>  AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
>               [enable test/example scripts]), [enable_test=${enableval}])
>  AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
> diff --git a/src/iptables.c b/src/iptables.c
> index fa2f05b..0ac1a9a 100644
> --- a/src/iptables.c
> +++ b/src/iptables.c
> @@ -1566,6 +1566,9 @@ struct xtables_globals iptables_globals = {
>       .option_offset = 0,
>       .opts = iptables_opts,
>       .orig_opts = iptables_opts,
> +#ifdef XTCOMPAT
> +     .compat_rev = xtables_compatible_revision,
> +#endif
>  };

Just like last time 7fb2ea5945d8b5d0e5daeabc38d09ac188b0e8b8 it's much
easier to do only an #if XTABLES_VERSION_CODE > 10 here
(XTABLES_VERSION_CODE is defined in /usr/include/xtables-version.h).

With that one should not need all the other changes to build files.
 
>  static struct xtables_target *prepare_target(struct connman_iptables *table,

        Patrik



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

Message: 3
Date: Thu, 28 Jan 2016 11:26:34 +0200
From: Patrik Flykt <[email protected]>
To: Niraj Kumar Goit <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] commands: Fix memory leak
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Sun, 2016-01-24 at 16:24 +0530, Niraj Kumar Goit wrote:
> In cmd_service_move_before() function, memory is allocated to services
> struct but not freed in case of error.
> ---
>  client/commands.c |   12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/client/commands.c b/client/commands.c
> index db24d16..cf47d4e 100644
> --- a/client/commands.c
> +++ b/client/commands.c
> @@ -797,14 +797,20 @@ static int cmd_service_move_before(char *args[], int 
> num,
>       const char *iface = "net.connman.Service";
>       struct move_service *services = g_new(struct move_service, 1);
>  
> -     if (num > 3)
> +     if (num > 3) {
> +             g_free(services);
>               return -E2BIG;
> +     }
>  
> -     if (num < 3)
> +     if (num < 3) {
> +             g_free(services);
>               return -EINVAL;
> +     }
>  
> -     if (check_dbus_name(args[1]) == false)
> +     if (check_dbus_name(args[1]) == false) {
> +             g_free(services);
>               return -EINVAL;
> +     }
>  
>       services->service = g_strdup_printf("/net/connman/service/%s", args[1]);
>       services->target = g_strdup_printf("/net/connman/service/%s", args[2]);

This is much easier if services = g_new(struct move_service, 1); is
called after all the checks.

        Patrik



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

Message: 4
Date: Thu, 28 Jan 2016 11:26:56 +0200
From: Patrik Flykt <[email protected]>
To: Niraj Kumar Goit <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] commands: Fix memory leak
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Sun, 2016-01-24 at 16:37 +0530, Niraj Kumar Goit wrote:
> In cmd_service_move_after() function, memory is allocated to
> services struct but not freed in case of error.
> ---
>  client/commands.c |   12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/client/commands.c b/client/commands.c
> index cf47d4e..b0a91eb 100644
> --- a/client/commands.c
> +++ b/client/commands.c
> @@ -861,14 +861,20 @@ static int cmd_service_move_after(char *args[], int num,
>       const char *iface = "net.connman.Service";
>       struct move_service *services = g_new(struct move_service, 1);
>  
> -     if (num > 3)
> +     if (num > 3) {
> +             g_free(services);
>               return -E2BIG;
> +     }
>  
> -     if (num < 3)
> +     if (num < 3) {
> +             g_free(services);
>               return -EINVAL;
> +     }
>  
> -     if (check_dbus_name(args[1]) == false)
> +     if (check_dbus_name(args[1]) == false) {
> +             g_free(services);
>               return -EINVAL;
> +     }
>  
>       services->service = g_strdup_printf("/net/connman/service/%s", args[1]);
>       services->target = g_strdup_printf("/net/connman/service/%s", args[2]);

Same here as in the previous patch.

        Patrik



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

Message: 5
Date: Thu, 28 Jan 2016 11:32:28 +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 18:04 +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.
> ---
> 
> 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);

This case would be more robust if g_dhcp_client_start() were to call
remove_timeouts() as it's first action. With that all possibly remaining
timeouts are properly cleared.

>  
>       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;
>  }

This one is ok.

Patrik




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

Message: 6
Date: Thu, 28 Jan 2016 18:04:17 +0800
From: Wu Zheng <[email protected]>
To: [email protected]
Subject: [PATCH] Add the missing function item of xtables to match
        iptables1.6
Message-ID: <[email protected]>

The struct of xtables_globals has been modified in iptables1.6.
If connman runs with iptables1.6, it can crash.

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
0xb7dea89c in xtables_find_target () from /usr/lib/libxtables.so.11
0xb7deac1c in ?? () from /usr/lib/libxtables.so.11
0xb7dea793 in xtables_find_target () from /usr/lib/libxtables.so.11

The the missing function item of xtables is added to xtables_globals.
It can fix the above issue.
---
 src/iptables.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/iptables.c b/src/iptables.c
index fa2f05b..6ac8e95 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -1566,6 +1566,9 @@ struct xtables_globals iptables_globals = {
        .option_offset = 0,
        .opts = iptables_opts,
        .orig_opts = iptables_opts,
+#if XTABLES_VERSION_CODE > 10
+       .compat_rev = xtables_compatible_revision,
+#endif
 };
 
 static struct xtables_target *prepare_target(struct connman_iptables *table,
-- 
2.1.4



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

Message: 7
Date: Thu, 28 Jan 2016 12:25:50 +0200
From: Patrik Flykt <[email protected]>
To: Niraj Kumar Goit <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] guspplicant: Fix dereferencing of NULL pointer.
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Fri, 2016-01-22 at 10:08 +0530, Niraj Kumar Goit wrote:
> ---
>  gsupplicant/supplicant.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
> index 342cb01..5a0a5e4 100644
> --- a/gsupplicant/supplicant.c
> +++ b/gsupplicant/supplicant.c
> @@ -3609,7 +3609,8 @@ static void interface_create_params(DBusMessageIter 
> *iter, void *user_data)
>  
>       supplicant_dbus_dict_open(iter, &dict);
>  
> -     supplicant_dbus_dict_append_basic(&dict, "Ifname",
> +     if (data->ifname)
> +             supplicant_dbus_dict_append_basic(&dict, "Ifname",
>                                       DBUS_TYPE_STRING, &data->ifname);
>  
>       if (data->driver)

Shouldn't one always have an interface name when creating an interface
for wpa_supplicant? So should the test for data->ifname be in
interface_get_result() before attempting to create the D-Bus message?

        Patrik



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

Message: 8
Date: Thu, 28 Jan 2016 12:30:10 +0200
From: Patrik Flykt <[email protected]>
To: Niraj Kumar Goit <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] iptables: Fix possible memory leak
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Fri, 2016-01-22 at 16:33 +0530, Niraj Kumar Goit wrote:
> This patch free memory allocated to cbd by cb_data_new() when
> get_table() return NULL.

Applied, thanks!

        Patrik



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

Message: 9
Date: Thu, 28 Jan 2016 12:30:24 +0200
From: Patrik Flykt <[email protected]>
To: Niraj Kumar Goit <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] bluetooth: Fix Memory Leak
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Sun, 2016-01-24 at 16:03 +0530, Niraj Kumar Goit wrote:
> tethering struct is allocated memory but not freed in case of error.

Applied, thanks!

        Patrik



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

Message: 10
Date: Thu, 28 Jan 2016 12:59:42 +0200
From: Patrik Flykt <[email protected]>
To: Wu Zheng <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] Add the missing function item of xtables to match
        iptables1.6
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Thu, 2016-01-28 at 18:04 +0800, Wu Zheng wrote:
> The struct of xtables_globals has been modified in iptables1.6.
> If connman runs with iptables1.6, it can crash.
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000 in ?? ()
> 0xb7dea89c in xtables_find_target () from /usr/lib/libxtables.so.11
> 0xb7deac1c in ?? () from /usr/lib/libxtables.so.11
> 0xb7dea793 in xtables_find_target () from /usr/lib/libxtables.so.11
> 
> The the missing function item of xtables is added to xtables_globals.
> It can fix the above issue.
> ---

Applied, thanks!

        Patrik



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

Subject: Digest Footer

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


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

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

Reply via email to