[PATCH] Force BSS expiration
by Yasser
We were having a problem with our wifi scanning, where the list of
wifi available would become empty and would not be repopulated until
after a long delay. Researching the problem it seemed that it was
related to BSS expiration age. There were already some people who had
faced the same issue, so inspired by this we developed the following
patch which allows us to set the BSS expiration age to match ConnMan
long scanning interval to avoid the loss of networks during a long
interval between two scans.
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index bfb52db..08d6b9e 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -267,7 +267,8 @@ int
g_supplicant_interface_connect(GSupplicantInterface *interface,
int g_supplicant_interface_disconnect(GSupplicantInterface *interface,
GSupplicantInterfaceCallback callback,
void *user_data);
-
+int g_supplicant_interface_set_bss_expiration_age(GSupplicantInterface
*interface,
+ unsigned int
bss_expiration_age);
int g_supplicant_interface_set_apscan(GSupplicantInterface *interface,
unsigned int ap_scan);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 6052f7b..fe6ad48 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -981,6 +981,46 @@ static void interface_capability(const char *key,
DBusMessageIter *iter,
key, dbus_message_iter_get_arg_type(iter));
}
+struct g_supplicant_bss_expiration_age
+{
+ GSupplicantInterface *interface;
+ unsigned int bss_expiration_age;
+};
+
+static void set_bss_expiration_age(DBusMessageIter *iter, void *user_data)
+{
+ struct g_supplicant_bss_expiration_age *data = user_data;
+ unsigned int bss_expiration_age = data->bss_expiration_age;
+
+ dbus_free(data);
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32,
&bss_expiration_age);
+}
+
+int g_supplicant_interface_set_bss_expiration_age(GSupplicantInterface
*interface,
+ unsigned int
bss_expiration_age)
+{
+ struct g_supplicant_bss_expiration_age *data;
+ int ret;
+
+ data = dbus_malloc0(sizeof(*data));
+
+ if (!data)
+ return -ENOMEM;
+
+ data->bss_expiration_age = bss_expiration_age;
+ data->interface = interface;
+
+ ret = supplicant_dbus_property_set(interface->path,
+ SUPPLICANT_INTERFACE ".Interface",
+ "BSSExpireAge", DBUS_TYPE_UINT32_AS_STRING,
+ set_bss_expiration_age, NULL, data, NULL);
+ if (ret < 0)
+ dbus_free(data);
+
+ return ret;
+}
+
+
struct set_apscan_data
{
unsigned int ap_scan;
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 910b739..57b63e2 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1522,6 +1522,7 @@ static void interface_create_callback(int result,
void *user_data)
{
struct wifi_data *wifi = user_data;
+ char * bgscan_range_max;
DBG("result %d ifname %s, wifi %p", result,
g_supplicant_interface_get_ifname(interface),
@@ -1537,6 +1538,13 @@ static void interface_create_callback(int result,
wifi->interface_ready = true;
finalize_interface_creation(wifi);
}
+ /* Force the BSS expiration age to match ConnMan long scanning
interval to avoid the loss of networks during a long interval between
two scannings. */
+ if ((bgscan_range_max = strrchr(BGSCAN_DEFAULT,':')) != NULL &&
+
g_supplicant_interface_set_bss_expiration_age(interface,
strtol(bgscan_range_max + 1, (char**)NULL, 10) + 10) >= 0) {
+ DBG("bss expiration age successfully updated");
+ } else {
+ DBG("bss expiration age update has failed");
+ }
}
static int wifi_enable(struct connman_device *device)
3 months, 3 weeks
Why can't connman automatically enable and connect to cellular network interface?
by JH
Hi,
I installed oFono plugin to an embedded system where the cellular is
used, I suppose that the connman should automatically enable and
connect to cellular when it first time boot up, it didn't, I have to
manually run the connmanctl command to enable and to connect it. In a
product due to limited Flash storage size, I'll not install connmanctl
and there will be no manual interactive process, how can I set up
connman to automatically enable and connect to cellular network
interface?
Thank you.
Kind regards,
- jupiter
1 year, 3 months
Race condition on too fast stop&&start resulting in Error /net/connman/technology/wifi: Not supported that does not recovery without another restart
by KARBOWSKI Piotr
Hi,
I am facing issue with connman-1.37 regarding the wireless network
access. If I restart connman that was already running, I will get not
working wireless connection
# connmanctl scan wifi
Error /net/connman/technology/wifi: Not supported
I can reproduce it on two separated Gentoo ~amd64 systems. One has Intel
9462 and the other with Intel 8265. The wireless connection never
recovery unless I restart connman one more time.
If I not use restart, but stop && start with sleep 3 in between for
example, everything works.
It looks to me like a race condition with whatever connman does to
iwlwifi device upon stopping, that is still 'on going' after connmand
exited, and when new one starts, it lacks code to retry bringing device
up after a delay when it fails for the first time, unless it silently
fails inside, somewhere.
Steps to reproduce:
While connman is running, run /etc/init.d/connman stop &&
/etc/init.d/connman start
The `connmanctl scan wifi` will not work regardless of how long one will
wait. The init script is the most basic one, all it does is
starts/terminates /usr/sbin/connmand.
Steps to reproduce with a workaround:
While connman is running, run /etc/init.d/connman stop && sleep 3 &&
/etc/init.d/connman start
The `connmanctl scan wifi` will work after a few seconds.
-- Piotr.
1 year, 7 months
dnsproxy: invalid answer where there are no DNS servers available
by Nuno Gonçalves
Hi,
Typing "ping abcd", where abcd does not exist on /etc/hosts or in the
search domains, will usually hang for a while with Connman.
I've compared with other systems and my conclusion is that libnss_dns
is retrying the DNS request to connman, since connman answer does not
include the query field.
This behaviour comes from [1], where both a invalid Query and no
upstream servers are handled in the same way.
I believe the query field must be part of the answer when the Query
message was valid, but just happens to not be possible to resolve.
Thanks,
Nuno
[1] https://git.kernel.org/pub/scm/network/connman/connman.git/tree/src/dnspr...
1 year, 8 months
Connman - handle multiple wifi interfaces
by Rahul Jain
Dear Connman,
I have a query.
Can Connman handle multiple wifi interfaces: like wlan0, wlan1 & wlan2 and
all are powered on?
If as per current architecture it is not possible, can you provide any
suggestions on how to handle it? Can we duplicate wifi plugin and
gsupplicant interface to handle both interface together.?
Please provide suggestions.
-Thank you
RJ
1 year, 9 months
[PATCH] gweb: fix segfault with musl v1.1.21
by Nicola Lunghi
In musl > 1.1.21 freeaddrinfo() implementation changed and
was causing a segmentation fault on recent Yocto using musl.
See this commit:
https://git.musl-libc.org/cgit/musl/commit/src/network/freeaddrinfo.c?id=...
---
gweb/gweb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gweb/gweb.c b/gweb/gweb.c
index 393afe0a..12fcb1d8 100644
--- a/gweb/gweb.c
+++ b/gweb/gweb.c
@@ -1274,7 +1274,8 @@ static bool is_ip_address(const char *host)
addr = NULL;
result = getaddrinfo(host, NULL, &hints, &addr);
- freeaddrinfo(addr);
+ if(!result)
+ freeaddrinfo(addr);
return result == 0;
}
--
2.19.1
1 year, 9 months
[PATCH 00/10] Improve handling of VPN agent return types
by Jussi Laakkonen
The different returns from VPN agent should be handled accordingly in VPN
plugins as well as in connmand. Otherwise there will be a race between each
VPN agent supporting VPN type as canceling or timeouting the VPN agent dialog
would not unset the autoconnect value (to false) and change is not propagated to
service file written to disk. This will manifest itself after the next restart
of connmand as continuous connect-disconnect-connect loop between the VPNs that
were attempted to connect but their VPN agent dialog was canceled.
This set of patches enables processing of the different VPN agent return types
and ensures that autoconnect value changes are done internally and written to
disk. Improved processing of VPN agent return is used in the VPN plugins that
utilize it (L2TP, OpenConnect, PPTP and VPNC, OpenVPN is excluded) and a proper
reply is sent back to caller.
Each aforementioned plugin should not have own implementation of error checking
and thus, a generic one is implemented in vpn-agent.c. Processing of the error
is done using the callback of the VPN plugin, which eventually is
vpn-provider.c:connect_cb() that is also amended to support the different error
types. If there is no error returned from VPN agent normal operation is resumed.
The returned error is then passed to caller as appropriate D-Bus error message.
The caller (plugins/vpn.c) should be able to disable VPN autoconnect if the user
has cancelled the VPN agent dialog. For this the new error type
OperationCanceled (ECANCELED) is implemented and setters for autoconnect value
are created into provider.c and service.c.
Jussi Laakkonen (10):
vpn-agent: Implement generic D-Bus error checker for plugins.
vpn-provider: React to different error types in connect_cb()
l2tp: Use vpn-agent.c error processing for VPN agent errors.
openconnect: Use vpn-agent.c error processing for VPN agent errors.
pptp: Use vpn-agent.c error processing for VPN agent errors.
vpnc: Use vpn-agent.c error processing for VPN agent errors.
service: Implement function to set service autoconnect value
provider: Implement function to set VPN service autoconnect value
error: Implement OperationCanceled error type
vpn: Handle OperationCanceled D-Bus message reply
include/provider.h | 2 ++
include/service.h | 2 ++
plugins/vpn.c | 14 +++++++++++-
src/connman.h | 1 +
src/error.c | 8 +++++++
src/provider.c | 11 +++++++++
src/service.c | 12 ++++++++++
vpn/plugins/l2tp.c | 18 ++++++++++++---
vpn/plugins/openconnect.c | 11 +++++++--
vpn/plugins/pptp.c | 18 ++++++++++++---
vpn/plugins/vpnc.c | 40 +++++++-------------------------
vpn/vpn-agent.c | 48 +++++++++++++++++++++++++++++++++++++++
vpn/vpn-agent.h | 4 ++++
vpn/vpn-provider.c | 46 +++++++++++++++++++++++++++++++++++--
14 files changed, 192 insertions(+), 43 deletions(-)
--
2.20.1
1 year, 9 months
Failing to connect to service with manual provisioning
by Jason Tribe
Hi,
We are using the manual method of connecting to a service, where we write
the service config file to /var/lib/connman and then call the connect
function on that services interface without using the agent API.
The problem we are having is that this method results in a "Not registered"
error message in most cases. The only way we can get this to work correctly
is to disable and then enable the WiFi technology after writing the config
file and before calling the connect function on that service.
Has anyone had a similar issue or is there a better solution to connect to
a service without using the agent API.
Kind regards
Jason Tribe
1 year, 9 months
Failure state reset after wifi authentication denied
by Damien Miliche
Hi,
I've encountered a situation where an wifi Access Point denies the
authentication of my client ("denied authentication (status 17)").
Connman considers that as a failure, and the service I was trying to
connect enters the 'failure' state, with error 'connect-failed'.
From then, after only one attempt, despite the background scanning,
connman never tries to reconnect automatically, even if the service is
configured as 'AutoConnect' and the corresponding SSID appears in the
scan results: it looks like it is ignored.
Is that normal behaviour?
Is there a way for connman to consider the failed service in subsequent
automatic scan results (exponential bg scan) to retry connecting?
The only way I found so far is to manually trigger a connection, but
that is not acceptable for unattended device... :s
Thanks in advance for your help.
Kind regards,
--
Damien
1 year, 9 months
Changing vpn property through DBUS
by Salman Ahmed
Previous mail didn't appear as post.
Hello,
I am trying to change the properties of a vpn conection under connman
(through DBUS) but I am running into an error
e.g) This call succeeds and I am presented with the properties of the vpn
connection
dbus-send --system --dest=net.connman.vpn --type=method_call --print-reply
/net/connman/vpn/connection/uk_london_privateinternetaccess_com_privateinternetaccess_com
net.connman.vpn.Connection.GetProperties
Using d-feet I see that the SetProperty is defined as SetProperty (String
name, Variant value)->()
But if I do SetProperty like this
dbus-send --system --dest=net.connman.vpn --type=method_call --print-reply
/net/connman/vpn/connection/uk_london_privateinternetaccess_com_privateinternetaccess_com
net.connman.vpn.Connection.SetProperty string:Name variant:string:"NewName"
I get error > Error net.connman.Error.NotSupported: Not supported
I also tried it with the python test
./vpn-property
uk_london_privateinternetaccess_com_privateinternetaccess_com Name NewName
net.connman.Error.NotSupported: Not supported
1 year, 10 months