Re: connman wlan0 scan gets stuck?

2013-01-07 Thread Patrik Flykt

Hi,

On Fri, 2013-01-04 at 09:25 -0800, Stan Hu wrote:
 Let's say you took your device somewhere and connected to SSID Alice.
 connman saves a settings file in /var/lib/connman for this successful
 connection.  Let's say you then moved your device and connected to
 SSID Bob.  connman also saves another settings file for this
 connection.
 
 Now, when connman starts up, it asks wpa_supplicant to scan SSIDs
 Alice and Bob and the frequencies on which the device last connected.

The SSIDs are scanned only if the WiFi networks were hidden, in other
cases a normal broadcast scan is done.

 Since Alice doesn't exist, the nl80211 driver reports:
 
 nl80211: Scan trigger failed: ret=-22 (Invalid argument)

Which version of wpa_supplicant is in use?

 wpa_supplicant never returns a successful scan, so connman gets stuck
 waiting for the scan to complete.  If you call 'iwlist wlan0
 scanning', this causes the nl80211 driver to do a full scan WITHOUT
 the SSIDs.  wpa_supplicant returns back the results,connman resumes,
 and everything works.

Can you check ConnMan is stuck by running either 'test/test-connman scan
wifi' or 'connmanctl scan wifi'? Both commands wait until the scan is
done, which is a few seconds. What about a subsequent scan? If they
never return there is a bug somewhere. 

Cheers,

Patrik


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


[PATCH 2/2] inet: Fix error handling when bridging interfaces

2013-01-07 Thread Forest Bond
From: Forest Bond forest.b...@rapidrollout.com

Functions that add and remove interfaces to and from bridges now return
an appropriate error code.
---
 src/inet.c |   40 ++--
 1 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/src/inet.c b/src/inet.c
index c360f56..0027fe6 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -1183,59 +1183,63 @@ connman_bool_t connman_inet_compare_subnet(int index, 
const char *host)
 int connman_inet_remove_from_bridge(int index, const char *bridge)
 {
struct ifreq ifr;
-   int sk, err;
+   int sk, err = 0;
 
if (bridge == NULL)
return -EINVAL;
 
sk = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
-   if (sk  0)
-   return sk;
+   if (sk  0) {
+   err = -errno;
+   goto out;
+   }
 
memset(ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, bridge, IFNAMSIZ - 1);
ifr.ifr_ifindex = index;
 
-   err = ioctl(sk, SIOCBRDELIF, ifr);
+   if (ioctl(sk, SIOCBRDELIF, ifr)  0)
+   err = -errno;
 
close(sk);
 
-   if (err  0) {
+out:
+   if (err  0)
connman_error(Remove interface from bridge error %s,
-   strerror(errno));
-   return err;
-   }
+   strerror(-err));
 
-   return 0;
+   return err;
 }
 
 int connman_inet_add_to_bridge(int index, const char *bridge)
 {
struct ifreq ifr;
-   int sk, err;
+   int sk, err = 0;
 
if (bridge == NULL)
return -EINVAL;
 
sk = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
-   if (sk  0)
-   return sk;
+   if (sk  0) {
+   err = -errno;
+   goto out;
+   }
 
memset(ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, bridge, IFNAMSIZ - 1);
ifr.ifr_ifindex = index;
 
-   err = ioctl(sk, SIOCBRADDIF, ifr);
+   if (ioctl(sk, SIOCBRADDIF, ifr)  0)
+   err = -errno;
 
close(sk);
 
-   if (err  0) {
+out:
+   if (err  0)
connman_error(Add interface to bridge error %s,
-   strerror(errno));
-   return err;
-   }
+   strerror(-err));
 
-   return 0;
+   return err;
 }
 
 int connman_inet_set_mtu(int index, int mtu)
-- 
1.7.0.4
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: connman wlan0 scan gets stuck?

2013-01-07 Thread Stan Hu
On Mon, Jan 7, 2013 at 12:30 AM, Patrik Flykt
patrik.fl...@linux.intel.comwrote:


 Hi,

 On Fri, 2013-01-04 at 09:25 -0800, Stan Hu wrote:
  Let's say you took your device somewhere and connected to SSID Alice.
  connman saves a settings file in /var/lib/connman for this successful
  connection.  Let's say you then moved your device and connected to
  SSID Bob.  connman also saves another settings file for this
  connection.
 
  Now, when connman starts up, it asks wpa_supplicant to scan SSIDs
  Alice and Bob and the frequencies on which the device last connected.

 The SSIDs are scanned only if the WiFi networks were hidden, in other
 cases a normal broadcast scan is done.


connman v1.4 looks like it attempts to scan all the most recent networks
that were connected in get_latest_connections() (i.e. profiles that are
stored in /var/lib/connman/wifi_*)  I think this is true in the latest
version of connman as well.



  Since Alice doesn't exist, the nl80211 driver reports:
 
  nl80211: Scan trigger failed: ret=-22 (Invalid argument)

 Which version of wpa_supplicant is in use?


I am using wpa_supplicant v0.73.

I think I now fully understand where the -22 invalid argument error is
coming from.  It appears that the nl80211 scan fails because connman
inserts more SSIDs than allowed by the the driver (max_scan_ssids).
 wpa_supplicant v1.0 added support for the MaxScanSSID parameter.  Since
v0.73 doesn't support this parameter, this parameter defaults to
WPAS_MAX_SCAN_SSIDS (4):

connmand[2478]: plugins/wifi.c:wifi_scan_fast() device 0x99048 0x91738
connmand[2478]: plugins/wifi.c:wifi_scan_fast() max ssids 4

The driver on my WiFi device supports only 1 SSID scan.  Since connman
attempts to feed 2 SSID devices, the failure causes connman to get stuck
waiting for a scan to complete.

This problem would be cured by upgrading to wpa_supplicant v1.0, but I do
think this issue raises a number of questions:

1) Should the WPAS_MAX_SCAN_SSIDS in the supplicant be set to 0 or 1 by
default instead of 4?
2) Why doesn't connman time out on the scan after failing to receive a
response from wpa_supplicant?
3) wpa_supplicant should send an error message back to connman, which
should abort the scan.

 wpa_supplicant never returns a successful scan, so connman gets stuck
  waiting for the scan to complete.  If you call 'iwlist wlan0
  scanning', this causes the nl80211 driver to do a full scan WITHOUT
  the SSIDs.  wpa_supplicant returns back the results,connman resumes,
  and everything works.

 Can you check ConnMan is stuck by running either 'test/test-connman scan
 wifi' or 'connmanctl scan wifi'? Both commands wait until the scan is
 done, which is a few seconds. What about a subsequent scan? If they
 never return there is a bug somewhere.


I get a dbus error when I attempt to use  'test/test-connman scan wifi'.
 iwlist is the only thing that kicks it out of the state.


 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


Can't connect to VPN

2013-01-07 Thread Yevhen Kyriukha
Hi!

I'm using connman v1.10.
I created settings for my VPN connection in /var/lib/connman directory.
I want connman to bring VPN connection automatically at boot time.

But connman-vpn daemon doesn't see config files:
when I run vpn-get script to get available VPN services I see No
VPN configurations found, quitting in syslog.

I can connect to VPN only if I execute connect-provider script which
creates connection and then connects to it.
Then I get some output from vpn-get, but until reboot of connman-vpn service.

Very strange issue. Could you help me, please.

--
Best regards,
Yevhen
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman