[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)
1 month
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
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, 6 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, 6 months
[PATCH] network: Fix disconnect_callback crash on error
by Yasser
We had a crash in connman_network_set_connected() when
disconnect_callback() was called but the value of wifi->network was
not checked. This has already been fixed for wifi.c. However
connman_network_set_connected() is called by other components where
the network parameter is not checked beforehand so we thought it might
be a good idea to verify in the function itself.
diff --git a/src/network.c b/src/network.c
index 56fe24f..0486fad 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1675,6 +1675,9 @@ void connman_network_set_error(struct
connman_network *network,
int connman_network_set_connected(struct connman_network *network,
bool connected)
{
+ if (!network)
+ return 0;
+
DBG("network %p connected %d/%d connecting %d associating %d",
network, network->connected, connected, network->connecting,
network->associating);
1 year, 7 months
[PATCH 0/6] VPN provider fixes and VPNC VPN agent support
by Jussi Laakkonen
This set of patches improves and fixes some issues with vpn-provider.c
and implements VPN agent support for VPNC.
vpn-provider.c changes:
* Support plugin specific data in provider. Plugins may set pointer to
data for latter use, e.g., in case notify needs additional data.
* Support retrieval of setting string immutable status. The main
values within provider have the same status as the provider as other
strings have individual statuses. Some VPN plugins need to
temporarily cache credentials, but immutable ones should not be
cleared.
* Allow only DBUS_TYPE_STRING values in set_property()
VPNC changes:
* Support VPN agent for setting authentication credentials. VPNC now
is able to retrieve credentials using agent, if any, and clears them
after writing the credentials to VPNC process, so VPN agent is used
also with next connect attempt and credentials are not stored in
provider.
* Detect authentication and connection errors which VPNC outputs to
stderr. If these are detected provider is notified with appropriate
error code.
* Check the D-Bus message arg types in notify. With invalid types
crash would be expected.
Jussi Laakkonen (6):
vpn-provider: Add support for plugin specific data
vpn-provider: Check D-Bus message arg type in set_property()
vpn-provider: Add function to get immutable state of provider string
vpnc: Check for D-Bus arg types in notify
vpnc: Implement VPN agent support
vpnc: Detect authentication and connection errors
vpn/plugins/vpnc.c | 531 ++++++++++++++++++++++++++++++++++++++++++---
vpn/vpn-provider.c | 40 ++++
vpn/vpn-provider.h | 4 +
3 files changed, 545 insertions(+), 30 deletions(-)
--
2.20.1
1 year, 7 months
connman installs duplicate routes?
by David Weidenkopf
Hi, I am using connman 1.35. If I enable both a ethernet and wifi service, the default route is selected as you would expect. However, multiple routes will be created for the LAN.
~# ip route show
default via 192.168.16.1 dev eth0
1.0.0.1 via 192.168.16.1 dev eth0
1.0.0.1 via 192.168.16.1 dev wifi0
1.1.1.1 via 192.168.16.1 dev eth0
1.1.1.1 via 192.168.16.1 dev wifi0
192.168.16.0/24 dev wifi0 proto kernel scope link src 192.168.16.40
192.168.16.0/24 dev eth0 proto kernel scope link src 192.168.16.29
192.168.16.1 dev eth0 scope link
192.168.16.1 dev wifi0 scope link
This output is after ethernet has been disconnected and been reconnected. The default route is eth0 as expected. However, there are two LAN routes with the wifi0 route being first and being selected. It seems that connman should either remove the wifi0 route or set a metric on it.
The impact is that LAN traffic is sent over wifi0 instead of eth0. Using
SingleConnectedTechnology=true
in the configuration works around this but seems to be a discouraged setting. Also, it means that wifi is not connected when ethernet is.
What is the best way to configure/use connman when ethernet and wifi are present?
Is this a defect?
Regards
David
This e-mail and any files transmitted with it are the property of Arthrex, Inc. and/or its affiliates, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender at 239-643-5553 and delete this message immediately from your computer. Any other use, retention, dissemination forwarding, printing or copying of this e-mail is strictly prohibited. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, while Arthrex uses virus protection, 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.
1 year, 7 months
[PATCH] timezone : Fix timezone without subpath
by Yasser
A small patch to fix the handling of timezones with and without subpath.
diff --git a/src/timezone.c b/src/timezone.c
index 8e91267..0538191 100644
--- a/src/timezone.c
+++ b/src/timezone.c
@@ -187,7 +187,11 @@ static char *find_origin(void *src_map, struct
stat *src_st,
subpath, d->d_name);
if (compare_file(src_map, src_st, pathname) == 0) {
- str = g_strdup_printf("%s/%s",
+ if (!subpath)
+ str = g_strdup_printf("%s",
+ d->d_name);
+ else
+ str = g_strdup_printf("%s/%s",
subpath, d->d_name);
closedir(dir);
return str;
1 year, 7 months
Possibility to view/change (edit) wireless network properties (e.g. passphrase)
by tormen@mail.ch
Hi,
I wanted to kindly ask you if you could shed some light on this:
https://github.com/andrew-bibb/cmst/issues/202
Because I am lost and I don't get it :(
There should be a way that a wireless profile connman uses can be
viewed or edited through a GUI, or not?
This is really useful e.g. to check "auto-connect" (potentially toggle
that off if you forgot to do that when creating the wireless profile).
The wireless password is something to be discussed. Ideally I as
connman user could choose to expose the passwords (e.g. shared key wpa2)
through it's API as well so that a tool like cmst can show me
the current setting (including passwords) used by connman.
I am still new to connman. I know that you can use it with iwd and
wpa_supplicant. But ideally I would expect that connman uses a wireless
configuration that is agonostic to the actual tool used to do the
wireless setup. Is that the case?
And if yes, then what do you think:
(a) Should there be a possibility for cmst to view and/or edit this
wireless profile?
(b) Does connman already offer interfaces (APIs?) for cmst to do so?
And if yes, which ones?
Really thanks a lot in advance!!
Tormen
1 year, 7 months
[PATCH] wispr: Prevent a crash when freeing wispr routes
by Yasser
I have had the connman crash when free_wispr_routes() is called. It happens
when there are lots of wireless networks around but none with good signal
strength.
As a fix, I use g_slist_nth_data() to get the wispr_route and check it
before using it.
diff --git a/src/wispr.c b/src/wispr.c
index 0ab041e..546660a 100644
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -128,28 +128,30 @@ static void connman_wispr_message_init(struct
connman_wispr_message *msg)
static void free_wispr_routes(struct connman_wispr_portal_context
*wp_context)
{
while (wp_context->route_list) {
- struct wispr_route *route = wp_context->route_list->data;
-
- DBG("free route to %s if %d type %d", route->address,
- route->if_index, wp_context->type);
+ struct wispr_route *route =
g_slist_nth_data(wp_context->route_list, 0);
+
+ if (route) {
+ DBG("free route to %s if %d type %d", route->address,
+ route->if_index, wp_context->type);
+
+ switch (wp_context->type) {
+ case CONNMAN_IPCONFIG_TYPE_IPV4:
+ connman_inet_del_host_route(route->if_index,
+ route->address);
+ break;
+ case CONNMAN_IPCONFIG_TYPE_IPV6:
+ connman_inet_del_ipv6_host_route(route->if_index,
+ route->address);
+ break;
+ case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
+ case CONNMAN_IPCONFIG_TYPE_ALL:
+ break;
+ }
- switch (wp_context->type) {
- case CONNMAN_IPCONFIG_TYPE_IPV4:
- connman_inet_del_host_route(route->if_index,
- route->address);
- break;
- case CONNMAN_IPCONFIG_TYPE_IPV6:
- connman_inet_del_ipv6_host_route(route->if_index,
- route->address);
- break;
- case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
- case CONNMAN_IPCONFIG_TYPE_ALL:
- break;
+ g_free(route->address);
+ g_free(route);
}
- g_free(route->address);
- g_free(route);
-
wp_context->route_list =
g_slist_delete_link(wp_context->route_list,
wp_context->route_list);
1 year, 7 months