Re: Add OpenVPN Support

2010-10-26 Thread Daniel Wagner
Good Morning Samuel,

On Wed, Oct 27, 2010 at 02:05:49AM +0200, Samuel Ortiz wrote:
> Hi Daniel,
> 
> On Tue, Oct 26, 2010 at 03:54:23PM +0200, Daniel Wagner wrote:
> > Hi,
> > 
> > yet another update on this patch. OpenVPN is now running, but I'm
> > struggling with the settings. The OpenVPN server settings seems
> > broken. I can ping the server address (10.1.0.1) from my client
> > (10.1.0.6). But everything else doesn't work yet. Some more debugging
> > needed here :)
> > 
> > Another thing I found out is that if there is no netmask set on the
> > provider, connman does not setup the route. Don't know if this a bug
> > in connman or in my setup.
> Although your OpenVPN server should probably provide you with a proper
> netmask, I just pushed a patch to have ConnMan being less pedantic about the
> netmask. So your routes should be set now (Which might also fix the problem
> you're describing in the first paragraph), could you please try ?

OpenVPN only pushes a netmask for tap devices not for tun devices:

 --up cmd
  Shell command to run after successful TUN/TAP device open (pre 
--user UID change).  The up script is useful for specifying
  route commands which route IP traffic destined for private 
subnets which exist at the other end of the VPN connection into
  the tunnel.

For --dev tun execute as:

  cmd tun_dev tun_mtu link_mtu ifconfig_local_ip ifconfig_remote_ip 
[ init | restart ]

For --dev tap execute as:

  cmd tap_dev tap_mtu link_mtu ifconfig_local_ip ifconfig_netmask [ 
init | restart ]

and vpn.c sets up a tun device. 

> The patch looks good to me otherwise, except for the Makefile.plugins hack.
> Marcel told me he will try to find out why we're linking twice when a source
> file is defined twice in builtin_sources.

Thanks. Most likely I would have to spend a week to figure out what's
going on. So any help is highly appreciated.

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


[PATCH] Fix BMC 8075 AP list gone when turning hotkey on and off

2010-10-26 Thread ying . an . deng
From: DengYingAn 

With wireless on booting, APs list is gone after turnning off and on. Back 
ported from upstream with commit id 57536b8359c5c99f015cd97c597e2de82ce9144f
---
 src/connman.h |2 ++
 src/device.c  |2 ++
 src/element.c |   22 ++
 3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/connman.h b/src/connman.h
index f5b03c8..e24ba2a 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -198,6 +198,8 @@ int __connman_element_disable_technology(enum 
connman_service_type type);
 
 gboolean __connman_element_device_isfiltered(const char *devname);
 
+void __connman_element_set_driver(struct connman_element *element);
+
 #include 
 
 int __connman_ipconfig_init(void);
diff --git a/src/device.c b/src/device.c
index 22cf300..4ea24d1 100644
--- a/src/device.c
+++ b/src/device.c
@@ -597,6 +597,8 @@ static void probe_driver(struct connman_element *element, 
gpointer user_data)
 
element->device->driver = driver;
 
+   __connman_element_set_driver(element);
+
setup_device(element->device);
 }
 
diff --git a/src/element.c b/src/element.c
index 759d3e4..54b636d 100644
--- a/src/element.c
+++ b/src/element.c
@@ -1320,6 +1320,28 @@ void connman_element_set_error(struct connman_element 
*element,
__connman_service_indicate_error(service, convert_error(error));
 }
 
