Re: 'Not supported' message

2014-04-03 Thread Tomasz Bursztyka

Hi Cliff,

Got to see you logs and something is weird: there is no messages coming 
from plugins/wifi.c

You did not filtered out the logs, did you?

Would be interesting to see gsupplicant's output as well.
Could you retest and get the log this way:

CONNMAN_SUPPLICANT_DEBUG=1 connmand -n -d  connman_log.txt

Would be nice to get wpa_supplicant's log as well (start it before connman):

wpa_supplicant -u -ddt  wpa_supplicant_log.txt


Thanks,

Tomasz
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH] gsupplicant: Output a relevant warning about P2P support

2014-04-03 Thread Tomasz Bursztyka
Identify which part does not support P2P: wpa_supplicant or the
interface itself.
---
 gsupplicant/supplicant.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 39ff2f1..da33aed 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -1925,7 +1925,14 @@ static void interface_p2p_flush(const char *error,
 {
GSupplicantInterface *interface = user_data;
 
-   if (!error)
+   if (error) {
+   if (!g_strcmp0(error,
+   org.freedesktop.DBus.Error.UnknownMethod))
+   g_warning(wpa_supplicant built without P2P support);
+   else
+   g_warning(interface %s does not support P2P,
+   interface-ifname);
+   } else
interface-p2p_support = true;
 
callback_p2p_support(interface);
-- 
1.8.3.2

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] gsupplicant: Output a relevant warning about P2P support

2014-04-03 Thread Patrik Flykt

Hi,

On Thu, 2014-04-03 at 10:07 +0300, Tomasz Bursztyka wrote:
 Identify which part does not support P2P: wpa_supplicant or the
 interface itself.
 ---
  gsupplicant/supplicant.c | 9 -
  1 file changed, 8 insertions(+), 1 deletion(-)
 
 diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
 index 39ff2f1..da33aed 100644
 --- a/gsupplicant/supplicant.c
 +++ b/gsupplicant/supplicant.c
 @@ -1925,7 +1925,14 @@ static void interface_p2p_flush(const char *error,
  {
   GSupplicantInterface *interface = user_data;
  
 - if (!error)
 + if (error) {
 + if (!g_strcmp0(error,
 + org.freedesktop.DBus.Error.UnknownMethod))
 + g_warning(wpa_supplicant built without P2P support);
 + else
 + g_warning(interface %s does not support P2P,
 + interface-ifname);
 + } else
   interface-p2p_support = true;
  
   callback_p2p_support(interface);

Maybe use a connman_warn() instead, but as the message will potentially
repeat quite many times while ConnMan is running, a DBG will also do
just fine. We'll dig out the P2P unsupport from the logs later when
nothing works and nobody knows why.

Cheers,

Patrik
 


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH v2] gsupplicant: Output a relevant warning about P2P support

2014-04-03 Thread Tomasz Bursztyka
Identify which part does not support P2P: wpa_supplicant or the
interface itself.
---
 gsupplicant/supplicant.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index cd35012..9734e48 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -1925,7 +1925,15 @@ static void interface_p2p_flush(const char *error,
 {
GSupplicantInterface *interface = user_data;
 
-   if (!error)
+   if (error) {
+   if (!g_strcmp0(error,
+   org.freedesktop.DBus.Error.UnknownMethod)) {
+   SUPPLICANT_DBG(wpa_supplicant does not support P2P);
+   } else {
+   SUPPLICANT_DBG(interface %s does not support P2P,
+   interface-ifname);
+   }
+   } else
interface-p2p_support = true;
 
callback_p2p_support(interface);
-- 
1.8.3.2

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH 0/4] DHCP fixes

2014-04-03 Thread Jukka Rissanen
Hi,

I was trying to find the memory leak in DHCP and accidentally
opened a can of worms which resulted some important fixes
how DHCP handles the network hash.

The patch 1 is just a indentation fix which seems to be a left
over when we did the big boolean conversion patchset.

In patch 2, the DHCP cleanup is now done after network has been
cleaned. This is needed as the network will take down network
connections and call __connman_dhcp_stop() we must not cleanup
the network_table in dhcp.c until the connections are down.

The actual memory leak is fixed by patch 3.

The patch 4 fixes the network_table hash manipulation. The patch
removes the remove_network() function that was used in hash cleanup.
We need to do the hash cleanup manually as we otherwise cannot
guarantee proper ordering of calls when unreferencing the network.


Cheers,
Jukka


Jukka Rissanen (4):
  dhcp: Indent fixes
  main: DHCP cleanup done too early
  dhcp: Memory leak
  dhcp: Network hash table fixes

 src/dhcp.c | 43 ---
 src/main.c |  2 +-
 2 files changed, 25 insertions(+), 20 deletions(-)

-- 
1.8.3.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH 2/4] main: DHCP cleanup done too early

2014-04-03 Thread Jukka Rissanen
The DHCP cleanup function which removes the network hash in dhcp.c,
must be done after the network cleanup. Otherwise we would have removed
the necessary information from dhcp.c:network_table hash and network.c
would not be able to stop currently active DHCP connections when ConnMan
is shutdown.
---
 src/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c
index 1469063..4f635de 100644
--- a/src/main.c
+++ b/src/main.c
@@ -693,7 +693,6 @@ int main(int argc, char *argv[])
__connman_wispr_cleanup();
__connman_wpad_cleanup();
__connman_dhcpv6_cleanup();
-   __connman_dhcp_cleanup();
__connman_session_cleanup();
__connman_plugin_cleanup();
__connman_provider_cleanup();
@@ -717,6 +716,7 @@ int main(int argc, char *argv[])
__connman_ippool_cleanup();
__connman_device_cleanup();
__connman_network_cleanup();
+   __connman_dhcp_cleanup();
__connman_service_cleanup();
__connman_peer_cleanup();
__connman_agent_cleanup();
-- 
1.8.3.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH 4/4] dhcp: Network hash table fixes

2014-04-03 Thread Jukka Rissanen
The network_table hash removal function remove_network() cannot
be used because of we might have invalidated the DHCP connection
already and then we would try to do it again when DHCP stops.

So when DHCP is stopped, we now remove the corresponding network
from the hash manually. This way we are able to unref the network
because we have a pointer to it (the pointer was lost in earlier version)
and valgrind does not report possibly lost memory for network struct
anymore.
---
 src/dhcp.c | 35 ---
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/src/dhcp.c b/src/dhcp.c
index 168697d..e4bac67 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -86,6 +86,7 @@ static void dhcp_invalidate(struct connman_dhcp *dhcp, bool 
callback)
 {
struct connman_service *service;
struct connman_ipconfig *ipconfig;
+   bool network_removed = false;
int i;
 
DBG(dhcp %p callback %u, dhcp, callback);
@@ -131,10 +132,17 @@ static void dhcp_invalidate(struct connman_dhcp *dhcp, 
bool callback)
__connman_ipconfig_set_gateway(ipconfig, NULL);
__connman_ipconfig_set_prefixlen(ipconfig, 0);
 
-   if (dhcp-callback  callback)
+   if (dhcp-callback  callback) {
+   g_hash_table_remove(network_table, dhcp-network);
+   network_removed = true;
dhcp-callback(dhcp-network, false, NULL);
+   }
 
 out:
+   if (!network_removed)
+   g_hash_table_remove(network_table, dhcp-network);
+
+   connman_network_unref(dhcp-network);
dhcp_free(dhcp);
 }
 
@@ -584,16 +592,6 @@ static int dhcp_release(struct connman_dhcp *dhcp)
return 0;
 }
 
