Re: connmand[186]: Online check failed but running dhclient manually fixes this issue
by Denis Kenzior
Hi,
On 09/05/2017 09:46 AM, Alexander Couzens wrote:
> On Thu, 10 Aug 2017 12:47:28 +0200
> Daniel Wagner <wagi(a)monom.org> wrote:
>
>>> Bus 001 Device 003: ID 1bc7:1201 Telit Wireless Solutions
>>
>> Here is a compile tested 'fix'. I don't know if this works and\
>> obviously it doesn't follow the coding guide lines for this
>> project. If you could test this and report back the outcome
>> that would be really helpful. Then I can create a proper
>> patch for Denis.
>
> I can confirm this bug with an quectel ec20 using the firmware
> EC20EQAR02A13E2G 1 [Jul 5 2017 10:49:17].
>
> To reproduce using ofono w/o connman. linux 4.12.8
> - call ofono "../context1 Active true"
> - set the ip by hand. No ping response.
> - using dhcpcd. Ping responses.
>
> The `ip addr show` looks the same, except the interface has now an ipv6
> link local address. Is this is problem of modern LTE cards?
> Could be raw-ip or 802.3 encapsulations the problem?
>
Here's something Reinhard said in a different thread that might be
applicable here:
"Unfortunately the PLS8 seems to need DHCP to be used as a trigger to
pass IPv4 traffic over the network interface even if the parameters
could be obtained from AT commands.
This restriction also holds for some other Qualcomm firmwares when the
QMI network interface is used in Ethernet mode instead of Raw IP mode."
If this is true, then falling back to DHCP would seem to be required for
many Qualcomm based devices. This seems to be a recently introduced
'bug' as older QMI devices did not need this workaround.
Regards,
-Denis
3 years, 1 month
[PATCH] wifi: Don't perform handle_wps_completion() when p2p is connecting
by Saurav Babu
When p2p is connecting and other device acts as Group owner then
G_SUPPLICANT_STATE_COMPLETED is received after P2P Group formation is
success. handle_wps_completion() function disconnects the network if
wps_ssid doesn't match with ssid, due to this reason P2P connection is
never successful.
---
plugins/wifi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 74f216d..a874112 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2415,6 +2415,9 @@ static void interface_state(GSupplicantInterface *interface)
/* though it should be already stopped: */
stop_autoscan(device);
+ if (wifi->p2p_connecting)
+ break;
+
if (!handle_wps_completion(interface, network, device, wifi))
break;
--
1.9.1
3 years, 1 month
[PATCH 0/3] Add options to configure Online check
by Christophe Ronco
Hi,
I have added some options to configure URLs used to do the online check.
I have added to options to set the URLs for IPv4 and IPv6 and another option
to disable the check of X-ConnMan-Status HTTP header.
The goal is to have this feature for boards that do not have access to Internet.
Best Regards,
Christophe Ronco
Christophe Ronco (3):
main: add options to configure Online check
wispr: implement options to configure Online check
main.conf: document options to configure Online check
doc/connman.conf.5.in | 15 +++++++++++++++
include/setting.h | 1 +
src/main.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-
src/main.conf | 15 +++++++++++++++
src/wispr.c | 17 +++++++++++------
5 files changed, 93 insertions(+), 7 deletions(-)
--
2.7.4
3 years, 1 month
[PATCH 1/2] wifi: Fix behaviour when Background scanning is disabled
by jose@blanquicet.com
From: Jose Blanquicet <jose(a)blanquicet.com>
Conditions when ConnMan will perform active instead of passive scanning:
1. WiFi Driver support active scanning, it means "MaxScanSSID" is
greater than 1.
2. User has successfully connected to at least one WiFi network in the
past so the service information is present in
{STOREDIR}/connman/wifi_* but none of those networks are currently in
range. They will be called "known-services" from now.
Current behaviour when BackgroundScanning is enabled:
- D-Bus scan request or at start-up of system -> Launch an
active/passive scan (Based on above conditions)
- 3 seconds -> Launch passive scan
- 9 seconds -> Launch passive scan
- ...
- 243 seconds -> Launch passive scan
- 300 seconds -> Launch passive scan
- Continue each 300 seconds unless user performs a new D-Bus scan call
which will cause the procedure to restart from 3 seconds.
This patch does not change the ConnMan's behaviour when
BackgroundScanning is enabled. However, when it is disabled and
conditions for active scanning are true, ConnMan could fall in the
following situation:
- D-Bus scan request or at start-up of system -> Launch an active scan
- Stop scanning
One single scan is done and it is an active one. It means that ConnMan
will perform an active scan looking for those known-services in their
specific frequencies, this kind of scanning is generally faster than a
passive one which allows to speed up auto-connection procedure.
However, we have seen that in case of none of these knwon-services is in
range some drivers reply only with all the networks in the specified
frequencies and some other does not reply any network. This could result
in an always empty services list.
Therefore, this patch looks for avoid such situation by adding a passive
scan in such cases. The new behaviour is also based on the conditions
mentioned at the beginning:
1. Active scanning:
- D-Bus scan request or at start-up of system -> Launch an active scan
- 3 seconds -> Launch passive scan
- Stop scanning
- New D-Bus scan request from user -> Launch an active scan
- 3 seconds -> Launch passive scan
- Stop scanning
2. Passive scanning:
- D-Bus scan request or at start-up of system -> Launch one passive scan
- Stop scanning
- New D-Bus scan request from user -> Launch one passive scan
- Stop scanning
Take into account that all the behaviours described above are followed
when wifi has not get connected. Once it is connected, ConnMan stops its
background scanning procedure and if BackgroundScanning is enabled, it
asks wpa_supplicant to perform the background scanning while connected
only for wifi roaming purposes. See "wpa_supplicant configuration"
section in README file for further details.
---
Hi Jonah,
Could you please test this patch and give us your feedback?
Thanks,
Jose Blanquicet
plugins/wifi.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 93 insertions(+), 16 deletions(-)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 34c16df..206c05e 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -64,7 +64,8 @@
#define FAVORITE_MAXIMUM_RETRIES 2
#define BGSCAN_DEFAULT "simple:30:-45:300"
-#define AUTOSCAN_DEFAULT "exponential:3:300"
+#define AUTOSCAN_EXPONENTIAL "exponential:3:300"
+#define AUTOSCAN_SINGLE "single:3"
#define P2P_FIND_TIMEOUT 30
#define P2P_CONNECTION_TIMEOUT 100
@@ -83,6 +84,12 @@ enum wifi_ap_capability{
WIFI_AP_NOT_SUPPORTED = 2,
};
+enum wifi_scanning_type {
+ WIFI_SCANNING_UNKNOWN = 0,
+ WIFI_SCANNING_PASSIVE = 1,
+ WIFI_SCANNING_ACTIVE = 2,
+};
+
struct hidden_params {
char ssid[32];
unsigned int ssid_len;
@@ -143,7 +150,7 @@ struct wifi_data {
* autoscan "emulation".
*/
struct autoscan_params *autoscan;
-
+ enum wifi_scanning_type scanning_type;
GSupplicantScanParams *scan_params;
unsigned int p2p_find_timeout;
unsigned int p2p_connection_timeout;
@@ -831,13 +838,13 @@ static void reset_autoscan(struct connman_device *device)
autoscan = wifi->autoscan;
- if (autoscan->timeout == 0 && autoscan->interval == 0)
+ autoscan->interval = 0;
+
+ if (autoscan->timeout == 0)
return;
g_source_remove(autoscan->timeout);
-
autoscan->timeout = 0;
- autoscan->interval = 0;
connman_device_unref(device);
}
@@ -1363,6 +1370,21 @@ static gboolean autoscan_timeout(gpointer data)
throw_wifi_scan(wifi->device, scan_callback_hidden);
+ /*
+ * In case BackgroundScanning is disabled, interval will reach the
+ * limit exactly after the very first passive scanning. It allows
+ * to ensure at most one passive scan is performed in such cases.
+ */
+ if (!connman_setting_get_bool("BackgroundScanning") &&
+ interval == autoscan->limit) {
+ g_source_remove(autoscan->timeout);
+ autoscan->timeout = 0;
+
+ connman_device_unref(device);
+
+ return FALSE;
+ }
+
set_interval:
DBG("interval %d", interval);
@@ -1409,19 +1431,25 @@ static struct autoscan_params *parse_autoscan_params(const char *params)
int limit;
int base;
- DBG("Emulating autoscan");
+ DBG("");
list_params = g_strsplit(params, ":", 0);
if (list_params == 0)
return NULL;
- if (g_strv_length(list_params) < 3) {
+ if (!g_strcmp0(list_params[0], "exponential") &&
+ g_strv_length(list_params) == 3) {
+ base = atoi(list_params[1]);
+ limit = atoi(list_params[2]);
+ } else if (!g_strcmp0(list_params[0], "single") &&
+ g_strv_length(list_params) == 2)
+ base = limit = atoi(list_params[1]);
+ else {
g_strfreev(list_params);
return NULL;
}
- base = atoi(list_params[1]);
- limit = atoi(list_params[2]);
+ DBG("Setup %s autoscanning", list_params[0]);
g_strfreev(list_params);
@@ -1440,10 +1468,37 @@ static struct autoscan_params *parse_autoscan_params(const char *params)
static void setup_autoscan(struct wifi_data *wifi)
{
- if (!wifi->autoscan)
- wifi->autoscan = parse_autoscan_params(AUTOSCAN_DEFAULT);
+ /*
+ * If BackgroundScanning is enabled, setup exponential
+ * autoscanning if it has not been previously done.
+ */
+ if (connman_setting_get_bool("BackgroundScanning")) {
+ wifi->autoscan = parse_autoscan_params(AUTOSCAN_EXPONENTIAL);
+ return;
+ }
- start_autoscan(wifi->device);
+ /*
+ * On the contrary, if BackgroundScanning is disabled, update autoscan
+ * parameters based on the type of scanning that is being performed.
+ */
+ if (wifi->autoscan) {
+ g_free(wifi->autoscan);
+ wifi->autoscan = NULL;
+ }
+
+ switch (wifi->scanning_type) {
+ case WIFI_SCANNING_PASSIVE:
+ /* Do not setup autoscan. */
+ break;
+ case WIFI_SCANNING_ACTIVE:
+ /* Setup one single passive scan after active. */
+ wifi->autoscan = parse_autoscan_params(AUTOSCAN_SINGLE);
+ break;
+ case WIFI_SCANNING_UNKNOWN:
+ /* Setup autoscan in this case but we should never fall here. */
+ wifi->autoscan = parse_autoscan_params(AUTOSCAN_SINGLE);
+ break;
+ }
}
static void finalize_interface_creation(struct wifi_data *wifi)
@@ -1457,13 +1512,13 @@ static void finalize_interface_creation(struct wifi_data *wifi)
connman_device_set_powered(wifi->device, true);
- if (!connman_setting_get_bool("BackgroundScanning"))
- return;
-
if (wifi->p2p_device)
return;
- setup_autoscan(wifi);
+ if (!wifi->autoscan)
+ setup_autoscan(wifi);
+
+ start_autoscan(wifi->device);
}
static void interface_create_callback(int result,
@@ -1691,10 +1746,29 @@ static int get_latest_connections(int max_ssids,
return num_ssids;
}
+static void wifi_update_scanner_type(struct wifi_data *wifi,
+ enum wifi_scanning_type new_type)
+{
+ DBG("");
+
+ if (!wifi || wifi->scanning_type == new_type)
+ return;
+
+ wifi->scanning_type = new_type;
+
+ setup_autoscan(wifi);
+}
+
static int wifi_scan_simple(struct connman_device *device)
{
+ struct wifi_data *wifi = connman_device_get_data(device);
+
reset_autoscan(device);
+ /* Distinguish between devices performing passive and active scanning */
+ if (wifi)
+ wifi_update_scanner_type(wifi, WIFI_SCANNING_PASSIVE);
+
return throw_wifi_scan(device, scan_callback_hidden);
}
@@ -1887,6 +1961,9 @@ static int wifi_scan(enum connman_service_type type,
}
}
+ /* Distinguish between devices performing passive and active scanning */
+ wifi_update_scanner_type(wifi, WIFI_SCANNING_ACTIVE);
+
connman_device_ref(device);
reset_autoscan(device);
--
1.9.1
3 years, 1 month
Re: [PATCH 1/2] wifi: Fix behaviour when Background scanning is disabled
by Jonah Petri
On Oct 16, 2017, at 2:11 PM, Jose Blanquicet <jose(a)blanquicet.com> wrote:
>
> Hi Daniel,
>
> On Sun, Oct 15, 2017 at 10:36 PM, Daniel Wagner <wagi(a)monom.org> wrote:
>> Do we have any updates on this series? Ready to apply?
>
> I am waiting feedback from Jonah, I want to be sure this patch passes
> his session test. In addition, could you please start using this patch
> to ensure it is not introducing regressions/issues to the default
> behaviour? I am doing so too.
>
> Thanks,
>
> Jose Blanquicet
>
Hi Jose,
My fleet is tied up in other testing at the moment, so it may be another week or two before I can try this patch. Sorry for the delay! I will understand if you decide to press on without my data, and I'll still give a report when I can try it out.
Jonah
3 years, 1 month
X-ConnMan-Status of online check server
by Masashi Honma
Currently ConnMan checks X-ConnMan-Status in HTTP header of online check server.
This looks ConnMan only specification.
Indeed, iOS and Android checks only "Success" or "Fail" string in HTTP body.
Is there any reason to use the HTTP header ?
Regards,
Masashi Honma.
3 years, 2 months
[RFC v0] timeserver: Retry NTP servers periodically on startup
by Daniel Wagner
When ConnMan starts up and we haven't connected to a timeserver, the
current algorithm will try all server once in the timer server list
and then stops. There is a recheck interval (7200 seconds) but that is
far too long if we no server has been selected so far. So we don't
find any server at startup we just retry in 5 seconds again.
The current code uses __timeserver_sync_next() to start the connection
attempt and also to select next server in the list when something goes
wrong. Therefore, __timeserver_sync_next() is called from ntp.c and
timeserver.c. Instead handing in the reason why
__timeserver_sync_next() is called we rather just add a new function
for starting the work timeserver_sync_start(). So we know, whenever
__timeserver_sync_next() something was amiss. When the timeserver list
is empty we program a timeout to which calls timeserver_sync_start().
The back off timeout is set hard to 5 seconds which could made into an
exponential value, though for a starting point let's try if this cures
the problem reported with Raspberry Pi boards which lacks a battery
buffered RTC.
Fixes CM-636
---
Hi,
This patch is tested only lightly. Propably there are still some
problems. So Kodi users with a Rasperry Pi and crapy router or uplink,
please give it a try if you can :)
Thanks,
Daniel
src/timeserver.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 73 insertions(+), 13 deletions(-)
diff --git a/src/timeserver.c b/src/timeserver.c
index 0e555a73c3bf..fa878949dfba 100644
--- a/src/timeserver.c
+++ b/src/timeserver.c
@@ -34,9 +34,11 @@
#define TS_RECHECK_INTERVAL 7200
+static GSList *timeservers_list = NULL;
static GSList *ts_list = NULL;
static char *ts_current = NULL;
static int ts_recheck_id = 0;
+static int ts_backoff_id = 0;
static GResolv *resolv = NULL;
static int resolv_id = 0;
@@ -114,13 +116,59 @@ static void resolv_result(GResolvResultStatus status, char **results,
}
/*
- * Once the timeserver list (ts_list) is created, we start querying the
- * servers one by one. If resolving fails on one of them, we move to the
- * next one. The user can enter either an IP address or a URL for the
- * timeserver. We only resolve the URLs. Once we have an IP for the NTP
- * server, we start querying it for time corrections.
+ * Once the timeserver list (timeserver_list) is created, we start
+ * querying the servers one by one. If resolving fails on one of them,
+ * we move to the next one. The user can enter either an IP address or
+ * a URL for the timeserver. We only resolve the URLs. Once we have an
+ * IP for the NTP server, we start querying it for time corrections.
*/
-void __connman_timeserver_sync_next()
+static void timeserver_sync_start(void)
+{
+ GSList *list;
+
+ for (list = timeservers_list; list; list = list->next) {
+ char *timeserver = list->data;
+
+ ts_list = g_slist_prepend(ts_list, g_strdup(timeserver));
+ }
+ ts_list = g_slist_reverse(ts_list);
+
+ ts_current = ts_list->data;
+
+ ts_list = g_slist_delete_link(ts_list, ts_list);
+
+ /* if it's an IP, directly query it. */
+ if (connman_inet_check_ipaddress(ts_current) > 0) {
+ DBG("Using timeserver %s", ts_current);
+
+ __connman_ntp_start(ts_current);
+
+ return;
+ }
+
+ DBG("Resolving timeserver %s", ts_current);
+
+ resolv_id = g_resolv_lookup_hostname(resolv, ts_current,
+ resolv_result, NULL);
+
+ return;
+}
+
+static gboolean timeserver_sync_restart(gpointer user_data)
+{
+ timeserver_sync_start();
+ ts_backoff_id = 0;
+
+ return FALSE;
+}
+
+/*
+ * Select the next time server from the working list (ts_list) because
+ * for some reason the first time server in the list didn't work. If
+ * none of the server did work we start over with the first server
+ * with a backoff.
+ */
+void __connman_timeserver_sync_next(void)
{
if (ts_current) {
g_free(ts_current);
@@ -130,8 +178,13 @@ void __connman_timeserver_sync_next()
__connman_ntp_stop();
/* Get the 1st server in the list */
- if (!ts_list)
+ if (!ts_list) {
+ DBG("No timeserver could be used, restart probing in 5 seconds");
+
+ ts_backoff_id = g_timeout_add_seconds(5,
+ timeserver_sync_restart, NULL);
return;
+ }
ts_current = ts_list->data;
@@ -269,6 +322,11 @@ static void ts_recheck_disable(void)
g_source_remove(ts_recheck_id);
ts_recheck_id = 0;
+ if (ts_backoff_id) {
+ g_source_remove(ts_backoff_id);
+ ts_backoff_id = 0;
+ }
+
if (ts_current) {
g_free(ts_current);
ts_current = NULL;
@@ -327,20 +385,20 @@ int __connman_timeserver_sync(struct connman_service *default_service)
g_strfreev(nameservers);
- g_slist_free_full(ts_list, g_free);
+ g_slist_free_full(timeservers_list, g_free);
- ts_list = __connman_timeserver_get_all(service);
+ timeservers_list = __connman_timeserver_get_all(service);
- __connman_service_timeserver_changed(service, ts_list);
+ __connman_service_timeserver_changed(service, timeservers_list);
- if (!ts_list) {
+ if (!timeservers_list) {
DBG("No timeservers set.");
return 0;
}
ts_recheck_enable();
- __connman_timeserver_sync_next();
+ timeserver_sync_start();
return 0;
}
@@ -396,8 +454,10 @@ static void timeserver_stop(void)
resolv = NULL;
}
- g_slist_free_full(ts_list, g_free);
+ g_slist_free_full(timeservers_list, g_free);
+ timeservers_list = NULL;
+ g_slist_free_full(ts_list, g_free);
ts_list = NULL;
__connman_ntp_stop();
--
2.9.5
3 years, 2 months
Autoconnect feature for cellular network
by Eswaran Vinothkumar (BEG/PJ-IOT-EL)
Hi,
I am using Connman and oFono to establish the internet connection.
Versions used: Connman:1.35
oFono:1.21
Modem device: Sierra MC7455
To establish the internet connection at system startup, I am running a shell script which calls the scripts within the test directory of /ofono
./enable-modem
./online-modem
./register-auto
./create-internet-context web.vodafone.de vodafone vodafone
./activate-context
./process-context-settings.
With this setting, I could connect to the internet. I have a check before running each scripts whether the previous step is successful or not.
I have some questions regarding the autoconnect feature of Connman. I looked into the source file of ofono plugin. If I understood correctly, connman tries to activate the context if the modem is in online state, registered to the network and GPRS is attached. I am running the script I had mentioned above everytime on boot up, is it really required when autoconnect feature is enabled in Connman?
I enabled the debug logs of connman and I could see that connman tries to connect to cellular network when it gets the notification from ofono regarding the GPRS activation. This initially looked like I still need to activate the modem by running the scripts:
./enable-modem
./online-modem
./register-auto
If I enable the cellular technology 'connmanctl enable cellular', connman takes care of this setting also. Is this correct?
May I know is there any issue in running the script at start up though Connman does exactly the same. Looks like reduntant but I have seen some issues with network registration of my modem, it takes a few minutes before my modem gets connected to network. Is there any timeout implemented in connman, after which it stops trying to autoconnect?
Also during system reboot, I see following error messages from connman while connecting to internet:
connmand[181]: ../connman-1.35/plugins/ofono.c:set_property_reply() /sierra_0 path /sierra_0/context1 org.ofono.ConnectionContext.Active
connmand[181]: Failed to change property: /sierra_0/context1 org.ofono.ConnectionContext.Active: org.ofono.Error.InProgress Operation already in progress
This happens randomly not all the time. ofono fails to activate the internet context and connman tries to activate it again. This loops around and after sometime the device fails to connect to the internet. Is there any way to restart the autoconnect after sometime if connection failed?
Thanks & Regards,
vinothkumar
3 years, 2 months
Using a different path to store connman settings
by Eswaran Vinothkumar (BEG/PJ-IOT-EL)
Hello,
I need some information regarding the path in which Connman saves the information. Connman saves the settings of each network under /var/lib/connman.
We are planning to use Over the air software update for our product. Since this information are stored under /var/lib/ directories, these informations are lost after the software update. Is it possible to change this directory in Connman to some other location. We have a data partition which is not modified during the software update. It would be helpful, if we store the connman and ofono related information in this partition.
Any information on this topic would be useful.
I am currently using Connman version 1.35 and oFone 1.21. Linux kernel:4.9
Mit freundlichen Grüßen / Best regards
Vinothkumar Eswaran
BEG-PT/PJ-IOT1
3 years, 2 months