[PATCH 2/5] client: Use pthread instead of obsolete g_thread API

2013-01-31 Thread Tomasz Bursztyka
---
 src/client.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/client.c b/src/client.c
index c41a738..1919146 100644
--- a/src/client.c
+++ b/src/client.c
@@ -24,13 +24,14 @@
 #endif
 
 #include gdbus.h
+#include pthread.h
 
 #include pacrunner.h
 
 struct jsrun_data {
DBusConnection *conn;
DBusMessage *msg;
-   GThread *thread;
+   pthread_t thread;
 };
 
 static void jsrun_free(gpointer data)
@@ -42,7 +43,7 @@ static void jsrun_free(gpointer data)
g_free(jsrun);
 }
 
-static gpointer jsrun_thread(gpointer data)
+static void *jsrun_thread(void *data)
 {
struct jsrun_data *jsrun = data;
const char *sender, *url, *host;
@@ -74,7 +75,7 @@ static gpointer jsrun_thread(gpointer data)
 
jsrun_free(jsrun);
 
-   g_thread_exit(NULL);
+   pthread_exit(NULL);
 
return NULL;
 }
@@ -93,8 +94,7 @@ static DBusMessage *find_proxy_for_url(DBusConnection *conn,
jsrun-conn = dbus_connection_ref(conn);
jsrun-msg = dbus_message_ref(msg);
 
-   jsrun-thread = g_thread_create(jsrun_thread, jsrun, FALSE, NULL);
-   if (jsrun-thread == NULL) {
+   if (pthread_create(jsrun-thread, NULL, jsrun_thread, jsrun) != 0) {
jsrun_free(jsrun);
return g_dbus_create_error(msg,
PACRUNNER_ERROR_INTERFACE .Failed,
-- 
1.8.1.1

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


[PATCH 3/5] main: Remove obsolete g_thread_init() call

2013-01-31 Thread Tomasz Bursztyka
---
 src/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 96b4881..edf61a3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -154,9 +154,6 @@ int main(int argc, char *argv[])
DBusError err;
guint signal;
 
-   if (g_thread_supported() == FALSE)
-   g_thread_init(NULL);
-
context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
 
-- 
1.8.1.1

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


[PATCH 4/5] unit: Remove obsolete g_thread_init() call

2013-01-31 Thread Tomasz Bursztyka
---
 unit/test-pacrunner.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/unit/test-pacrunner.c b/unit/test-pacrunner.c
index ec63940..f9d3c86 100644
--- a/unit/test-pacrunner.c
+++ b/unit/test-pacrunner.c
@@ -620,9 +620,6 @@ int main(int argc, char *argv[])
if (file_path != NULL)
test_path = g_get_current_dir();
 
-   if (g_thread_supported() == FALSE)
-   g_thread_init(NULL);
-
__pacrunner_proxy_init();
__pacrunner_js_init();
__pacrunner_manual_init();
-- 
1.8.1.1

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


[PATCH 5/5] build: Replace GTHread library with pthread

2013-01-31 Thread Tomasz Bursztyka
---
 Makefile.am  | 16 +---
 configure.ac |  8 
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c9abe0d..0a0029f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,7 +48,7 @@ src_pacrunner_SOURCES = $(gdbus_sources) $(builtin_sources) \
src/client.c src/manager.c src/proxy.c \
src/manual.c src/js.h src/js.c src/javascript.h
 
-src_pacrunner_LDADD = $(builtin_libadd) @GLIB_LIBS@ @GTHREAD_LIBS@ \
+src_pacrunner_LDADD = $(builtin_libadd) @GLIB_LIBS@ @PTHREAD_LIBS@ \
@DBUS_LIBS@ -ldl
 
 src_pacrunner_LDFLAGS = -Wl,--export-dynamic
@@ -85,6 +85,8 @@ tools_proxy_SOURCES = tools/proxy.c
 
 tools_proxy_LDADD = libproxy/libproxy.la
 
+tools_manual_proxy_test_LDADD = @GLIB_LIBS@
+
 tools_manual_proxy_test_SOURCES = tools/manual-proxy-test.c
 
 endif
@@ -110,7 +112,7 @@ endif
 if MOZJS
 unit_test_pacrunner_SOURCES += plugins/mozjs.c
 
-unit_test_pacrunner_LDADD += @MOZJS_LIBS@
+unit_test_pacrunner_LDADD += @MOZJS_LIBS@ @PTHREAD_LIBS@
 
 noinst_PROGRAMS += unit/test-mozjs
 
@@ -118,7 +120,7 @@ unit_test_mozjs_SOURCES = unit/test-mozjs.c src/pacrunner.h 
\
src/proxy.c src/manual.c src/download.c \
src/js.c plugins/mozjs.c
 
-unit_test_mozjs_LDADD = @MOZJS_LIBS@ @GLIB_LIBS@ @GTHREAD_LIBS@
+unit_test_mozjs_LDADD = @MOZJS_LIBS@ @GLIB_LIBS@ @PTHREAD_LIBS@
 endif
 
 if V8
@@ -131,10 +133,10 @@ endif
 
 endif #UNIT
 
-AM_CFLAGS = @GLIB_CFLAGS@ @GTHREAD_LIBS@ @DBUS_CFLAGS@ \
-   $(builtin_cflags) \
-   -DPACRUNNER_PLUGIN_BUILTIN \
-   -DPLUGINDIR=\$(plugindir)\
+AM_CFLAGS = @GLIB_CFLAGS@ @PTHREAD_LIBS@ @DBUS_CFLAGS@ \
+   $(builtin_cflags) \
+   -DPACRUNNER_PLUGIN_BUILTIN \
+   -DPLUGINDIR=\$(plugindir)\
 
 AM_CXXFLAGS = $(AM_CFLAGS)
 
diff --git a/configure.ac b/configure.ac
index 38d9c44..940aca7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,10 +120,10 @@ else
 fi
 AC_SUBST(DBUS_DATADIR)
 
-PKG_CHECK_MODULES(GTHREAD, gthread-2.0 = 2.16, dummy=yes,
-   AC_MSG_ERROR(GThread = 2.16 is required))
-AC_SUBST(GTHREAD_CFLAGS)
-AC_SUBST(GTHREAD_LIBS)
+AC_CHECK_LIB(pthread, pthread_create,
+   [PTHREAD_LIBS=-lpthread],
+   [AC_MSG_ERROR([Pthread support is missing])])
+AC_SUBST(PTHREAD_LIBS)
 
 AC_ARG_ENABLE(curl, AC_HELP_STRING([--enable-curl],
[enable CURL plugin support]), [enable_curl=${enableval}])
-- 
1.8.1.1

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


[PATCH v3 0/5] Handle threads data protection without obsolete g_thread API

2013-01-31 Thread Tomasz Bursztyka
Version 3: added the patch to fix configure.ac and Makefile.am

Tomasz Bursztyka (5):
  proxy: Switch to pthread for mutex and condition handling
  client: Use pthread instead of obsolete g_thread API
  main: Remove obsolete g_thread_init() call
  unit: Remove obsolete g_thread_init() call
  build: Replace GTHread library with pthread

 Makefile.am   | 16 ---
 configure.ac  |  8 
 src/client.c  | 10 -
 src/main.c|  3 ---
 src/proxy.c   | 56 +--
 unit/test-pacrunner.c |  3 ---
 6 files changed, 45 insertions(+), 51 deletions(-)

-- 
1.8.1.1

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


[PATCH 1/5] proxy: Switch to pthread for mutex and condition handling

2013-01-31 Thread Tomasz Bursztyka
---
 src/proxy.c | 56 +++-
 1 file changed, 27 insertions(+), 29 deletions(-)

diff --git a/src/proxy.c b/src/proxy.c
index 7c7f357..8e99f3b 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -24,6 +24,7 @@
 #endif
 
 #include errno.h
+#include pthread.h
 
 #include pacrunner.h
 
@@ -39,8 +40,8 @@ struct pacrunner_proxy {
 };
 
 static GList *proxy_list = NULL;
-static GMutex *proxy_mutex = NULL;
-static GCond *proxy_cond = NULL;
+static pthread_mutex_t proxy_mutex;
+static pthread_cond_t proxy_cond;
 static int timeout_source = 0;
 static gint proxy_updating = -1; /* -1 for 'never set', with timeout */
 
@@ -154,12 +155,12 @@ int pacrunner_proxy_set_direct(struct pacrunner_proxy 
*proxy)
if (proxy == NULL)
return -EINVAL;
 
-   g_mutex_lock(proxy_mutex);
+   pthread_mutex_lock(proxy_mutex);
if (proxy_updating == -1) {
proxy_updating = 0;
-   g_cond_broadcast(proxy_cond);
+   pthread_cond_broadcast(proxy_cond);
}
-   g_mutex_unlock(proxy_mutex);
+   pthread_mutex_unlock(proxy_mutex);
 
return set_method(proxy, PACRUNNER_PROXY_METHOD_DIRECT);
 }
@@ -209,10 +210,10 @@ static void download_callback(char *content, void 
*user_data)
pacrunner_proxy_enable(proxy);
 
 done:
-   g_mutex_lock(proxy_mutex);
+   pthread_mutex_lock(proxy_mutex);
proxy_updating--;
-   g_cond_broadcast(proxy_cond);
-   g_mutex_unlock(proxy_mutex);
+   pthread_cond_broadcast(proxy_cond);
+   pthread_mutex_unlock(proxy_mutex);
pacrunner_proxy_unref(proxy);
 }
 
@@ -248,23 +249,23 @@ int pacrunner_proxy_set_auto(struct pacrunner_proxy 
*proxy,
 
pacrunner_proxy_ref(proxy);
 
-   g_mutex_lock(proxy_mutex);
+   pthread_mutex_lock(proxy_mutex);
err = __pacrunner_download_update(proxy-interface, proxy-url,
download_callback, proxy);
if (err  0) {
pacrunner_proxy_unref(proxy);
if (proxy_updating == -1) {
proxy_updating = 0;
-   g_cond_broadcast(proxy_cond);
+   pthread_cond_broadcast(proxy_cond);
}
-   g_mutex_unlock(proxy_mutex);
+   pthread_mutex_unlock(proxy_mutex);
return err;
}
if (proxy_updating == -1)
proxy_updating = 1;
else
proxy_updating++;
-   g_mutex_unlock(proxy_mutex);
+   pthread_mutex_unlock(proxy_mutex);
 
return 0;
 }
@@ -288,13 +289,13 @@ int pacrunner_proxy_enable(struct pacrunner_proxy *proxy)
 
__pacrunner_js_set_proxy(proxy);
 
-   g_mutex_lock(proxy_mutex);
+   pthread_mutex_lock(proxy_mutex);
if (proxy_updating == -1) {
proxy_updating = 0;
-   g_cond_broadcast(proxy_cond);
+   pthread_cond_broadcast(proxy_cond);
}
proxy_list = g_list_append(proxy_list, proxy);
-   g_mutex_unlock(proxy_mutex);
+   pthread_mutex_unlock(proxy_mutex);
 
return 0;
 }
@@ -312,9 +313,9 @@ int pacrunner_proxy_disable(struct pacrunner_proxy *proxy)
if (list == NULL)
return -ENXIO;
 
-   g_mutex_lock(proxy_mutex);
+   pthread_mutex_lock(proxy_mutex);
proxy_list = g_list_remove_link(proxy_list, list);
-   g_mutex_unlock(proxy_mutex);
+   pthread_mutex_unlock(proxy_mutex);
 
__pacrunner_js_set_proxy(NULL);
 
@@ -330,12 +331,12 @@ char *pacrunner_proxy_lookup(const char *url, const char 
*host)
 
DBG(url %s host %s, url, host);
 
-   g_mutex_lock(proxy_mutex);
+   pthread_mutex_lock(proxy_mutex);
while (proxy_updating)
-   g_cond_wait(proxy_cond, proxy_mutex);
+   pthread_cond_wait(proxy_cond, proxy_mutex);
 
if (proxy_list == NULL) {
-   g_mutex_unlock(proxy_mutex);
+   pthread_mutex_unlock(proxy_mutex);
return NULL;
}
 
@@ -350,7 +351,7 @@ char *pacrunner_proxy_lookup(const char *url, const char 
*host)
selected_proxy = proxy;
}
 