+void __connman_element_set_driver(struct connman_element *element)
+{
+   GSList *list;
+
+   DBG("element %p name %s driver %p", element, element->name,
+   element->driver);
+
+   if (element->driver)
+   return;
+
+   for (list = driver_list; list; list = list->next) {
+   struct connman_driver *driver = list->data;
+
+   if (match_driver(element, driver) == FALSE)
+   continue;
+
+   element->driver = driver;
+
+   break;
+   }
+}
+
 int __connman_element_init(const char *device, const char *nodevice)
 {
struct connman_element *element;
-- 
1.7.2.2

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


[PATCH] Fix BMC 8075 AP list gone when turning hotkey on and off

2010-10-26 Thread ying . an . deng
From: DengYingAn 

With wireless on booting, APs list is gone after turnning off and on. Back 
ported from upstream with commit id 57536b8359c5c99f015cd97c597e2de82ce9144f
---
 src/connman.h |2 ++
 src/device.c  |2 ++
 src/element.c |   22 ++
 3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/connman.h b/src/connman.h
index f5b03c8..e24ba2a 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -198,6 +198,8 @@ int __connman_element_disable_technology(enum 
connman_service_type type);
 
 gboolean __connman_element_device_isfiltered(const char *devname);
 
+void __connman_element_set_driver(struct connman_element *element);
+
 #include 
 
 int __connman_ipconfig_init(void);
diff --git a/src/device.c b/src/device.c
index 22cf300..4ea24d1 100644
--- a/src/device.c
+++ b/src/device.c
@@ -597,6 +597,8 @@ static void probe_driver(struct connman_element *element, 
gpointer user_data)
 
element->device->driver = driver;
 
+   __connman_element_set_driver(element);
+
setup_device(element->device);
 }
 
diff --git a/src/element.c b/src/element.c
index 759d3e4..54b636d 100644
--- a/src/element.c
+++ b/src/element.c
@@ -1320,6 +1320,28 @@ void connman_element_set_error(struct connman_element 
*element,
__connman_service_indicate_error(service, convert_error(error));
 }
 
