Re: Background scan issues?

2014-08-13 Thread Tomasz Bursztyka

Hi,


Thanks. I agree that it looks hardware related. But several people in
the Arch Linux forums were complaining about the same issue, so it
might be a widespread Linux driver shortcoming worth considering.


Wait, using only ConnMan or not? Because if that happens only with 
ConnMan...

Maybe finally we have an issue there.


Surprisingly if I run wpa_supplicant with this settings:
http://pastebin.com/p4xsS5ri  (using netctl) my connection is stable.

Here's the log for connman and wpa_supplicant:
http://pastebin.com/PTfixCF8  http://pastebin.com/NgWsLap6

How can I make connman instantiate wpa_supplicant with the -ddt option?


Best is you stop both connman and wpa_supplicant and you restart them by 
hand, wpa_supplicant first.


./wpa_supplicant -u -ddt  wpa_supplicant.log

then on another terminal: CONNMAN_SUPPLICANT_DEBUG=1 connmand -n -d  
connman.log


and you paste the *.log files.

Thanks,

Tomasz

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


[PATCH 0/3] Provide WiFi security type in config files

2014-08-13 Thread Patrik Flykt

Hi,

With this patch set it becomes possible to add a 'Security=...' option
to .config files so that only the WiFi network with the intended security
type is detected. If this setting is omitted, it defaults to EAP if EAP is
configured and to WPA PSK if a passprhase is specified.

Cheers,

Patrik


Patrik Flykt (3):
  service: Add helper function for getting security type
  config: Add option specify WiFi security in a .config file
  doc: Document the config file 'Security' option

 doc/config-format.txt |  4 
 src/config.c  | 41 +
 src/connman.h |  1 +
 src/service.c | 17 +
 4 files changed, 63 insertions(+)

-- 
1.9.1

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


[PATCH 1/3] service: Add helper function for getting security type

2014-08-13 Thread Patrik Flykt
Input a string, output a security type, if any was detected.
---
 src/connman.h |  1 +
 src/service.c | 17 +
 2 files changed, 18 insertions(+)

diff --git a/src/connman.h b/src/connman.h
index db6461f..9fecb28 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -736,6 +736,7 @@ void __connman_service_set_config(struct connman_service 
*service,
 
 const char *__connman_service_type2string(enum connman_service_type type);
 enum connman_service_type __connman_service_string2type(const char *str);
+enum connman_service_security __connman_service_string2security(const char 
*str);
 
 int __connman_service_nameserver_append(struct connman_service *service,
const char *nameserver, bool is_auto);
diff --git a/src/service.c b/src/service.c
index 5c9a3db..0d2007d 100644
--- a/src/service.c
+++ b/src/service.c
@@ -234,6 +234,23 @@ enum connman_service_type 
__connman_service_string2type(const char *str)
return CONNMAN_SERVICE_TYPE_UNKNOWN;
 }
 
+enum connman_service_security __connman_service_string2security(const char 
*str)
+{
+   if (!str)
+   return CONNMAN_SERVICE_SECURITY_UNKNOWN;
+
+   if (!strcmp(str, psk))
+   return CONNMAN_SERVICE_SECURITY_PSK;
+   if (!strcmp(str, ieee8021x))
+   return CONNMAN_SERVICE_SECURITY_8021X;
+   if (!strcmp(str, none))
+   return CONNMAN_SERVICE_SECURITY_NONE;
+   if (!strcmp(str, wep))
+   return CONNMAN_SERVICE_SECURITY_WEP;
+
+   return CONNMAN_SERVICE_SECURITY_UNKNOWN;
+}
+
 static const char *security2string(enum connman_service_security security)
 {
switch (security) {
-- 
1.9.1

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


[PATCH 2/3] config: Add option specify WiFi security in a .config file

2014-08-13 Thread Patrik Flykt
Add a 'Security' option to specify the WiFi security type. By default
the security mode is set to WPA PSK if a passphrase is present.
Configuring EAP takes precedence over this option.

Fixes CM-661
---
 src/config.c | 41 +
 1 file changed, 41 insertions(+)

diff --git a/src/config.c b/src/config.c
index 330ae81..136ce7b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -52,6 +52,7 @@ struct connman_config_service {
char *private_key_passphrase_type;
char *phase2;
char *passphrase;
+   enum connman_service_security security;
GSList *service_identifiers;
char *config_ident; /* file prefix */
char *config_entry; /* entry name */
@@ -99,6 +100,7 @@ static bool cleanup = false;
 #define SERVICE_KEY_IDENTITY   Identity
 #define SERVICE_KEY_PHASE2 Phase2
 #define SERVICE_KEY_PASSPHRASE Passphrase
+#define SERVICE_KEY_SECURITY   Security
 #define SERVICE_KEY_HIDDEN Hidden
 
 #define SERVICE_KEY_IPv4   IPv4
@@ -129,6 +131,7 @@ static const char *service_possible_keys[] = {
SERVICE_KEY_IDENTITY,
SERVICE_KEY_PHASE2,
SERVICE_KEY_PASSPHRASE,
+   SERVICE_KEY_SECURITY,
SERVICE_KEY_HIDDEN,
SERVICE_KEY_IPv4,
SERVICE_KEY_IPv6,
@@ -513,6 +516,7 @@ static bool load_service(GKeyFile *keyfile, const char 
*group,
struct connman_config_service *service;
const char *ident;
char *str, *hex_ssid;
+   enum connman_service_security security;
bool service_created = false;
 
/* Strip off service_ prefix */
@@ -664,6 +668,38 @@ static bool load_service(GKeyFile *keyfile, const char 
*group,
service-passphrase = str;
}
 
+   str = __connman_config_get_string(keyfile, group, SERVICE_KEY_SECURITY,
+   NULL);
+   security = __connman_service_string2security(str);
+
+   if (service-eap) {
+
+   if (str  security != CONNMAN_SERVICE_SECURITY_8021X)
+   connman_info(Mismatch between EAP configuration and 
+   setting %s = %s,
+   SERVICE_KEY_SECURITY, str);
+
+   service-security = CONNMAN_SERVICE_SECURITY_8021X;
+
+   } else if (service-passphrase) {
+
+   if (str) {
+   if (security == CONNMAN_SERVICE_SECURITY_PSK ||
+   security == 
CONNMAN_SERVICE_SECURITY_WEP) {
+   service-security = security;
+   } else {
+   connman_info(Mismatch with passphrase and 
+   setting %s = %s,
+   SERVICE_KEY_SECURITY, str);
+
+   service-security =
+   CONNMAN_SERVICE_SECURITY_PSK;
+   }
+
+   } else
+   service-security = CONNMAN_SERVICE_SECURITY_PSK;
+   }
+
service-config_ident = g_strdup(config-ident);
service-config_entry = g_strdup_printf(service_%s, service-ident);
 
@@ -1062,6 +1098,7 @@ static int try_provision_service(struct 
connman_config_service *config,
enum connman_service_type type;
const void *ssid;
unsigned int ssid_len;
+   const char *str;
 
type = connman_service_get_type(service);
if (type == CONNMAN_SERVICE_TYPE_WIFI 
@@ -1120,6 +1157,10 @@ static int try_provision_service(struct 
connman_config_service *config,
 
if (memcmp(config-ssid, ssid, ssid_len) != 0)
return -ENOENT;
+
+   str = connman_network_get_string(network, WiFi.Security);
+   if (config-security != __connman_service_string2security(str))
+   return -ENOENT;
}
 
if (!config-ipv6_address) {
-- 
1.9.1

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


RE: [PATCH v2] device: Make sure the device is up and running before enabling it

2014-08-13 Thread Pasi Sjöholm
Hi,

this patch will break cellular connectivity when coming out of flight mode as 
the modem is still powered off and will lead to ENODEV-error (19). Therefore it 
should not try to bring cellular-interfaces up or accept ENODEV as valid 
response.

--cut--
connmand[2510]: plugins/ofono.c:modem_probe() /ril_0 device 0x1cc9d10
connmand[2510]: src/technology.c:__connman_technology_add_device() device 
0x1cc9d10 type Cellular
connmand[2510]: src/technology.c:technology_get() type 5
connmand[2510]: src/technology.c:technology_find() type 5
connmand[2510]: src/technology.c:technology_get() technology (nil) driver 
0xacf38
connmand[2510]: src/technology.c:technology_load() technology 0x1cdef58
connmand[2510]: src/storage.c:storage_load() Loading /var/lib/connman/settings
connmand[2510]: src/technology.c:technology_get() technology 0x1cdef58
connmand[2510]: src/device.c:__connman_device_enable() device 0x1cc9d10
connmand[2510]: src/device.c:__connman_device_enable() device 0x1cc9d10, err -19
connmand[2510]: src/storage.c:storage_load() Loading /var/lib/connman/settings
connmand[2510]: plugins/ofono.c:modem_set_online() /ril_0 online 1
connmand[2510]: plugins/ofono.c:set_property() /ril_0 path /ril_0 
org.ofono.Modem.Online
connmand[2510]: src/device.c:connman_device_set_powered() driver 0x1cc9d10 
powered 0
connmand[2510]: plugins/ofono.c:modem_changed() /ril_0 Interfaces 0x05
connmand[2510]: plugins/ofono.c:modem_update_interfaces() /ril_0
connmand[2510]: plugins/ofono.c:api_added() cm added
connmand[2510]: plugins/ofono.c:get_properties() /ril_0 path /ril_0 
org.ofono.ConnectionManager
connmand[2510]: plugins/ofono.c:cm_get_contexts() /ril_0
connmand[2510]: plugins/ofono.c:modem_changed() /ril_0 Serial 359745050002549
connmand[2510]: src/service.c:connman_service_create() service 0x1cdb8d0
connmand[2510]: src/service.c:service_initialize() service 0x1cdb8d0
connmand[2510]: src/service.c:service_load() service 
cellular_244919750451136_context1
connmand[2510]: src/storage.c:storage_load() Loading 
/var/lib/connman/cellular_244919750451136_context1/settings
connmand[2510]: src/service.c:connman_service_create() service 0x1cdb8d0
connmand[2510]: src/service.c:service_initialize() service 0x1cdb8d0
--cut--

Br,
Pasi


From: connman [connman-boun...@connman.net] on behalf of Tomasz Bursztyka 
[tomasz.burszt...@linux.intel.com]
Sent: Thursday, August 07, 2014 12:05
To: connman@connman.net
Subject: [PATCH v2] device: Make sure the device is up and running before 
enabling it

It can happen that, after a unproper ConnMan exit, a device is still up.
Once ConnMan is restarted cleanup_devices() will put this device down.
But then, it will never set it up again.

04:08:45 connmand[254]: src/device.c:__connman_device_init()
04:08:45 connmand[254]: src/inet.c:__connman_inet_get_address_netmask() index 2
04:08:45 connmand[254]: src/device.c:cleanup_devices() cleaning up wlan0 index 2
(...)
04:08:45 connmand[254]: wlan0 {newlink} index 2 operstate 2 DOWN
(...)
04:08:45 connmand[254]: plugins/wifi.c:wifi_newlink() index 2 flags 36866 
change 0
04:08:45 connmand[254]: src/technology.c:__connman_technology_add_device() 
device 0x35e8a8 type WiFi
04:08:45 connmand[254]: src/technology.c:technology_get() type 3
04:08:45 connmand[254]: src/technology.c:technology_find() type 3
04:08:45 connmand[254]: src/device.c:__connman_device_enable() device 0x35e8a8

Reported by Richard Röjfors richard.rojf...@gmail.com
---
 src/device.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/device.c b/src/device.c
index a97d790..1a5f0e6 100644
--- a/src/device.c
+++ b/src/device.c
@@ -185,6 +185,10 @@ int __connman_device_enable(struct connman_device *device)
if (device-powered_pending == PENDING_NONE  device-powered)
return -EALREADY;

+   err = connman_inet_ifup(device-index);
+   if (err  0  err != -EALREADY)
+   return err;
+
device-powered_pending = PENDING_ENABLE;

err = device-driver-enable(device);
--
1.8.5.5

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


[PATCH 2/2] wifi: Start P2P find if there's no ongoing discovery

2014-08-13 Thread Eduardo Abinader
Just to avoid an amount of p2p_call, if another is
already taking place.
---
 gsupplicant/gsupplicant.h | 2 ++
 gsupplicant/supplicant.c  | 8 
 plugins/wifi.c| 8 +++-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 207e281..1e9812e 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -268,6 +268,8 @@ int 
g_supplicant_interface_set_p2p_device_config(GSupplicantInterface *interface
 GSupplicantPeer *g_supplicant_interface_peer_lookup(GSupplicantInterface 
*interface,
const char *identifier);
 
+bool g_supplicant_interface_is_p2p_finding(GSupplicantInterface *interface);
+
 /* Network and Peer API */
 struct _GSupplicantNetwork;
 struct _GSupplicantGroup;
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index f188d0c..1d5c813 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -4647,6 +4647,14 @@ int g_supplicant_interface_p2p_find(GSupplicantInterface 
*interface,
return ret;
 }
 
+bool g_supplicant_interface_is_p2p_finding(GSupplicantInterface *interface)
+{
+   if (!interface)
+   return false;
+
+   return interface-p2p_finding;
+}
+
 int g_supplicant_interface_p2p_stop_find(GSupplicantInterface *interface)
 {
if (!interface-p2p_finding)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index f741bec..cd13fee 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1376,7 +1376,7 @@ error:
 
 static int p2p_find(struct connman_device *device)
 {
-   struct wifi_data *wifi = connman_device_get_data(device);
+   struct wifi_data *wifi;
int ret;
 
DBG();
@@ -1384,11 +1384,17 @@ static int p2p_find(struct connman_device *device)
if (!p2p_technology)
return -ENOTSUP;
 
+   wifi = connman_device_get_data(device);
+
+   if (g_supplicant_interface_is_p2p_finding(wifi-interface))
+   return -EALREADY;
+
reset_autoscan(device);
connman_device_ref(device);
 
ret = g_supplicant_interface_p2p_find(wifi-interface,
p2p_find_callback, device);
+
if (ret) {
connman_device_unref(device);
start_autoscan(device);
-- 
1.9.1

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


[PATCH 0/2] Some improvement in p2p find

2014-08-13 Thread Eduardo Abinader
The following patchset tries to improve the peer discovery,
by antecipating p2p find start, if requested, despite a wifi 
scan running. Furthermore, detects if there's an ongoing p2p 
find and returns earlier.

Thanks for feedback from Tomasz Bursztyka

Eduardo Abinader (2):
  gsupplicant: Start p2p finding even if scanning
  wifi: Start P2P find if there's no ongoing discovery

 gsupplicant/gsupplicant.h |  2 ++
 gsupplicant/supplicant.c  | 10 +-
 plugins/wifi.c|  8 +++-
 3 files changed, 18 insertions(+), 2 deletions(-)

-- 
1.9.1

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


[PATCH 1/2] gsupplicant: Start p2p finding even if scanning

2014-08-13 Thread Eduardo Abinader
In order to avoid deferred p2p find, if a scan is taking
place, a request to start a p2p discovery could be initiated
or scheduled (radio work add in wpa_suplicant) despite
wifi scanning.
---
 gsupplicant/supplicant.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 6dad7a9..f188d0c 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -4623,7 +4623,7 @@ int g_supplicant_interface_p2p_find(GSupplicantInterface 
*interface,
return -ENOTSUP;
 
ret = interface_ready_to_scan(interface);
-   if (ret)
+   if (ret  ret != -EALREADY)
return ret;
 
data = dbus_malloc0(sizeof(*data));
-- 
1.9.1

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