-   g_mutex_unlock(proxy_mutex);
+   pthread_mutex_unlock(proxy_mutex);
 
if (selected_proxy == NULL)
return NULL;
@@ -378,7 +379,7 @@ static gboolean proxy_config_timeout(gpointer user_data)
   a reasonable length of time, start responding 'DIRECT'. */
if (proxy_updating == -1) {
proxy_updating = 0;
-   g_cond_broadcast(proxy_cond);
+   pthread_cond_broadcast(proxy_cond);
}
return FALSE;
 }
@@ -387,8 +388,8 @@ int __pacrunner_proxy_init(void)
 {
DBG();
 
-   proxy_mutex = g_mutex_new();
-   proxy_cond = g_cond_new();
+   pthread_mutex_init(proxy_mutex, NULL);
+   pthread_cond_init(proxy_cond, NULL);
 

Re: Connman does not automatically switch to Wired LAN

2013-01-31 Thread Sameer Naik
Thanks Jeff and Patrik.

I was missing the main.conf file. After adding it as per your suggestions
its working.
As suggested by Patrik i have set
PreferredTechnologies = ethernet
SingleConnectedTechnology = false
in main.conf

First impression is that it works.
But i am facing a really weird issue that the /dev/null device gets deleted
when the lan cable is plugged out. When the lan cable is plugged in a
regular file named /dev/null is created which also vanishes after a while,
then it reappears again after some time as a regular file and finally
vanishes again, never to return. Then again if i unplug the lan cable and
plug it back in the same vanishing act takes place, i.e. it appears as a
regular file - dissapears - reappears - dissapears.

I am not sure what to make of this.

If i stop connman, and use ifconfig to configure the lan interface the same
thing happens. So it should have something to do with connman. A bug in the
kernel maybe??? I you guys have any ideas please share..

Thanks and Regards
~Sameer


On Thu, Jan 31, 2013 at 1:12 PM, Patrik Flykt
patrik.fl...@linux.intel.comwrote:

 On Thu, 2013-01-31 at 01:40 +, Zheng, Jeff wrote:
  SingleConnectedTechnology = true

 That one is not recommended and should not be used in normal devices. It
 only lets the _last_ connected connection to be used and thus prevents
 the detection and usage of another technolgy that could go online.
 Definitely do not use this, you get a much worse connectivity experience
 from ConnMan.

 It's enough to define PreferredTechnologies = ethernet in main.conf if
 there is no difference between the other network technologies.

 Cheers,

 Patrik


 ___
 connman mailing list
 connman@connman.net
 http://lists.connman.net/listinfo/connman

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Connman VPN: dhcp-option is ignored

2013-01-31 Thread Yevhen Kyriukha
Hi!

My VPN server sends dhcp-option with name server and domain information.
But connman-vpn seems to ignore them. I can't use domain names of my
VPN network.
Does connman-vpn support these features?

Thanks!
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


RE: Connman VPN: Do not replace default route

2013-01-31 Thread Zheng, Jeff
Hi Yevhen,

 -Original Message-
 From: connman-boun...@connman.net
 [mailto:connman-boun...@connman.net] On Behalf Of Yevhen Kyriukha
 Sent: Friday, February 01, 2013 7:28 AM
 To: connman@connman.net
 Subject: Connman VPN: Do not replace default route
 
 Hi!
 
 How can I configure connman-vpn to leave my default route?
 I want that connman append VPN route so I can access my VPN network and
 have all other traffic go through default route.

You can use connman test script service-move-before to move the service
to the first one. The first service gets the default route.

Bests
Jeff
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


RE: Connman VPN: dhcp-option is ignored

2013-01-31 Thread Zheng, Jeff
Hi Yevhen,

 -Original Message-
 From: connman-boun...@connman.net
 [mailto:connman-boun...@connman.net] On Behalf Of Yevhen Kyriukha
 Sent: Friday, February 01, 2013 7:36 AM
 To: connman@connman.net
 Subject: Connman VPN: dhcp-option is ignored
 
 Hi!
 
 My VPN server sends dhcp-option with name server and domain information.
 But connman-vpn seems to ignore them. I can't use domain names of my VPN
 network.
 Does connman-vpn support these features?
 

How about submit a bug at bugs.meego.com?

Bests
Jeff
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Connman upstream test result_20130201

2013-01-31 Thread Li, XiaX
Hi all,

This is test report for  commit fd0bc5cdfaa1d0bf6abf32e71abde45f581572ee.
In this testing,we ran 114 cases. 114 cases passed and 0 cases failed.
The pass rate is 100%.We found 1 new bug,reopen 0 bug and verify 2 bugs.
In this commit we found 1 new bug that Fail to connect to wifi AP with security
by simple-agent on tizen.

New bug
===
25964 - Fail to connect to wifi AP with security by simple-agent on tizen
https://bugs.meego.com/show_bug.cgi?id=25964

Re-open bugs:
===
N/A

 Verified bugs:
===
25862 - service-move-before does not change the connman state
https://bugs.meego.com/show_bug.cgi?id=25862

25893 - Fail to connect to wifi AP with security by simple-agent
https://bugs.meego.com/show_bug.cgi?id=25893

reproduced bugs:
===
25895 - Connmanctl can't remove connected wifi services
https://bugs.meego.com/show_bug.cgi?id=25895

25925 - Connmanctl can't set ipv6 address
https://bugs.meego.com/show_bug.cgi?id=25925

25930 - Wifi disconnects from AP after set invalid IPv4
https://bugs.meego.com/show_bug.cgi?id=25930

25953 - Connmanctl can't display hidden SSID correctly
https://bugs.meego.com/show_bug.cgi?id=25953

25961 - Operation aborted when connect to wifi with wrong password
https://bugs.meego.com/show_bug.cgi?id=25961


===
Testing Environment
==
Hardware:  netbook Eeepc 1005PE / Cedar Trail / Ocktrail Green Ridge
Image:  meego-netbook-ia32-1.2.0 / netbook-ia32-pinetrail-tizen_20120424.2
ConnMan: commit fd0bc5cdfaa1d0bf6abf32e71abde45f581572ee
wpa_supplicant: wpa_supplicant-1.0-13.1.i586
Ofono: ofono-1.12.16.g7738e3a-1.1.i586
bluez:  bluez-4.87-1.12.i586
3G:  Unicom Sim card/ZTE MF190/HuaWei E261
BT:   Palm Pre/AnyCom AP/CSR dongle (disable the onboard BT device)
Wireless AP:netgear WNR2000/dlink

Test Execution Summary
==
Category  Total  PASS   FAILN/A  Comments
WiFi   18  18
bt6   6
3G  29 29
Ethernet  28 28
Regulatory1   1
NTP 1   1
Openvpn   7   7
surfing 3   3
proxy   11 11
tethering  10 10
Total  114114

Bug referred here is bug at bugs.meego.com, for example, bug #23110 refer
to http://bugs.meego.com/show_bug.cgi?id=23110
 ConnMan Test Report List
Date:2013-2-1


---Ethernet---

CM_Eth_BigBroadcastPing  PASS
CM_Eth_Conn  PASS
CM_Eth_HasDHCP   PASS
CM_Eth_IsReEnableWorks   PASS
CM_Eth_PoweredOn PASS
CM_Eth_SmallBroadcastPingPASS
CM_Eth_IsPoweredOn   PASS
CM_Eth_IsReady   PASS
CM_Eth_DisconnectPASS
CM_Eth_PoweredOffPASS
CM_Eth_Hotplug   PASS
CM_Eth_HasIP PASS
CM_Eth_Connect   PASS
CM_Advance_StaticIP_WiredPASS
CM_Advance_StaticIP  PASS
CM_Eth_UploadPASS
CM_Eth_Download  PASS
CM_Flt_eth_autoconn  PASS  
CM_Flt_ConnWired PASS  
CM_Flt_EthNoPing PASS
CM_Flt_EthPoweredOff PASS
CM_Flt_EthIsPoweredOff   PASS
CM_Flt_EthPoweredOn  PASS
CM_Flt_EthOnline PASS
CM_IPv6_eth_set_address  PASS
CM_Info_EthConnInfo  PASS
CM_IPv6_eth_ssh  PASS
CM_AutoConn_RebootWired  PASS

Total:28 Pass:28 Fail:0 N/A:0


---WiFi---

CM_WF_wps_pinPASS
CM_WF_wps_pbcPASS
CM_WS_WEP_Upload PASS
CM_WS_WEP_Download   PASS
CM_WS_PSK2   PASS
CM_WS_RSNPASS
CM_WS_WEP64  PASS
CM_WS_SharedHiddenWEP128 PASS
CM_WS_WPAPASS
CM_WS_OpenBroadcastWEP40 PASS
CM_WS_WEP128 PASS
CM_WS_Open   PASS
CM_WS_Hidden PASS
CM_Autoconn_HIDDEN_Rem_NoSecuPASS  
CM_AutoConn_RememWEP64   PASS
CM_Autoconn_HIDDEN_Rem_WPAPSKAES PASS
CM_Autoconn_RememWPAPSKTKIP  PASS
CM_Autoconn_HIDDEN_Rem_WEP128PASS

Total:18 Pass:18 Fail:0 N/A:0


---Bluetooth---

CM_BT_ConnectPASS
CM_BT_SmallPing  PASS
CM_BT_BigPingPASS
CM_BT_IsReEnableWorksPASS
CM_BT_Connect_PANPASS
CM_Advance_StaticIP_BT   PASS

Total:6 Pass:6 Fail:0 N/A:0