+void __connman_element_set_driver(struct connman_element *element)
+{
+   GSList *list;
+
+   DBG("element %p name %s driver %p", element, element->name,
+   element->driver);
+
+   if (element->driver)
+   return;
+
+   for (list = driver_list; list; list = list->next) {
+   struct connman_driver *driver = list->data;
+
+   if (match_driver(element, driver) == FALSE)
+   continue;
+
+   element->driver = driver;
+
+   break;
+   }
+}
+
 int __connman_element_init(const char *device, const char *nodevice)
 {
struct connman_element *element;
-- 
1.7.2.2

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


RE: [PATCH] Start wpa_supplican is service not running.

2010-10-26 Thread leena.gunda
Hi Kalle,

>> + reply = dbus_connection_send_with_reply_and_block(connection,
>> + message, -1, &error);

> connman must never block, instead we need to use async interfaces.

I intentionally made the call blocking since the system_available will be set 
to TRUE only if we get a reply from Introspect method. This also indicates that 
wpa_supplicant was indeed started in case it was not already running.

Thanks,
Leena


Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com
<>___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

[PATCH] Add vpn.h into Makefile.plugin

2010-10-26 Thread martin . xu
From: Martin Xu 

So the file can be included into dist tarball, otherwise, the file
can not be found, and will block the building.
---
 Makefile.plugins |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile.plugins b/Makefile.plugins
index 261417e..f0d81d4 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -109,7 +109,7 @@ endif
 if OPENCONNECT
 if OPENCONNECT_BUILTIN
 builtin_modules += openconnect
-builtin_sources += plugins/vpn.c plugins/openconnect.c
+builtin_sources += plugins/vpn.c plugins/openconnect.c plugins/vpn.h
 builtin_cflags += -DOPENCONNECT=\"@openconn...@\"
 else
 plugin_LTLIBRARIES += plugins/openconnect.la
-- 
1.6.1.3

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


[PATCH] Fix BMC7915 Connman stucks by few rfkill key pressing

2010-10-26 Thread ying . an . deng
From: DengYingAn 

Connman will be stuck after press few times of hotkey for wireless.
---
 src/udev.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/udev.c b/src/udev.c
index 70c760d..ade9487 100644
--- a/src/udev.c
+++ b/src/udev.c
@@ -191,7 +191,7 @@ connman_bool_t __connman_udev_get_blocked(int phyindex)
if (phyindex < 0)
return FALSE;
 
-   for (list = rfkill_list; list; list = rfkill_list->next) {
+   for (list = rfkill_list; list; list = list->next) {
struct rfkill_data *block = list->data;
 
if (block->phyindex == phyindex)
@@ -208,7 +208,7 @@ static void update_rfkill_state(int phyindex, 
connman_bool_t blocked)
 
DBG("index %d blocked %d", phyindex, blocked);
 
-   for (list = rfkill_list; list; list = rfkill_list->next) {
+   for (list = rfkill_list; list; list = list->next) {
block = list->data;
 
if (block->phyindex == phyindex) {
-- 
1.7.2.2

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


Re: Add OpenVPN Support

2010-10-26 Thread Samuel Ortiz
Hi Daniel,

On Tue, Oct 26, 2010 at 03:54:23PM +0200, Daniel Wagner wrote:
> Hi,
> 
> yet another update on this patch. OpenVPN is now running, but I'm
> struggling with the settings. The OpenVPN server settings seems
> broken. I can ping the server address (10.1.0.1) from my client
> (10.1.0.6). But everything else doesn't work yet. Some more debugging
> needed here :)
> 
> Another thing I found out is that if there is no netmask set on the
> provider, connman does not setup the route. Don't know if this a bug
> in connman or in my setup.
Although your OpenVPN server should probably provide you with a proper
netmask, I just pushed a patch to have ConnMan being less pedantic about the
netmask. So your routes should be set now (Which might also fix the problem
you're describing in the first paragraph), could you please try ?

The patch looks good to me otherwise, except for the Makefile.plugins hack.
Marcel told me he will try to find out why we're linking twice when a source
file is defined twice in builtin_sources.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: [PATCH 1/1] Fix deadlock when disassociate while associating.

2010-10-26 Thread Samuel Ortiz
Hi Mohamed,

On Thu, Oct 21, 2010 at 10:48:31AM -0700, Mohamed Abbas wrote:
> while associating then the user disconnect the network this will
> cause the following:
> 1- __connman_service_disconnect() which will call
> 2-__connman_network_disconnect() which call
> 3 err = network->driver->disconnect(network); 
> 4-connman_network_set_connected(network, FALSE);
> 
> looking at connman_network_set_connected code
> if ((network->connecting == TRUE || network->associating == TRUE) &&
> connected == FALSE) {
> connman_element_set_error(&network->element,
> CONNMAN_ELEMENT_ERROR_CONNECT_FAILED);
> __connman_network_disconnect(network);
> }
> 
> network->associating is TRUE and this will case to go to step 2 which
> case the deadlock since this will keep looping and preventing to service
> any supplicant dbus message to come in and break the deadlock.
My comments below:

> diff --git a/plugins/wifi.c b/plugins/wifi.c
> index a159a9d..6fba131 100644
> --- a/plugins/wifi.c
> +++ b/plugins/wifi.c
> @@ -334,10 +334,17 @@ static void interface_state(GSupplicantInterface 
> *interface)
>   case G_SUPPLICANT_STATE_DISCONNECTED:
>   connman_network_set_associating(network, FALSE);
>   connman_network_set_connected(network, FALSE);
> +
> + connman_network_unref(wifi->network);
> + wifi->network = NULL;
> +
>   break;
>  
>   case G_SUPPLICANT_STATE_INACTIVE:
>   connman_network_set_associating(network, FALSE);
> + connman_network_unref(wifi->network);
> +
> + wifi->network = NULL;
>   break;
Why do we need to move the network unref from the disconnect callback to here?
How is that related to the deadlock ?


  
> @@ -617,6 +618,8 @@ static int network_disconnect(struct connman_network 
> *network)
>   if (wifi == NULL || wifi->interface == NULL)
>   return -ENODEV;
>  
> + connman_network_set_associating(network, FALSE);
> +
This one makes sense. I'll apply this patch once I get an explanation from you
about the network unref move.

Thanks a lot.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: [PATCH 1/2] wifi: add a disconnected timer

2010-10-26 Thread Samuel Ortiz
Hi Kalle,

On Tue, Oct 26, 2010 at 07:30:53PM +0300, Kalle Valo wrote:
> In a big network, for example at Ubuntu Developer Summit which has >10 APs,
> connman and wpasupplicant got out of sync very easily. connman claimed it
> was connected even though wpasupplicant (and the kernel driver) was actually
> connected to the AP.
Did you mean connman claimed it was _disconnected_ ?



> The problem is that while roaming between APs inside ESS wpasupplicant states
> go like this:
> 
> COMPLETED -> DISCONNECTED -> SCANNING -> AUTHENTICATING ... -> COMPLETED
> 
> So what happens is that connman unnecessarily marks the network disconnected
> even though wpasupplicant is just roaming to a different AP within ESS.
Well it really got disconnected from the AP, so ConnMan should just track
that.
I'm really not a big fan of trying to be smarter than wpa_supplicant. In my
experience, it's the shortest paths to new bugs


> To fix this add a timer which waits 10 seconds after a disconnected state.
> If wpasupplicant hasn't connected to a network at time only then set the
> network disconnected.
It looks a bit like a hack to me, the fundamental issue (ConnMan not tracking
the wpa_supplicant states properly, it seems) is not fixed.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: [PATCH 0/2] wifi disconnect timer

2010-10-26 Thread Kalle Valo
Kalle Valo  writes:

> I'm at UDS right now and I have been debugging gsupplicant extensively and
> I have had quite a lot of problems. I noticed a problem how the wifi 
> plugin handles the wpasupplicant disconnect state. Here are two patches
> how I propose to fix the issues. At least in my case the patches
> helped a lot.

Sorry, I forgot to mention that these patches are on top of pile of
other patches. For example, Mohamed's " Fix deadlock when disassociate
while associating." patch. But please take a look and comment.

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


Re: [PATCH 0/2] *** SUBJECT HERE ***

2010-10-26 Thread Kalle Valo
Kalle Valo  writes:

> *** BLURB HERE ***

Heh, sorry about this. git send-email also sent an emacs backup file :)

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


[PATCH 1/2] wifi: add a disconnected timer

2010-10-26 Thread Kalle Valo
In a big network, for example at Ubuntu Developer Summit which has >10 APs,
connman and wpasupplicant got out of sync very easily. connman claimed it
was connected even though wpasupplicant (and the kernel driver) was actually
connected to the AP.

The problem is that while roaming between APs inside ESS wpasupplicant states
go like this:

COMPLETED -> DISCONNECTED -> SCANNING -> AUTHENTICATING ... -> COMPLETED

So what happens is that connman unnecessarily marks the network disconnected
even though wpasupplicant is just roaming to a different AP within ESS.

To fix this add a timer which waits 10 seconds after a disconnected state.
If wpasupplicant hasn't connected to a network at time only then set the
network disconnected.
---
 plugins/wifi.c |   71 ++-
 1 files changed, 64 insertions(+), 7 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 37f6e32..d036a92 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -61,6 +61,7 @@ struct wifi_data {
int index;
unsigned flags;
unsigned int watch;
+   guint disconnect_timer;
 };
 
 static int get_bssid(struct connman_device *device,
@@ -309,6 +310,61 @@ static const gchar *state2str(GSupplicantState state)
return "UNKNOWN";
 }
 
+static gboolean disconnected_timeout(gpointer user_data)
+{
+   GSupplicantInterface *interface;
+   struct connman_network *network;
+   struct wifi_data *wifi;
+
+   DBG("");
+
+   interface = user_data;
+
+   wifi = g_supplicant_interface_get_data(interface);
+
+   if (wifi == NULL)
+   return FALSE;
+
+   network = wifi->network;
+
+   connman_network_set_associating(network, FALSE);
+   connman_network_set_connected(network, FALSE);
+
+   connman_network_unref(wifi->network);
+   wifi->network = NULL;
+
+   return FALSE;
+}
+
+static void start_disconnected_timer(GSupplicantInterface *interface)
+{
+   struct wifi_data *wifi = g_supplicant_interface_get_data(interface);
+
+   if (wifi == NULL)
+   return;
+
+   if (wifi->disconnect_timer != 0)
+   return;
+
+   wifi->disconnect_timer = g_timeout_add(1, disconnected_timeout,
+   interface);
+}
+
+static void stop_disconnected_timer(GSupplicantInterface *interface)
+{
+   struct wifi_data *wifi = g_supplicant_interface_get_data(interface);
+
+   if (wifi == NULL)
+   return;
+
+   if (wifi->disconnect_timer == 0)
+   return;
+
+   g_source_remove(wifi->disconnect_timer);
+   wifi->disconnect_timer = 0;
+}
+
+
 static void interface_state(GSupplicantInterface *interface)
 {
struct connman_network *network;
@@ -328,8 +384,10 @@ static void interface_state(GSupplicantInterface 
*interface)
network = wifi->network;
device = wifi->device;
 
-   if (device == NULL || network == NULL)
+   if (device == NULL || network == NULL) {
+   stop_disconnected_timer(interface);
return;
+   }
 
switch (state) {
case G_SUPPLICANT_STATE_SCANNING:
@@ -345,6 +403,8 @@ static void interface_state(GSupplicantInterface *interface)
/* reset scan trigger and schedule background scan */
connman_device_schedule_scan(device);
 
+   stop_disconnected_timer(interface);
+
if (get_bssid(device, bssid, &bssid_len) == 0)
connman_network_set_address(network,
bssid, bssid_len);
@@ -352,12 +412,7 @@ static void interface_state(GSupplicantInterface 
*interface)
break;
 
case G_SUPPLICANT_STATE_DISCONNECTED:
-   connman_network_set_associating(network, FALSE);
-   connman_network_set_connected(network, FALSE);
-
-   connman_network_unref(wifi->network);
-   wifi->network = NULL;
-
+   start_disconnected_timer(interface);
break;
 
case G_SUPPLICANT_STATE_INACTIVE:
@@ -640,6 +695,8 @@ static int network_disconnect(struct connman_network 
*network)
 
connman_network_set_associating(network, FALSE);
 
+   stop_disconnected_timer(wifi->interface);
+
return g_supplicant_interface_disconnect(wifi->interface,
disconnect_callback, wifi);
 }
-- 
1.7.1

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


[PATCH 0/2] *** SUBJECT HERE ***

2010-10-26 Thread Kalle Valo
*** BLURB HERE ***

Kalle Valo (2):
  wifi: add a disconnected timer
  wifi: don't set associating state when roaming between APs

 plugins/wifi.c |   74 +--
 1 files changed, 66 insertions(+), 8 deletions(-)

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


[PATCH 2/2] wifi: don't set associating state when roaming between APs

2010-10-26 Thread Kalle Valo
When wpasupplicant is roaming between APs it exposes all states to connman.
After the wifi network is connected, we should not set associating state
anymore. Otherwise we just end up into weird states.
---
 plugins/wifi.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index d036a92..dc19b79 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -396,7 +396,8 @@ static void interface_state(GSupplicantInterface *interface)
 
case G_SUPPLICANT_STATE_AUTHENTICATING:
case G_SUPPLICANT_STATE_ASSOCIATING:
-   connman_network_set_associating(network, TRUE);
+   if (!connman_network_get_connected(network))
+   connman_network_set_associating(network, TRUE);
break;
 
case G_SUPPLICANT_STATE_COMPLETED:
-- 
1.7.1

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


[PATCH 0/2] wifi disconnect timer

2010-10-26 Thread Kalle Valo
I'm at UDS right now and I have been debugging gsupplicant extensively and
I have had quite a lot of problems. I noticed a problem how the wifi 
plugin handles the wpasupplicant disconnect state. Here are two patches
how I propose to fix the issues. At least in my case the patches
helped a lot.

Kalle Valo (2):
  wifi: add a disconnected timer
  wifi: don't set associating state when roaming between APs

 plugins/wifi.c |   74 +--
 1 files changed, 66 insertions(+), 8 deletions(-)

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


Re: [PATCH] Start wpa_supplican is service not running.

2010-10-26 Thread Kalle Valo
 writes:

> I have created a patch for this issue. The patch invokes the
> Introspect method to autostart wpa_supplicant if it is not already
> running.

Thanks a lot for working on this. I didn't read the patch that carefully
yet, but I noticed something:

> + reply = dbus_connection_send_with_reply_and_block(connection,
> + message, -1, &error);

connman must never block, instead we need to use async interfaces.

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


[RFC v4 2/2] Add OpenVPN support to connect-vpn script

2010-10-26 Thread Daniel Wagner
From: Daniel Wagner 

---
 test/connect-vpn |   38 ++
 1 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/test/connect-vpn b/test/connect-vpn
index 22f1370..f4fa5b8 100755
--- a/test/connect-vpn
+++ b/test/connect-vpn
@@ -4,7 +4,7 @@ import sys
 import dbus
 
 if (len(sys.argv) < 4):
-   print "Usage: %s[cafile]" % (sys.argv[0])
+   print "Usage: %s  [cafile, 
cerfile, keyfile]" % (sys.argv[0])
sys.exit(1)
 
 bus = dbus.SystemBus()
@@ -12,18 +12,32 @@ bus = dbus.SystemBus()
 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
"org.moblin.connman.Manager")
 
-print "Attempting to connect service %s" % (sys.argv[1])
+print "Attempting to connect service %s" % (sys.argv[3])
 
-if (len(sys.argv) > 4):
-   path = manager.ConnectProvider(({ "Type": "openconnect", "Name": 
sys.argv[1],
-   "Host": sys.argv[2],
-   "OpenConnect.Cookie": sys.argv[3],
-   "OpenConnect.CACert": sys.argv[4],
-   "VPN.Domain": "intel.com"}))
+if sys.argv[1] == "openconnect":
+   if (len(sys.argv) > 5):
+   path = manager.ConnectProvider(({ "Type": "openconnect",
+   "Name": sys.argv[2],
+   "Host": sys.argv[3],
+   "VPN.Domain": sys.argv[4],
+   "OpenConnect.Cookie": sys.argv[5],
+   "OpenConnect.CACert": sys.argv[6]}))
+   else:
+   path = manager.ConnectProvider(({ "Type": "openconnect",
+   "Name": sys.argv[2],
+   "Host": sys.argv[3],
+   "VPN.Domain": sys.argv[4],
+   "OpenConnect.Cookie": sys.argv[5]}))
+elif sys.argv[1] == "openvpn":
+   path = manager.ConnectProvider(({ "Type": "openvpn",
+   "Name": sys.argv[2],
+   "Host": sys.argv[3],
+   "VPN.Domain": sys.argv[4],
+   "OpenVPN.CACert": sys.argv[5],
+   "OpenVPN.Cert": sys.argv[6],
+   "OpenVPN.Key": sys.argv[7]}))
 else:
-   path = manager.ConnectProvider(({ "Type": "openconnect", "Name": 
sys.argv[1],
-   "Host": sys.argv[2],
-   "OpenConnect.Cookie": sys.argv[3],
-   "VPN.Domain": "intel.com"}))
+   print "unknown service type"
+   sys.exit(1)
 
 print "VPN service path is %s" %(path)
-- 
1.7.2.3

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


Add OpenVPN Support

2010-10-26 Thread Daniel Wagner
Hi,

yet another update on this patch. OpenVPN is now running, but I'm
struggling with the settings. The OpenVPN server settings seems
broken. I can ping the server address (10.1.0.1) from my client
(10.1.0.6). But everything else doesn't work yet. Some more debugging
needed here :)

Another thing I found out is that if there is no netmask set on the
provider, connman does not setup the route. Don't know if this a bug
in connman or in my setup.

Besides this the plugin works fine. 

cheers,
daniel

v4: tell openvpn "vpn0" is a tun device
parsing DNS settings
v3: fixed obvious bugs reported by Samuel
add openvpn code again
v2: refactoring of openconnect (openvpn code is not ported yet)
v1: added missing connect-openvpn test script
v0: initial version

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


[RFC v4 1/2] Add OpenVPN support

2010-10-26 Thread Daniel Wagner
From: Daniel Wagner 

---
 Makefile.plugins |   32 +++-
 bootstrap-configure  |1 +
 configure.ac |   17 
 plugins/openvpn.c|  223 ++
 scripts/openvpn-script.c |  123 +
 5 files changed, 395 insertions(+), 1 deletions(-)
 create mode 100644 plugins/openvpn.c
 create mode 100644 scripts/openvpn-script.c

diff --git a/Makefile.plugins b/Makefile.plugins
index 261417e..163fe26 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -106,10 +106,19 @@ plugins_dhclient_la_LDFLAGS = $(plugin_ldflags)
 endif
 endif
 
+
+if OPENCONNECT
+builtin_sources += plugins/vpn.c
+else
+if OPENVPN
+builtin_sources += plugins/vpn.c
+endif
+endif
+
 if OPENCONNECT
 if OPENCONNECT_BUILTIN
 builtin_modules += openconnect
-builtin_sources += plugins/vpn.c plugins/openconnect.c
+builtin_sources += plugins/openconnect.c
 builtin_cflags += -DOPENCONNECT=\"@openconn...@\"
 else
 plugin_LTLIBRARIES += plugins/openconnect.la
@@ -121,6 +130,21 @@ plugins_openconnect_la_LDFLAGS = $(plugin_ldflags)
 endif
 endif
 
+if OPENVPN
+if OPENVPN_BUILTIN
+builtin_modules += openvpn
+builtin_sources += plugins/openvpn.c
+builtin_cflags += -DOPENVPN=\"@open...@\"
+else
+plugin_LTLIBRARIES += plugins/openvpn.la
+plugin_objects += $(plugins_openvpn_la_OBJECTS)
+plugins_openvpn_la_CFLAGS = $(plugin_cflags) -DOPENVPN=\"@open...@\" \
+   -DSTATEDIR=\""$(statedir)"\" \
+   -DSCRIPTDIR=\""$(build_scriptdir)"\"
+plugins_openvpn_la_LDFLAGS = $(plugin_ldflags)
+endif
+endif
+
 if PORTAL
 if PORTAL_BUILTIN
 builtin_modules += portal
@@ -229,6 +253,12 @@ script_PROGRAMS += scripts/openconnect-script
 scripts_openconnect_script_LDADD = @DBUS_LIBS@
 endif
 
+if OPENCONNECT
+script_PROGRAMS += scripts/openvpn-script
+
+scripts_openvpn_script_LDADD = @DBUS_LIBS@
+endif
+
 if DHCLIENT
 script_DATA += scripts/dhclient.conf
 script_PROGRAMS += scripts/dhclient-script
diff --git a/bootstrap-configure b/bootstrap-configure
index bda9708..3bce947 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -23,6 +23,7 @@ fi
--enable-ofono=builtin \
--enable-dhclient=builtin \
--enable-openconnect=builtin \
+   --enable-openvpn=builtin \
--enable-pacrunner=builtin \
--enable-dnsproxy=builtin \
--enable-google=builtin \
diff --git a/configure.ac b/configure.ac
index f45486e..2ec1d86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,6 +135,23 @@ AC_ARG_ENABLE(portal,
 AM_CONDITIONAL(PORTAL, test "${enable_portal}" != "no")
 AM_CONDITIONAL(PORTAL_BUILTIN, test "${enable_portal}" = "builtin")
 
+AC_ARG_WITH(openvpn, AC_HELP_STRING([--with-openvpn=PROGRAM],
+[specify location of openvpn binary]), [path_openvpn=${withval}])
+
+AC_ARG_ENABLE(openvpn,
+   AC_HELP_STRING([--enable-openvpn], [enable openvpn support]),
+   [enable_openvpn=${enableval}], [enable_openvpn="no"])
+if (test "${enable_openvpn}" != "no"); then
+   if (test -z "${path_openvpn}"); then
+   AC_PATH_PROG(OPENVPN, [openvpn], [], $PATH:/sbin:/usr/sbin)
+   else
+   OPENVPN="${path_openvpn}"
+   AC_SUBST(OPENVPN)
+   fi
+fi
+AM_CONDITIONAL(OPENVPN, test "${enable_openvpn}" != "no")
+AM_CONDITIONAL(OPENVPN_BUILTIN, test "${enable_openvpn}" = "builtin")
+
 AC_ARG_ENABLE(loopback,
AC_HELP_STRING([--enable-loopback], [enable loopback support]),
[enable_loopback=${enableval}], [enable_loopback="no"])
diff --git a/plugins/openvpn.c b/plugins/openvpn.c
new file mode 100644
index 000..24ae64a
--- /dev/null
+++ b/plugins/openvpn.c
@@ -0,0 +1,223 @@
+/*
+ *
+ *  Connection Manager
+ *
+ *  Copyright (C) 2010  BMW Car IT GmbH. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define CONNMAN_API_SUBJECT_TO_CHANGE
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "vpn.h"
+
+static DBusConnection *connection;
+
+static int ov_notify(DBusMessage *msg, struct connman_provider *provider)
+{
+   DBusMessageIter iter, dict;
+   struct oc_data *data;
+   

Re: [PACRUNNER][PATCH] Manual proxy configuration setting

2010-10-26 Thread David Woodhouse
On Mon, 2010-10-25 at 14:11 +0200, Marcel Holtmann wrote:
> > What about if given url provides an IP instead of an hostname: reverse 
> > dns? etc etc...
> 
> Good question. Right now, I would not go there, but maybe we have to.

Once we start handling split-routed VPNs, we'll need to. Possibly not
before then, though.

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation

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


Re: [PATCH 1/3] Extract content from HTTP response.

2010-10-26 Thread Marcel Holtmann
Hi Mohamed,

> > +GWeb *g_web_new(int index, const char *proxy)
> > +{
> > +   GWeb *web;
> > +
> > +   if (index < 0)
> > +   return NULL;
> > +
> > +   web = g_try_new0(GWeb, 1);
> > +   if (web == NULL)
> > +   return NULL;
> > +
> > +   web->ref_count = 1;
> > +
> > +   web->next_query_id = 1;
> > +
> > +   web->index = index;
> > +   web->session_list = NULL;
> > +
> > +   web->resolv = g_resolv_new(index);
> > +   if (web->resolv == NULL) {
> > +   g_free(web);
> > +   return NULL;
> > +   }
> > +
> > +   if (proxy != NULL) {
> > +   struct web_session session;
> > +
> > +   if (parse_url(&session, proxy) == 0) {
> > +   web->proxy = session.host;
> > +   web->proxy_port = session.port;
> > +   g_free(session.request);
> > +   }
> > +   }
> > +
> > +   return web;
> > +}
> > +
> 
> So here is a question. Do we really want to give a proxy URL? Or maybe
> just a host (maybe plus port number) to connect to?
> 
> I don't really know the best answer here. So I am happy if others shim
> in let me know their thoughts.

so I talked this over with Samuel and it seems to be good idea to just
give a proxy URL here. Something like http://proxy.example.com:911 or
similar.

However for the first patch make the API change, but just fail object
creating if proxy != NULL. We can add the patch for proxy support later
on. Makes the split a bit cleaner and easier for me to review the
patches.

Regards

Marcel


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


RE: [PATCH] Start wpa_supplican is service not running.

2010-10-26 Thread leena.gunda
I have created a patch for this issue. The patch invokes the Introspect method 
to autostart wpa_supplicant if it is not already running.

Patch:

--


 gsupplicant/dbus.c   |   29 +
 gsupplicant/dbus.h   |2 ++
 gsupplicant/supplicant.c |3 +--
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/gsupplicant/dbus.c b/gsupplicant/dbus.c
index 53c56ae..0009bc4 100644
--- a/gsupplicant/dbus.c
+++ b/gsupplicant/dbus.c
@@ -98,6 +98,35 @@ void supplicant_dbus_property_foreach(DBusMessageIter *iter,
  }
 }

+int supplicant_dbus_get_introspect(DBusConnection *connection)
+{
+ DBusMessage *message, *reply;
+ DBusError error;
+
+ message = dbus_message_new_method_call(SUPPLICANT_SERVICE,
+ SUPPLICANT_PATH,
+ DBUS_INTERFACE_INTROSPECTABLE,
+ "Introspect");
+
+ if (message == NULL)
+   return 0;
+
+ dbus_error_init(&error);
+
+ reply = dbus_connection_send_with_reply_and_block(connection,
+ message, -1, &error);
+
+ if (reply == NULL) {
+   dbus_message_unref(message);
+   return 0;
+ }
+
+ if (dbus_error_is_set(&error) == TRUE)
+   return 0;
+
+ return 1;
+}
+
 struct property_get_data {
  supplicant_dbus_property_function function;
  void *user_data;
diff --git a/gsupplicant/dbus.h b/gsupplicant/dbus.h
index 642e8b1..158212d 100644
--- a/gsupplicant/dbus.h
+++ b/gsupplicant/dbus.h
@@ -47,6 +47,8 @@ void supplicant_dbus_property_foreach(DBusMessageIter *iter,
supplicant_dbus_property_function function,
  void *user_data);

+int supplicant_dbus_get_introspect(DBusConnection *conn);
+
 int supplicant_dbus_property_get_all(const char *path, const char *interface,
supplicant_dbus_property_function function,
  void *user_data);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 322b63d..d63616a 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2420,8 +2420,7 @@ int g_supplicant_register(const GSupplicantCallbacks 
*callbacks)
  dbus_bus_add_match(connection, g_supplicant_rule6, NULL);
  dbus_connection_flush(connection);

- if (dbus_bus_name_has_owner(connection,
- SUPPLICANT_SERVICE, NULL) == TRUE) {
+ if (supplicant_dbus_get_introspect(connection) == TRUE) {
system_available = TRUE;
supplicant_dbus_property_get_all(SUPPLICANT_PATH,
SUPPLICANT_INTERFACE,
 --




From: connman-boun...@connman.net on behalf of Abbas, Mohamed
Sent: Mon 10/25/2010 11:39 PM
To: connman@connman.net
Subject: RE: [PATCH] Start wpa_supplican is service not running.







Mohamed, do you want to create a patch or should I do it?
If you know what is needed you can start on it.
Mohamed

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



Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com
<>___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman