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 0/7] ACD & valgrind cleanups (Daniel Wagner)
   2. [PATCH 1/7] acd: Add acd_host_free() deallocator (Daniel Wagner)
   3. [PATCH 2/7] list-services: Decode LastAddressConflict
      (Daniel Wagner)
   4. [PATCH 3/7] main: Rename CONF_AUTO_CONNECT to
      CONF_AUTO_CONNECT_TECHS (Daniel Wagner)
   5. [PATCH 4/7] main: Reset error variable before parsing
      (Daniel Wagner)
   6. [PATCH 5/7] firewall-nftables: Disable debug output on
      default (Daniel Wagner)
   7. [PATCH 6/7] firewall-nftables: Initialize command buffers
      before using (Daniel Wagner)
   8. [PATCH 7/7] dnsproxy: Free gresolv on exit (Daniel Wagner)


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

Message: 1
Date: Sun, 26 Aug 2018 13:43:45 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH 0/7] ACD & valgrind cleanups
Message-ID: <[email protected]>

Just a bunch of cleanups and memory leak fixes.

Daniel Wagner (7):
  acd: Add acd_host_free() deallocator
  list-services: Decode LastAddressConflict
  main: Rename CONF_AUTO_CONNECT to CONF_AUTO_CONNECT_TECHS
  main: Reset error variable before parsing
  firewall-nftables: Disable debug output on default
  firewall-nftables: Initialize command buffers before using
  dnsproxy: Free gresolv on exit

 include/acd.h           |  1 +
 src/acd.c               | 12 ++++++++++--
 src/dnsproxy.c          |  5 +++++
 src/firewall-nftables.c |  8 +++++++-
 src/main.c              | 10 ++++++----
 src/network.c           |  2 +-
 test/list-services      |  5 ++++-
 7 files changed, 34 insertions(+), 9 deletions(-)

-- 
2.14.4


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

Message: 2
Date: Sun, 26 Aug 2018 13:43:46 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH 1/7] acd: Add acd_host_free() deallocator
Message-ID: <[email protected]>

Valgrind reports that we do not free acd->interface:

==13496== 5 bytes in 1 blocks are definitely lost in loss record 9 of 194
==13496==    at 0x4C2CB6B: malloc (vg_replace_malloc.c:299)
==13496==    by 0x4E89378: g_malloc (gmem.c:94)
==13496==    by 0x4EA294E: g_strdup (gstrfuncs.c:363)
==13496==    by 0x461BD4: connman_inet_ifname (inet.c:274)
==13496==    by 0x48E903: acd_host_new (acd.c:129)
==13496==    by 0x43F1DF: start_acd (network.c:384)
==13496==    by 0x43F3A2: dhcp_success (network.c:436)
==13496==    by 0x43F4BD: dhcp_callback (network.c:487)
==13496==    by 0x468A34: dhcp_valid (dhcp.c:176)
==13496==    by 0x46975B: lease_available_cb (dhcp.c:519)
==13496==    by 0x415E61: listener_event (client.c:2443)
==13496==    by 0x4E83B96: g_main_dispatch (gmain.c:3142)
==13496==    by 0x4E83B96: g_main_context_dispatch (gmain.c:3795)
---
 include/acd.h |  1 +
 src/acd.c     | 12 ++++++++++--
 src/network.c |  2 +-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/acd.h b/include/acd.h
index 0f9468d30fe1..0d777963caae 100644
--- a/include/acd.h
+++ b/include/acd.h
@@ -36,6 +36,7 @@ extern "C" {
 struct acd_host;
 
 struct acd_host *acd_host_new(int ifindex, const char* path);
+void acd_host_free(struct acd_host *acd);
 int acd_host_start(struct acd_host *acd, uint32_t ip);
 void acd_host_stop(struct acd_host *acd);
 
diff --git a/src/acd.c b/src/acd.c
index c48b07c51dcb..7ace15546d08 100644
--- a/src/acd.c
+++ b/src/acd.c
@@ -111,6 +111,15 @@ static void debug(struct acd_host *acd, const char 
*format, ...)
        va_end(ap);
 }
 
+void acd_host_free(struct acd_host *acd)
+{
+       if (!acd)
+               return;
+
+       g_free(acd->interface);
+       g_free(acd);
+}
+
 struct acd_host *acd_host_new(int ifindex, const char *path)
 {
        struct acd_host *acd;
@@ -160,8 +169,7 @@ struct acd_host *acd_host_new(int ifindex, const char *path)
        return acd;
 
 error:
-       g_free(acd->interface);
-       g_free(acd);
+       acd_host_free(acd);
        return NULL;
 }
 