-static void remove_network(gpointer user_data)
-{
-   struct connman_dhcp *dhcp = user_data;
-
-   DBG(dhcp %p, dhcp);
-
-   dhcp_release(dhcp);
-   dhcp_invalidate(dhcp, false);
-}
-
 int __connman_dhcp_start(struct connman_network *network, dhcp_cb callback)
 {
struct connman_dhcp *dhcp;
@@ -616,13 +614,20 @@ int __connman_dhcp_start(struct connman_network *network, 
dhcp_cb callback)
 
 void __connman_dhcp_stop(struct connman_network *network)
 {
-   DBG();
+   struct connman_dhcp *dhcp;
+
+   DBG(network_table %p network %p, network_table, network);
 
if (!network_table)
return;
 
-   if (g_hash_table_remove(network_table, network))
-   connman_network_unref(network);
+   dhcp = g_hash_table_lookup(network_table, network);
+   g_hash_table_remove(network_table, network);
+
+   if (dhcp) {
+   dhcp_release(dhcp);
+   dhcp_invalidate(dhcp, false);
+   }
 }
 
 int __connman_dhcp_init(void)
@@ -630,7 +635,7 @@ int __connman_dhcp_init(void)
DBG();
 
network_table = g_hash_table_new_full(g_direct_hash, g_direct_equal,
-   NULL, remove_network);
+   NULL, NULL);
 
return 0;
 }
-- 
1.8.3.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH 1/4] dhcp: Indent fixes

2014-04-03 Thread Jukka Rissanen
---
 src/dhcp.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/dhcp.c b/src/dhcp.c
