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. tether question (Zheng, Wu)
2. [PATCH v4] gsupplicant: Mem leak in wpa_s because
"RemoveNetwork" not called (Naveen Singh)
3. Re: tether question (Jukka Rissanen)
4. [PATCH] src/dnsproxy.c: Use g_try_malloc instead of g_malloc
(Nishant Chaprana)
5. [PATCH] Removed false null check because context will not be
null (Nishant Chaprana)
6. [PATCH] bridge: corrected the format specifier for unsigned
int (Nishant Chaprana)
7. [PATCH] ofono: Fix inconsitent use of g_try_newo and free
(Niraj Kumar Goit)
----------------------------------------------------------------------
Message: 1
Date: Wed, 24 Feb 2016 05:07:31 +0000
From: "Zheng, Wu" <[email protected]>
To: Patrik Flykt <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: tether question
Message-ID:
<2cf57a644018a745b8fe029c7223e16e12f62...@shsmsx104.ccr.corp.intel.com>
Content-Type: text/plain; charset="us-ascii"
Hi partik,
I am trying to enable tether of connman in kernel-3.10 of edison.
Meet some issues. Please help, thanks.
I want to make sure if kernel-3.10 support the tethering feature of connman or
not?
Best Regards
Zheng Wu
------------------------------
Message: 2
Date: Tue, 23 Feb 2016 23:51:15 -0800
From: Naveen Singh <[email protected]>
To: [email protected]
Subject: [PATCH v4] gsupplicant: Mem leak in wpa_s because
"RemoveNetwork" not called
Message-ID:
<[email protected]>
From: nasingh <[email protected]>
Connman did not call netwok_remove in case AP deauthenticated client causing
wpa_s to re-allocate the ssid pointer even if the next connection attempt
is for the same SSID. This change ensures that at the time of connection
(DBUS Method call AddNetwork) if the network is found not removed, it calls
the dbus API to remove the network and once network is removed, proceed with
the connection.
By the time there is a request for connect and the network path is not NULL it
means that connman has not removed the previous network pointer. This can happen
in the case AP deauthenticated client and connman does not remove the previously
connected network pointer. This causes supplicant to reallocate the memory for
struct wpa_ssid again even if it is the same SSID. This causes memory usage of
wpa_supplicnat to go high. The idea here is that if the previously connected
network
is not removed at the time of next connection attempt check if the network path
is not
NULL. In case it is non-NULL first remove the network and then once removal is
successful,
add the network.
Tested by running a deauth loop script at the AP end and ensure that wpa_s does
not allocate memory for struct wpa_ssid for all the subsequent
connection attempts. During the test memory usage of wpa_s is monitored.
---
gsupplicant/supplicant.c | 153 ++++++++++++++++++++++++++++++++---------------
1 file changed, 105 insertions(+), 48 deletions(-)
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 342cb01..ff1d998 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -249,6 +249,47 @@ struct _GSupplicantGroup {
GSList *members;
};
+struct interface_data {
+ GSupplicantInterface *interface;
+ char *path; /* Interface path cannot be taken from interface (above) as
+ * it might have been freed already.
+ */
+ GSupplicantInterfaceCallback callback;
+ void *user_data;
+ bool network_remove_in_progress;
+ GSupplicantSSID *ssid;
+};
+
+struct interface_create_data {
+ char *ifname;
+ char *driver;
+ char *bridge;
+ GSupplicantInterface *interface;
+ GSupplicantInterfaceCallback callback;
+ void *user_data;
+};
+
+struct interface_connect_data {
+ GSupplicantInterface *interface;
+ char *path;
+ GSupplicantInterfaceCallback callback;
+ void *user_data;
+ union {
+ GSupplicantSSID *ssid;
+ GSupplicantPeerParams *peer;
+ };
+};
+
+struct interface_scan_data {
+ GSupplicantInterface *interface;
+ char *path;
+ GSupplicantInterfaceCallback callback;
+ GSupplicantScanParams *scan_params;
+ void *user_data;
+};
+
+static int network_remove(struct interface_data *data);
+
static inline void debug(const char *format, ...)
{
char str[256];
@@ -3476,43 +3517,6 @@ GSupplicantPeer
*g_supplicant_interface_peer_lookup(GSupplicantInterface *interf
return peer;
}
-struct interface_data {
- GSupplicantInterface *interface;
- char *path; /* Interface path cannot be taken from interface (above) as
- * it might have been freed already.
- */
- GSupplicantInterfaceCallback callback;
- void *user_data;
-};
-
-struct interface_create_data {
- char *ifname;
- char *driver;
- char *bridge;
- GSupplicantInterface *interface;
- GSupplicantInterfaceCallback callback;
- void *user_data;
-};
-
-struct interface_connect_data {
- GSupplicantInterface *interface;
- char *path;
- GSupplicantInterfaceCallback callback;
- union {
- GSupplicantSSID *ssid;
- GSupplicantPeerParams *peer;
- };
- void *user_data;
-};
-
-struct interface_scan_data {
- GSupplicantInterface *interface;
- char *path;
- GSupplicantInterfaceCallback callback;
- GSupplicantScanParams *scan_params;
- void *user_data;
-};
-
static void interface_create_data_free(struct interface_create_data *data)
{
g_free(data->ifname);
@@ -4105,7 +4109,6 @@ static void interface_add_network_result(const char
*error,
SUPPLICANT_DBG("PATH: %s", path);
- g_free(interface->network_path);
interface->network_path = g_strdup(path);
supplicant_dbus_method_call(data->interface->path,
@@ -4656,7 +4659,8 @@ int g_supplicant_interface_connect(GSupplicantInterface
*interface,
void *user_data)
{
struct interface_connect_data *data;
- int ret;
+ struct interface_data *intf_data;
+ int ret = 0;
if (!interface)
return -EINVAL;
@@ -4685,12 +4689,44 @@ int g_supplicant_interface_connect(GSupplicantInterface
*interface,
SUPPLICANT_INTERFACE ".Interface.WPS",
"ProcessCredentials", DBUS_TYPE_BOOLEAN_AS_STRING,
wps_process_credentials, wps_start, data, interface);
- } else
- ret = supplicant_dbus_method_call(interface->path,
- SUPPLICANT_INTERFACE ".Interface", "AddNetwork",
- interface_add_network_params,
- interface_add_network_result, data,
- interface);
+ } else {
+ /* By the time there is a request for connect and the network
+ * path is not NULL it means that connman has not removed the
+ * previous network pointer. This can happen in the case AP
+ * deauthenticated client and connman does not remove the
+ * previously connected network pointer. This causes supplicant
+ * to reallocate the memory for struct wpa_ssid again even if it
+ * is the same SSID. This causes memory usage of wpa_supplicnat
+ * to go high. The idea here is that if the previously connected
+ * network is not removed at the time of next connection attempt
+ * check if the network path is not NULL. In case it is non-NULL
+ * first remove the network and then once removal is
successful, add
+ * the network.
+ */
+
+ if (interface->network_path != NULL) {
+ g_free(data->path);
+ dbus_free(data);
+
+ intf_data = dbus_malloc0(sizeof(*intf_data));
+ if (!intf_data)
+ return -ENOMEM;
+
+ intf_data->interface = interface;
+ intf_data->path = g_strdup(interface->path);
+ intf_data->callback = callback;
+ intf_data->ssid = ssid;
+ intf_data->user_data = user_data;
+ intf_data->network_remove_in_progress = TRUE;
+ network_remove(intf_data);
+ } else {
+ ret = supplicant_dbus_method_call(interface->path,
+ SUPPLICANT_INTERFACE ".Interface",
"AddNetwork",
+ interface_add_network_params,
+ interface_add_network_result, data,
+ interface);
+ }
+ }
if (ret < 0) {
g_free(data->path);
@@ -4705,6 +4741,7 @@ static void network_remove_result(const char *error,
DBusMessageIter *iter, void *user_data)
{
struct interface_data *data = user_data;
+ struct interface_connect_data * connect_data;
int result = 0;
SUPPLICANT_DBG("");
@@ -4716,11 +4753,31 @@ static void network_remove_result(const char *error,
result = -ECONNABORTED;
}
- g_free(data->path);
+ g_free(data->interface->network_path);
+ data->interface->network_path = NULL;
- if (data->callback)
- data->callback(result, data->interface, data->user_data);
+ if (data->network_remove_in_progress == TRUE) {
+ data->network_remove_in_progress = FALSE;
+ connect_data = dbus_malloc0(sizeof(*connect_data));
+ if (!connect_data)
+ return;
+
+ connect_data->interface = data->interface;
+ connect_data->path = g_strdup(data->path);
+ connect_data->callback = data->callback;
+ connect_data->ssid = data->ssid;
+ connect_data->user_data = data->user_data;
+ supplicant_dbus_method_call(data->interface->path,
+ SUPPLICANT_INTERFACE ".Interface", "AddNetwork",
+ interface_add_network_params,
+ interface_add_network_result, connect_data,
+ connect_data->interface);
+ } else {
+ if (data->callback)
+ data->callback(result, data->interface,
data->user_data);
+ }
+ g_free(data->path);
dbus_free(data);
}
--
2.7.0.rc3.207.g0ac5344
------------------------------
Message: 3
Date: Wed, 24 Feb 2016 10:09:03 +0200
From: Jukka Rissanen <[email protected]>
To: "Zheng, Wu" <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: Re: tether question
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"
Hi,
On Wed, 2016-02-24 at 05:07 +0000, Zheng, Wu wrote:
> Hi partik,
>
> I am trying to enable tether of connman in kernel-3.10 of edison.
> Meet some issues. Please help, thanks.
>
> I want to make sure if kernel-3.10 support the tethering feature of
> connman or not?
Tethering with edison is a bit tricky because the Broadcom wifi chip
used in edison requires different firmware for AP mode. So when one
activates tethering, someone needs to load another firmware to the
chip. This cannot be connman as it does not know anything about edison.
That is why the activation of tethering needs to be initiated
differently in that device.
I have a script that can toggle the AP mode on/off, see it here
http://git.yoctoproject.org/cgit/cgit.cgi/meta-eca/tree/meta-eca/recipe
s-support/toggle-ap-mode/files/ap-mode-toggle
Because of this there is a program that monitors the power button and
toggles AP mode on/off when you press it. See detail here
http://git.yoctoproject.org/cgit/cgit.cgi/meta-eca/tree/meta-eca/recipe
s-support/pwr-button-handler/files
The issue is not really connman issue so probably this mailing list is
not a proper place to discuss this further.
Cheers,
Jukka
------------------------------
Message: 4
Date: Wed, 24 Feb 2016 18:13:59 +0530
From: Nishant Chaprana <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] src/dnsproxy.c: Use g_try_malloc instead of g_malloc
Message-ID: <[email protected]>
doc/coding-style.txt M8: Use g_try_malloc instead of g_malloc
---
src/dnsproxy.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 48fbef0..9be2918 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -1437,7 +1437,11 @@ static int cache_update(struct server_data *srv,
unsigned char *msg,
if (srv->protocol == IPPROTO_UDP)
cache_offset = 2;
data->data_len = msg_len + cache_offset;
- data->data = ptr = g_malloc(data->data_len);
+ data->data = ptr = g_try_malloc(data->data_len);
+ if (!ptr) {
+ g_free(data);
+ return -ENOMEM;
+ }
ptr[0] = (data->data_len - 2) / 256;
ptr[1] = (data->data_len - 2) - ptr[0] * 256;
if (srv->protocol == IPPROTO_UDP)
@@ -3486,7 +3490,12 @@ static bool udp_listener_event(GIOChannel *channel,
GIOCondition condition,
}
req->name = g_strdup(query);
- req->request = g_malloc(len);
+ req->request = g_try_malloc(len);
+ if (req->request) {
+ g_free(req);
+ return true;
+ }
+
memcpy(req->request, buf, len);
req->timeout = g_timeout_add_seconds(5, request_timeout, req);
request_list = g_slist_append(request_list, req);
--
1.9.1
------------------------------
Message: 5
Date: Wed, 24 Feb 2016 18:48:18 +0530
From: Nishant Chaprana <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] Removed false null check because context will not be
null
Message-ID: <[email protected]>
---
plugins/ofono.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/plugins/ofono.c b/plugins/ofono.c
index 635f3fc..b11d3cc 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -361,19 +361,17 @@ static void set_disconnected(struct network_context
*context)
if (context->network)
connman_network_set_connected(context->network, false);
- if (context) {
- g_free(context->ipv4_nameservers);
- context->ipv4_nameservers = NULL;
- if (context->ipv4_method != CONNMAN_IPCONFIG_METHOD_OFF)
- context->ipv4_method =
- CONNMAN_IPCONFIG_METHOD_UNKNOWN;
-
- g_free(context->ipv6_nameservers);
- context->ipv6_nameservers = NULL;
- if (context->ipv6_method != CONNMAN_IPCONFIG_METHOD_OFF)
- context->ipv6_method =
- CONNMAN_IPCONFIG_METHOD_UNKNOWN;
- }
+ g_free(context->ipv4_nameservers);
+ context->ipv4_nameservers = NULL;
+ if (context->ipv4_method != CONNMAN_IPCONFIG_METHOD_OFF)
+ context->ipv4_method =
+ CONNMAN_IPCONFIG_METHOD_UNKNOWN;
+
+ g_free(context->ipv6_nameservers);
+ context->ipv6_nameservers = NULL;
+ if (context->ipv6_method != CONNMAN_IPCONFIG_METHOD_OFF)
+ context->ipv6_method =
+ CONNMAN_IPCONFIG_METHOD_UNKNOWN;
}
typedef void (*set_property_cb)(struct modem_data *data,
--
1.9.1
------------------------------
Message: 6
Date: Wed, 24 Feb 2016 18:59:16 +0530
From: Nishant Chaprana <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] bridge: corrected the format specifier for unsigned
int
Message-ID: <[email protected]>
---
src/bridge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bridge.c b/src/bridge.c
index ba20096..cd2d9ce 100644
--- a/src/bridge.c
+++ b/src/bridge.c
@@ -56,7 +56,7 @@ static int set_forward_delay(const char *name, unsigned int
delay)
if (!f)
return -errno;
- fprintf(f, "%d", delay);
+ fprintf(f, "%u", delay);
fclose(f);
--
1.9.1
------------------------------
Message: 7
Date: Wed, 24 Feb 2016 19:39:10 +0530
From: Niraj Kumar Goit <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] ofono: Fix inconsitent use of g_try_newo and free
Message-ID: <[email protected]>
As context structure is allocated memory using g_try_new0 it should
be freed using g_free, since these allocators may use different
memory pools.
---
plugins/ofono.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/ofono.c b/plugins/ofono.c
index 635f3fc..ad7b2e4 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -284,7 +284,7 @@ static void network_context_free(struct network_context
*context)
connman_ipaddress_free(context->ipv6_address);
g_free(context->ipv6_nameservers);
- free(context);
+ g_free(context);
}
static void set_connected(struct modem_data *modem,
--
1.7.9.5
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 4, Issue 30
**************************************