diff --git a/src/network.c b/src/network.c
index dd3f238fd86c..7e5edd0418fb 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1245,7 +1245,7 @@ static void network_destruct(struct connman_network 
*network)
        g_free(network->node);
        g_free(network->name);
        g_free(network->identifier);
-       g_free(network->acd_host);
+       acd_host_free(network->acd_host);
 
        network->device = NULL;
 
-- 
2.14.4


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

Message: 3
Date: Sun, 26 Aug 2018 13:43:47 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH 2/7] list-services: Decode LastAddressConflict
Message-ID: <[email protected]>

---
 test/list-services | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/list-services b/test/list-services
index 6be4945bbaa4..a2610d7e1060 100755
--- a/test/list-services
+++ b/test/list-services
@@ -11,6 +11,8 @@ import dbus
                else:
                        if key in ["Servers", "Excludes"]:
                                val += extract_list(values[key])
+                       elif key in ["Ethernet", "IPv4"]:
+                               val += extract_values(values[key])
                        else:
                                val += str(values[key])
        val += " }"
@@ -38,7 +40,8 @@ manager = dbus.Interface(bus.get_object("net.connman", "/"),
                if key in ["IPv4", "IPv4.Configuration",
                                "IPv6", "IPv6.Configuration",
                                        "Proxy", "Proxy.Configuration",
-                                               "Ethernet", "Provider"]:
+                                       "Ethernet", "Provider",
+                                       "LastAddressConflict"]:
                        val = extract_values(properties[key])
                elif key in ["Nameservers", "Nameservers.Configuration",
                             "Domains", "Domains.Configuration",
-- 
2.14.4


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

Message: 4
Date: Sun, 26 Aug 2018 13:43:48 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH 3/7] main: Rename CONF_AUTO_CONNECT to
        CONF_AUTO_CONNECT_TECHS
Message-ID: <[email protected]>

Streamline the naming of the define with CONF_AUTO_CONNECT_TECHS,
CONF_FAVORITE_TECHS, CONF_ALWAYS_CONNECTED_TECHS and
CONF_PREFERRED_TECHS.
---
 src/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main.c b/src/main.c
index 3f8221eb0cf2..0f05ce7bffcf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -117,7 +117,7 @@ static struct {
 
 #define CONF_BG_SCAN                    "BackgroundScanning"
 #define CONF_PREF_TIMESERVERS           "FallbackTimeservers"
-#define CONF_AUTO_CONNECT               "DefaultAutoConnectTechnologies"
+#define CONF_AUTO_CONNECT_TECHS         "DefaultAutoConnectTechnologies"
 #define CONF_FAVORITE_TECHS             "DefaultFavoriteTechnologies"
 #define CONF_ALWAYS_CONNECTED_TECHS     "AlwaysConnectedTechnologies"
 #define CONF_PREFERRED_TECHS            "PreferredTechnologies"
@@ -140,7 +140,7 @@ static struct {
 static const char *supported_options[] = {
        CONF_BG_SCAN,
        CONF_PREF_TIMESERVERS,
-       CONF_AUTO_CONNECT,
+       CONF_AUTO_CONNECT_TECHS,
        CONF_ALWAYS_CONNECTED_TECHS,
        CONF_PREFERRED_TECHS,
        CONF_FALLBACK_NAMESERVERS,
@@ -311,7 +311,7 @@ static void parse_config(GKeyFile *config)
        g_clear_error(&error);
 
        str_list = __connman_config_get_string_list(config, "General",
-                       CONF_AUTO_CONNECT, &len, &error);
+                       CONF_AUTO_CONNECT_TECHS, &len, &error);
 
        if (!error)
                connman_settings.auto_connect =
@@ -715,7 +715,7 @@ char **connman_setting_get_string_list(const char *key)
 
 unsigned int *connman_setting_get_uint_list(const char *key)
 {
-       if (g_str_equal(key, CONF_AUTO_CONNECT))
+       if (g_str_equal(key, CONF_AUTO_CONNECT_TECHS))
                return connman_settings.auto_connect;
 
        if (g_str_equal(key, CONF_FAVORITE_TECHS))
-- 
2.14.4


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

Message: 5
Date: Sun, 26 Aug 2018 13:43:49 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH 4/7] main: Reset error variable before parsing
Message-ID: <[email protected]>

We need to reset the Glib's error variable before using it.
---
 src/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main.c b/src/main.c
index 0f05ce7bffcf..2e2cc4bdb057 100644
--- a/src/main.c
+++ b/src/main.c
@@ -320,6 +320,8 @@ static void parse_config(GKeyFile *config)
                connman_settings.auto_connect =
                        parse_service_types(default_auto_connect, 
CONF_ARRAY_SIZE(default_auto_connect));
 
+       g_clear_error(&error);
+
        str_list = __connman_config_get_string_list(config, "General",
                        CONF_FAVORITE_TECHS, &len, &error);
 
-- 
2.14.4


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

Message: 6
Date: Sun, 26 Aug 2018 13:43:50 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH 5/7] firewall-nftables: Disable debug output on
        default
Message-ID: <[email protected]>

There hasn't been any bug report for the nftables implementation since
the initial release. Set the default to disabled. It can be turned on
via the CONNMAN_NFTABLES_DEBUG environment variable.
---
 src/firewall-nftables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/firewall-nftables.c b/src/firewall-nftables.c
index 8ef3ba1ef04d..72611dd7e8bb 100644
--- a/src/firewall-nftables.c
+++ b/src/firewall-nftables.c
@@ -67,7 +67,7 @@
 #define CONNMAN_CHAIN_NAT_POST "nat-postrouting"
 #define CONNMAN_CHAIN_ROUTE_OUTPUT "route-output"
 
-static bool debug_enabled = true;
+static bool debug_enabled = false;
 
 struct firewall_handle {
        uint64_t handle;
-- 
2.14.4


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

Message: 7
Date: Sun, 26 Aug 2018 13:43:51 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH 6/7] firewall-nftables: Initialize command buffers
        before using
Message-ID: <[email protected]>

valgrind reports we are sending unitialized memory to the kernel.
Let's be paranoid and initialize all the buffers to 0 before using
it. We can't use the ' = { 0 }' shorthand because gcc
complains about variable lenght of the array.
---
 src/firewall-nftables.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/firewall-nftables.c b/src/firewall-nftables.c
index 72611dd7e8bb..262b2a904e9a 100644
--- a/src/firewall-nftables.c
+++ b/src/firewall-nftables.c
@@ -402,6 +402,8 @@ static int table_cmd(struct mnl_socket *nl, struct 
nftnl_table *t,
         uint32_t seq = 0;
         int err;
 
+       bzero(buf, sizeof(buf));
+
         batch = mnl_nlmsg_batch_start(buf, sizeof(buf));
         nftnl_batch_begin(mnl_nlmsg_batch_current(batch), seq++);
         mnl_nlmsg_batch_next(batch);
@@ -433,6 +435,8 @@ static int chain_cmd(struct mnl_socket *nl, struct 
nftnl_chain *chain,
         uint32_t seq = 0;
         int err;
 
+       bzero(buf, sizeof(buf));
+
         batch = mnl_nlmsg_batch_start(buf, sizeof(buf));
         nftnl_batch_begin(mnl_nlmsg_batch_current(batch), seq++);
         mnl_nlmsg_batch_next(batch);
@@ -465,6 +469,8 @@ static int rule_cmd(struct mnl_socket *nl, struct 
nftnl_rule *rule,
         uint32_t seq = 0;
         int err;
 
+       bzero(buf, sizeof(buf));
+
        debug_netlink_dump_rule(rule);
 
         batch = mnl_nlmsg_batch_start(buf, sizeof(buf));
-- 
2.14.4


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

Message: 8
Date: Sun, 26 Aug 2018 13:43:52 +0200
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH 7/7] dnsproxy: Free gresolv on exit
Message-ID: <[email protected]>

valgrind reported a leak in __connman_wpad_start(). Though the resolv
object will be reused and therefore valgrind is reported the wrong
leaker. dnsproxy happely allocates the resolver but never releases it.
---
 src/dnsproxy.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 1db3eae9cb47..fe44e79ea34b 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -3973,4 +3973,9 @@ void __connman_dnsproxy_cleanup(void)
        g_hash_table_destroy(listener_table);
 
        g_hash_table_destroy(partial_tcp_req_table);
+
+       if (ipv4_resolve)
+               g_resolv_unref(ipv4_resolve);
+       if (ipv6_resolve)
+               g_resolv_unref(ipv6_resolve);
 }
-- 
2.14.4


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

Subject: Digest Footer

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


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

End of connman Digest, Vol 34, Issue 15
***************************************

Reply via email to