index c1dc5ec..246de30 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -353,11 +353,9 @@ static void lease_available_cb(GDHCPClient *dhcp_client, 
gpointer user_data)
 
DBG(c_address %s, c_address);
 
-   if (address  c_address 
-   g_strcmp0(address, c_address) != 0)
+   if (address  c_address  g_strcmp0(address, c_address) != 0)
ip_change = true;
-   else if (gateway  c_gateway 
-   g_strcmp0(gateway, c_gateway) != 0)
+   else if (gateway  c_gateway  g_strcmp0(gateway, c_gateway) != 0)
ip_change = true;
else if (prefixlen != c_prefixlen)
ip_change = true;
-- 
1.8.3.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH 3/4] dhcp: Memory leak

2014-04-03 Thread Jukka Rissanen
DHCP struct was not freed when DHCP connection was closed.
---
 src/dhcp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/dhcp.c b/src/dhcp.c
index 246de30..168697d 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -66,6 +66,8 @@ static void dhcp_free(struct connman_dhcp *dhcp)
dhcp-nameservers = NULL;
dhcp-timeservers = NULL;
dhcp-pac = NULL;
+
+   g_free(dhcp);
 }
 
 /**
-- 
1.8.3.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 0/4] DHCP fixes

2014-04-03 Thread Patrik Flykt
On Thu, 2014-04-03 at 12:39 +0300, Jukka Rissanen wrote:
 Hi,
 
 I was trying to find the memory leak in DHCP and accidentally
 opened a can of worms which resulted some important fixes
 how DHCP handles the network hash.

All patches applied, thanks!

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH v2] gsupplicant: Output a relevant warning about P2P support

2014-04-03 Thread Patrik Flykt
On Thu, 2014-04-03 at 10:35 +0300, Tomasz Bursztyka wrote:
 Identify which part does not support P2P: wpa_supplicant or the
 interface itself.

Patch has been applied, thanks!

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Connman DHCP and Timeserver

2014-04-03 Thread Tim Sander
Hi

I currently have a connman 1.22 set up with time TimeUpdates set to manual. 
This is due to the fact that i use ntpd for time synchronisation due to the 
better accuracy. If connman now is set to dhcp i have a hard time determining 
the timeserver. This information does not seem to be available in the connman 
dbus interface?

Best regards
Tim
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: 'Not supported' message

2014-04-03 Thread Cliff McDiarmid
 - Original Message -
 From: Tomasz Bursztyka
 Sent: 04/03/14 07:27 AM
 To: connman@connman.net
 Subject: Re: 'Not supported' message
 
 Hi Cliff,

Hi thanks for getting involved.

 Got to see you logs and something is weird: there is no messages coming 
 from plugins/wifi.c
 You did not filtered out the logs, did you?

No, not at all, but what is strange is that I have no plugins dir and hence no 
wifi.c!
 
 Would be interesting to see gsupplicant's output as well.
 Could you retest and get the log this way:
 
 CONNMAN_SUPPLICANT_DEBUG=1 connmand -n -d  connman_log.txt
 
 Would be nice to get wpa_supplicant's log as well (start it before connman):
 
 wpa_supplicant -u -ddt  wpa_supplicant_log.txt

Attached are the two logs.  It wasn't until I stopped supplicant that I got a 
log. 

Can I ask why starting Connman manually would create a soft block om Wireless 
LAN?

thanks

Cliff



___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

'Not supported' message

2014-04-03 Thread Cliff McDiarmid
Hi

Sorry, but the two logs have gone to Tomasz Bursztyka.

Cliff
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH 1/1] Fix p2p driver probe

2014-04-03 Thread Eduardo Abinader
For a p2p driver previously registered, after disabling wifi and
enabling again, p2p driver probe was missing.
---
 src/technology.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/technology.c b/src/technology.c
index 5a12202..fdb429a 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -1220,6 +1220,7 @@ int connman_technology_driver_register(struct 
connman_technology_driver *driver)
GSList *list;
struct connman_device *device;
enum connman_service_type type;
+   struct connman_technology *technology;
 
for (list = driver_list; list; list = list-next) {
if (list-data == driver)
@@ -1254,8 +1255,11 @@ int connman_technology_driver_register(struct 
connman_technology_driver *driver)
 
 exist:
if (driver-type == CONNMAN_SERVICE_TYPE_P2P) {
-   if (!technology_get(CONNMAN_SERVICE_TYPE_P2P))
+   technology = technology_get(CONNMAN_SERVICE_TYPE_P2P);
+   if (!technology)
return -ENOMEM;
+   else if (driver-probe)
+   driver-probe(technology);
}
 
return 0;
-- 
1.8.3.2

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman