[PATCH 1/2] auto-t: wait for mode change to finish on stop_ap
by James Prestwood
---
autotests/util/iwd.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 9bfc8c1a..c65dd4a2 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -481,7 +481,10 @@ class Device(IWDDBusAbstract):
self._wait_for_async_op()
def stop_ap(self):
- self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')
+ self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station',
+ reply_handler=self._success,
+ error_handler=self._failure)
+ self._wait_for_async_op()
def connect_hidden_network(self, name):
'''Connect to a hidden network
--
2.26.2
1 year, 8 months
[PATCH v4 1/3] ap: add support for DHCPv4 server
by James Prestwood
The DHCP server can be enabled by enabling network configuration
with [General].EnableNetworkConfiguration. For now, the default
DHCP settings will be used. If no address is set on the interface
a default IP and broadcast address will be used.
---
src/ap.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 113 insertions(+), 7 deletions(-)
diff --git a/src/ap.c b/src/ap.c
index 3c4ae907..866cbe58 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <linux/if_ether.h>
+#include <netinet/in.h>
#include <ell/ell.h>
@@ -74,6 +75,9 @@ struct ap_state {
uint16_t last_aid;
struct l_queue *sta_states;
+ struct l_dhcp_server *server;
+ uint32_t rtnl_add_cmd;
+
bool started : 1;
bool gtk_set : 1;
};
@@ -105,6 +109,7 @@ struct ap_wsc_pbc_probe_record {
};
static uint32_t netdev_watch;
+struct l_netlink *rtnl;
void ap_config_free(struct ap_config *config)
{
@@ -181,6 +186,9 @@ static void ap_reset(struct ap_state *ap)
if (ap->start_stop_cmd_id)
l_genl_family_cancel(ap->nl80211, ap->start_stop_cmd_id);
+ if (ap->rtnl_add_cmd)
+ l_netlink_cancel(rtnl, ap->rtnl_add_cmd);
+
l_queue_destroy(ap->sta_states, ap_sta_free);
if (ap->rates)
@@ -192,6 +200,9 @@ static void ap_reset(struct ap_state *ap)
l_queue_destroy(ap->wsc_pbc_probes, l_free);
ap->started = false;
+
+ if (ap->server)
+ l_dhcp_server_stop(ap->server);
}
static void ap_del_station(struct sta_state *sta, uint16_t reason,
@@ -1900,25 +1911,116 @@ static void ap_deauth_cb(const struct mmpdu_header *hdr, const void *body,
ap_sta_free(sta);
}
+static void do_debug(const char *str, void *user_data)
+{
+ const char *prefix = user_data;
+
+ l_info("%s%s", prefix, str);
+}
+
+static void ap_start_failed(struct ap_state *ap)
+{
+ ap->ops->handle_event(AP_EVENT_START_FAILED, NULL, ap->user_data);
+ ap_reset(ap);
+ l_genl_family_free(ap->nl80211);
+ l_free(ap);
+}
+
+static void ap_finish_setup(struct ap_state *ap, bool dhcp)
+{
+ if (dhcp && !l_dhcp_server_start(ap->server)) {
+ l_error("DHCP server failed to start");
+
+ ap_start_failed(ap);
+ return;
+ }
+
+ ap->started = true;
+ ap->ops->handle_event(AP_EVENT_STARTED, NULL, ap->user_data);
+}
+
+static void ap_ifaddr4_added_cb(int error, uint16_t type, const void *data,
+ uint32_t len, void *user_data)
+{
+ struct ap_state *ap = user_data;
+
+ if (error) {
+ l_error("Failed to set IP address");
+ ap_start_failed(ap);
+ return;
+ }
+
+ ap_finish_setup(ap, true);
+}
+
static void ap_start_cb(struct l_genl_msg *msg, void *user_data)
{
struct ap_state *ap = user_data;
+ uint32_t ifindex = netdev_get_ifindex(ap->netdev);
+ const struct l_settings *settings = iwd_get_config();
+ bool enabled = false;
+ struct in_addr ia;
ap->start_stop_cmd_id = 0;
if (l_genl_msg_get_error(msg) < 0) {
l_error("START_AP failed: %i", l_genl_msg_get_error(msg));
- ap->ops->handle_event(AP_EVENT_START_FAILED, NULL,
- ap->user_data);
- ap_reset(ap);
- l_genl_family_free(ap->nl80211);
- l_free(ap);
+ goto failed;
+ }
+
+ /*
+ * Reusing [General].EnableNetworkConfiguration as a switch to enable
+ * DHCP server. If no value is found or it is false do not create a
+ * DHCP server.
+ */
+ if (!l_settings_get_bool(settings, "General",
+ "EnableNetworkConfiguration", &enabled))
+ goto done;
+
+ if (!enabled)
+ goto done;
+
+ ap->server = l_dhcp_server_new(ifindex);
+ if (!ap->server) {
+ l_error("Failed to create DHCP server on %u", ifindex);
+ goto failed;
+ }
+
+ if (getenv("IWD_DHCP_DEBUG"))
+ l_dhcp_server_set_debug(ap->server, do_debug,
+ "[DHCPv4 SERV] ", NULL);
+
+ if (!l_net_get_address(ifindex, &ia) || ia.s_addr == 0) {
+ ap->rtnl_add_cmd = l_rtnl_ifaddr4_add(rtnl, ifindex, 24,
+ "192.168.1.1", "255.255.255.0",
+ ap_ifaddr4_added_cb, ap, NULL);
+
+ if (!ap->rtnl_add_cmd) {
+ l_error("Failed to add IPv4 address");
+ goto failed;
+ }
+
+ /* Finish starting AP in added callback */
return;
}
- ap->started = true;
- ap->ops->handle_event(AP_EVENT_STARTED, NULL, ap->user_data);
+ /*
+ * TODO: Add support for provisioning files where user could configure
+ * specific DHCP sever settings.
+ */
+
+ if (!l_dhcp_server_start(ap->server)) {
+ l_error("DHCP server failed to start");
+ goto failed;
+ }
+
+done:
+ ap_finish_setup(ap, enabled);
+ return;
+
+failed:
+ ap_start_failed(ap);
}
static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap)
@@ -2255,6 +2357,8 @@ void ap_free(struct ap_state *ap)
{
ap_reset(ap);
l_genl_family_free(ap->nl80211);
+ if (ap->server)
+ l_dhcp_server_destroy(ap->server);
l_free(ap);
}
@@ -2535,6 +2639,8 @@ static int ap_init(void)
l_dbus_register_interface(dbus_get_bus(), IWD_AP_INTERFACE,
ap_setup_interface, ap_destroy_interface, false);
+ rtnl = iwd_get_rtnl();
+
return 0;
}
--
2.26.2
1 year, 8 months
[PATCH v3 1/2] ap: add support for DHCPv4 server
by James Prestwood
The DHCP server can be enabled by enabling network configuration
with [General].EnableNetworkConfiguration. For now, the default
DHCP settings will be used. If no address is set on the interface
a default IP and broadcast address will be used.
---
src/ap.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 113 insertions(+), 7 deletions(-)
v3:
* Added support to set a default IP/broadcast address if one isn't
already set on the interface.
diff --git a/src/ap.c b/src/ap.c
index 3c4ae907..866cbe58 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <linux/if_ether.h>
+#include <netinet/in.h>
#include <ell/ell.h>
@@ -74,6 +75,9 @@ struct ap_state {
uint16_t last_aid;
struct l_queue *sta_states;
+ struct l_dhcp_server *server;
+ uint32_t rtnl_add_cmd;
+
bool started : 1;
bool gtk_set : 1;
};
@@ -105,6 +109,7 @@ struct ap_wsc_pbc_probe_record {
};
static uint32_t netdev_watch;
+struct l_netlink *rtnl;
void ap_config_free(struct ap_config *config)
{
@@ -181,6 +186,9 @@ static void ap_reset(struct ap_state *ap)
if (ap->start_stop_cmd_id)
l_genl_family_cancel(ap->nl80211, ap->start_stop_cmd_id);
+ if (ap->rtnl_add_cmd)
+ l_netlink_cancel(rtnl, ap->rtnl_add_cmd);
+
l_queue_destroy(ap->sta_states, ap_sta_free);
if (ap->rates)
@@ -192,6 +200,9 @@ static void ap_reset(struct ap_state *ap)
l_queue_destroy(ap->wsc_pbc_probes, l_free);
ap->started = false;
+
+ if (ap->server)
+ l_dhcp_server_stop(ap->server);
}
static void ap_del_station(struct sta_state *sta, uint16_t reason,
@@ -1900,25 +1911,116 @@ static void ap_deauth_cb(const struct mmpdu_header *hdr, const void *body,
ap_sta_free(sta);
}
+static void do_debug(const char *str, void *user_data)
+{
+ const char *prefix = user_data;
+
+ l_info("%s%s", prefix, str);
+}
+
+static void ap_start_failed(struct ap_state *ap)
+{
+ ap->ops->handle_event(AP_EVENT_START_FAILED, NULL, ap->user_data);
+ ap_reset(ap);
+ l_genl_family_free(ap->nl80211);
+ l_free(ap);
+}
+
+static void ap_finish_setup(struct ap_state *ap, bool dhcp)
+{
+ if (dhcp && !l_dhcp_server_start(ap->server)) {
+ l_error("DHCP server failed to start");
+
+ ap_start_failed(ap);
+ return;
+ }
+
+ ap->started = true;
+ ap->ops->handle_event(AP_EVENT_STARTED, NULL, ap->user_data);
+}
+
+static void ap_ifaddr4_added_cb(int error, uint16_t type, const void *data,
+ uint32_t len, void *user_data)
+{
+ struct ap_state *ap = user_data;
+
+ if (error) {
+ l_error("Failed to set IP address");
+ ap_start_failed(ap);
+ return;
+ }
+
+ ap_finish_setup(ap, true);
+}
+
static void ap_start_cb(struct l_genl_msg *msg, void *user_data)
{
struct ap_state *ap = user_data;
+ uint32_t ifindex = netdev_get_ifindex(ap->netdev);
+ const struct l_settings *settings = iwd_get_config();
+ bool enabled = false;
+ struct in_addr ia;
ap->start_stop_cmd_id = 0;
if (l_genl_msg_get_error(msg) < 0) {
l_error("START_AP failed: %i", l_genl_msg_get_error(msg));
- ap->ops->handle_event(AP_EVENT_START_FAILED, NULL,
- ap->user_data);
- ap_reset(ap);
- l_genl_family_free(ap->nl80211);
- l_free(ap);
+ goto failed;
+ }
+
+ /*
+ * Reusing [General].EnableNetworkConfiguration as a switch to enable
+ * DHCP server. If no value is found or it is false do not create a
+ * DHCP server.
+ */
+ if (!l_settings_get_bool(settings, "General",
+ "EnableNetworkConfiguration", &enabled))
+ goto done;
+
+ if (!enabled)
+ goto done;
+
+ ap->server = l_dhcp_server_new(ifindex);
+ if (!ap->server) {
+ l_error("Failed to create DHCP server on %u", ifindex);
+ goto failed;
+ }
+
+ if (getenv("IWD_DHCP_DEBUG"))
+ l_dhcp_server_set_debug(ap->server, do_debug,
+ "[DHCPv4 SERV] ", NULL);
+
+ if (!l_net_get_address(ifindex, &ia) || ia.s_addr == 0) {
+ ap->rtnl_add_cmd = l_rtnl_ifaddr4_add(rtnl, ifindex, 24,
+ "192.168.1.1", "255.255.255.0",
+ ap_ifaddr4_added_cb, ap, NULL);
+
+ if (!ap->rtnl_add_cmd) {
+ l_error("Failed to add IPv4 address");
+ goto failed;
+ }
+
+ /* Finish starting AP in added callback */
return;
}
- ap->started = true;
- ap->ops->handle_event(AP_EVENT_STARTED, NULL, ap->user_data);
+ /*
+ * TODO: Add support for provisioning files where user could configure
+ * specific DHCP sever settings.
+ */
+
+ if (!l_dhcp_server_start(ap->server)) {
+ l_error("DHCP server failed to start");
+ goto failed;
+ }
+
+done:
+ ap_finish_setup(ap, enabled);
+ return;
+
+failed:
+ ap_start_failed(ap);
}
static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap)
@@ -2255,6 +2357,8 @@ void ap_free(struct ap_state *ap)
{
ap_reset(ap);
l_genl_family_free(ap->nl80211);
+ if (ap->server)
+ l_dhcp_server_destroy(ap->server);
l_free(ap);
}
@@ -2535,6 +2639,8 @@ static int ap_init(void)
l_dbus_register_interface(dbus_get_bus(), IWD_AP_INTERFACE,
ap_setup_interface, ap_destroy_interface, false);
+ rtnl = iwd_get_rtnl();
+
return 0;
}
--
2.26.2
1 year, 8 months
[PATCH v2 0/2] Add DHCP to AP
by James Prestwood
Removed all the provisioning file changes for now and left just the
minimum require for a DHCP server. All default values will be
chosen.
James Prestwood (2):
ap: add support for DHCPv4 server
auto-t: add AP test with DHCP server
autotests/testAP-DHCP/connection_test.py | 76 ++++++++++++++++++++++++
autotests/testAP-DHCP/failure_test.py | 57 ++++++++++++++++++
autotests/testAP-DHCP/hw.conf | 3 +
autotests/testAP-DHCP/main.conf | 5 ++
src/ap.c | 70 ++++++++++++++++++++--
5 files changed, 205 insertions(+), 6 deletions(-)
create mode 100644 autotests/testAP-DHCP/connection_test.py
create mode 100644 autotests/testAP-DHCP/failure_test.py
create mode 100644 autotests/testAP-DHCP/hw.conf
create mode 100644 autotests/testAP-DHCP/main.conf
--
2.26.2
1 year, 8 months
[PATCH 1/2] test-runner: enable valgrind track origins
by James Prestwood
This gives a more exact location to where a memory problem
is happening. It also uses more RAM so the VM was upgraded to
256MB from 192MB.
---
tools/test-runner | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/test-runner b/tools/test-runner
index 8c06816c..10db4c78 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -557,8 +557,8 @@ class TestContext:
iwd_radios = ','.join([r.name for r in self.radios if r.use == 'iwd'])
if self.args.valgrind:
- args.extend(['valgrind', '--leak-check=full', '--log-file=%s' % \
- '/tmp/valgrind.log'])
+ args.extend(['valgrind', '--leak-check=full', '--track-origins=yes',
+ '--log-file=/tmp/valgrind.log'])
args.extend(['iwd', '-p', iwd_radios])
@@ -1265,7 +1265,7 @@ class Main:
qemu_binary,
'-machine', 'type=q35,accel=kvm:tcg',
'-nodefaults', '-no-user-config', '-monitor', 'none',
- '-display', 'none', '-m', '192M', '-nographic', '-vga',
+ '-display', 'none', '-m', '256M', '-nographic', '-vga',
'none', '-no-acpi', '-no-hpet',
'-no-reboot', '-fsdev',
'local,id=fsdev-root,path=/,readonly,security_model=none,multidevs=remap',
--
2.26.2
1 year, 8 months
>=iwd-1.8: crash in dmesg at boot
by m1027@posteo.net
Hi,
I am forwarding the following issue from Gentoo linux to you here.
Please see: https://bugs.gentoo.org/746539
I hope this is the right place to continue with this issue.
This is the summary:
iwd-1.7 was not hit, but 1.8 and 1.9 have been hit by the issue.
The kernel has been bisected down to this commit:
https://git.kernel.org/pub/scm/network/wireless/iwd.git/commit/?id=b43e91...
However, it may not be the real cause, maybe only revealing the
issue. Still happening with linux 5.9.1.
In the testbed iwd gets started via systemd (at least here). Note:
Starting the service *after* the boot process manually does *not*
crash. So, currently everything works, as the service gets restarted
after the initial crash.
Last but not least, the output of dmesg:
[ 16.086329] ------------[ cut here ]------------
[ 16.086333] WARNING: CPU: 0 PID: 370 at net/wireless/nl80211.c:7284 nl80211_get_reg_do+0x1fc/0x230
[ 16.086334] CPU: 0 PID: 370 Comm: iwd Not tainted 5.8.13 #15
[ 16.086335] Hardware name: LENOVO 20KFCTO1WW/20KFCTO1WW, BIOS N20ET55W (1.40 ) 06/01/2020
[ 16.086336] RIP: 0010:nl80211_get_reg_do+0x1fc/0x230
[ 16.086338] Code: 00 00 00 48 89 ef e8 13 ff 85 ff 85 c0 0f 84 01 ff ff ff eb a6 48 89 ef 48 89 04 24 e8 4d ff e0 ff 48 8b 04 24 e9 43 ff ff ff <0f> 0b 48 89 ef e8 3a ff e0 ff b8 ea ff ff ff e9 2f ff ff ff e9 78
[ 16.086338] RSP: 0018:ffff9ab9c041bb98 EFLAGS: 00010202
[ 16.086339] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
[ 16.086340] RDX: ffff95472b7b0008 RSI: 0000000000000000 RDI: ffff95472b7b02e0
[ 16.086340] RBP: ffff9547264c1d00 R08: 0000000000000004 R09: ffff954728585014
[ 16.086340] R10: ffff954728581000 R11: 0000000000000001 R12: ffff9ab9c041bbf0
[ 16.086341] R13: 0000000000000000 R14: ffff954728585014 R15: ffff95472b7b02e0
[ 16.086341] FS: 00007f346c24e740(0000) GS:ffff95472e400000(0000) knlGS:0000000000000000
[ 16.086342] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 16.086342] CR2: 000055f2e8fc3010 CR3: 00000004222c2002 CR4: 00000000003606f0
[ 16.086343] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 16.086343] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 16.086344] Call Trace:
[ 16.086346] genl_rcv_msg+0x1ae/0x2f0
[ 16.086348] ? genl_family_rcv_msg_attrs_parse.isra.0+0xd0/0xd0
[ 16.086349] netlink_rcv_skb+0x46/0x110
[ 16.086350] genl_rcv+0x1f/0x30
[ 16.086351] netlink_unicast+0x197/0x230
[ 16.086352] netlink_sendmsg+0x1ed/0x400
[ 16.086353] __sys_sendto+0x1d3/0x1f0
[ 16.086355] __x64_sys_sendto+0x21/0x30
[ 16.086356] do_syscall_64+0x4d/0x1d0
[ 16.086358] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 16.086360] RIP: 0033:0x7f346c3d862c
[ 16.086361] Code: 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 21 45 31 c9 45 31 c0 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 6c e9 91 0c 04 00 0f 1f 80 00 00 00 00 55 48
[ 16.086361] RSP: 002b:00007fff38eb6978 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
[ 16.086362] RAX: ffffffffffffffda RBX: 000055f2e8faab00 RCX: 00007f346c3d862c
[ 16.086362] RDX: 000000000000001c RSI: 000055f2e8fc2ac0 RDI: 0000000000000004
[ 16.086363] RBP: 000055f2e8fc1910 R08: 0000000000000000 R09: 0000000000000000
[ 16.086363] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff38eb6a08
[ 16.086364] R13: 000055f2e8fb4910 R14: 000055f2e8fb4790 R15: 0000000000000000
[ 16.086364] ---[ end trace a7bf7b4f3a41fe0a ]---
Thanks!
1 year, 8 months
[PATCH 01/13] auto-t: no hostapd instance graceful failure
by James Prestwood
If a test does not need any hostapd instances but still loads
hostapd.py for some reason we want to gracefully throw an
exception rather than fail in some other manor.
---
autotests/util/hostapd.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/autotests/util/hostapd.py b/autotests/util/hostapd.py
index 7c0d8385..cf82c010 100644
--- a/autotests/util/hostapd.py
+++ b/autotests/util/hostapd.py
@@ -32,6 +32,10 @@ class HostapdCLI:
def _init_hostapd(self, config=None):
global ctrl_count
interface = None
+ self.ctrl_sock = None
+
+ if not ctx.hostapd:
+ raise Exception("No hostapd instances are configured")
if not config and len(ctx.hostapd.instances) > 1:
raise Exception('config must be provided if more than one hostapd instance exists')
@@ -110,6 +114,9 @@ class HostapdCLI:
raise Exception('timeout waiting for control response')
def _del_hostapd(self, force=False):
+ if not self.ctrl_sock:
+ return
+
self.ctrl_sock.close()
os.remove(self.local_ctrl)
--
2.26.2
1 year, 8 months
[PATCH 1/5] test-runner: Reserve radios for wpa_supplicant
by Andrew Zaborowski
Add support for a WPA_SUPPLICANT section in hw.conf where
'radN=<config_path>' lines will only reserve radios and create
interfaces for the autotest to be able to start wpa_supplicant on them,
i.e. this prevents iwd or hostapd from being started on them but doesn't
start a wpa_supplicant instance by itself.
---
tools/test-runner | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/tools/test-runner b/tools/test-runner
index 3b9c1854..dfad98f6 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -248,10 +248,11 @@ class Process:
raise Exception("Timed out waiting for socket")
class Interface:
- def __init__(self, name, config):
+ def __init__(self, name, config, radio):
self.name = name
self.ctrl_interface = '/var/run/hostapd/' + name
self.config = config
+ self.radio = radio
def __del__(self):
Process(['iw', 'dev', self.name, 'del'], True)
@@ -270,17 +271,15 @@ class Radio:
print("Removing radio %s" % self.name)
self.interface = None
- def create_interface(self, hapd):
+ def create_interface(self, config, use):
global intf_id
ifname = 'wln%s' % intf_id
intf_id += 1
- self.interface = Interface(ifname, hapd.config)
- # IWD does not use interfaces in test-runner so any created
- # interface is assumed to be used by hostapd.
- self.use = 'hostapd'
+ self.interface = Interface(ifname, config, self)
+ self.use = use
Process(['iw', 'phy', self.name, 'interface', 'add', ifname,
'type', 'managed'], True)
@@ -358,7 +357,7 @@ class HostapdInstance:
self.radio = radio
self.config = config
- self.intf = radio.create_interface(self)
+ self.intf = radio.create_interface(self.config, 'hostapd')
self.intf.set_interface_state('up')
def __del__(self):
@@ -473,6 +472,7 @@ class TestContext:
self.args = args
self.hw_config = None
self.hostapd = None
+ self.wpas_interfaces = None
self.cur_radio_id = 0
self.cur_iface_id = 0
self.radios = []
@@ -623,6 +623,14 @@ class TestContext:
self.hostapd = Hostapd(self, hapd_radios, hapd_configs, radius_config)
+ def start_wpas_interfaces(self):
+ if 'WPA_SUPPLICANT' not in self.hw_config:
+ return
+
+ settings = self.hw_config['WPA_SUPPLICANT']
+ wpas_radios = [rad for rad in self.radios if rad.name in settings]
+ self.wpas_interfaces = [rad.create_interface(settings[rad.name], 'wpas') for rad in wpas_radios]
+
def start_ofono(self):
sim_keys = self.hw_config['SETUP'].get('sim_keys', None)
if not sim_keys:
@@ -690,6 +698,7 @@ class TestContext:
def stop_test_processes(self):
self.radios = []
self.hostapd = None
+ self.wpas_interfaces = None
self.iwd_extra_options = None
for p in [p for p in self.processes if p.multi_test is False]:
@@ -884,6 +893,7 @@ def pre_test(ctx, test):
ctx.start_dbus_monitor()
ctx.start_radios()
ctx.start_hostapd()
+ ctx.start_wpas_interfaces()
ctx.start_ofono()
if ctx.args.log:
--
2.25.1
1 year, 8 months
iwd problems on Arch Linux
by KeithG
I have been struggling with this problem for a while and *think* I have
narrowed it down to an Arch Linux problem. My main focus is to get
iwd/connman to work on my RPis as iwd connects so much faster when it
works. Current versions on Arch Linux are Connman = 1.38 and iwd = 1.9. The
kernel I'm running is 5.4.70.
It does not behave absolutely consistently but there are themes. If I have
connman managing the connections, when the SSID goes away, iwd stops
scanning. This is very consistent. It does it first time every time. SSID
goes down, it disconnects and sits there. On Arch Linux, it does not seem
to be dependent on card (broadcom/intel) or hardware
(x86_64,armv6/armv7/aarch64). iwd quits scanning when the SSID goes away.
The monitor-iwd script shows 'Scanning = False' and it never rescans.
When I use systemd-networkd with iwd, I get better behavior, but it can
also get to a point where it quits scanning. This happens after a few times
of turning off then on the AP on the router. When it quits scanning,
monitor-iwd says "Scanning = False" and it never rescans. The last time I
ran it, the monitor-iwd script says Scanning = True then immediately
Scanning = False but nothing was scanned. It did this 13 times but never
'saw' anything nor connected. If I down then up the interface (ifconfig
wlan0 down; ifconfig wlan0 up), it immediately connects. I now have a
script that runs when the interface goes down to do this (down/up), but
shouldn't iwd eventually reconnect?
This contrasts with the same computer running RasPiOS. It is running the
same kernel and the same broadcom firmware (I updated both to be identical)
connman is 1.36 and iwd is 0.14, but it works every time all the time. I
cannot get it to not reconnect. In fact it connects faster than the web
page for the router registers it.
I built iwd 0.14 and connman 1.36 for the Arch install and it behaves the
same as iwd 1.9 or the iwd git master build. It just quits.
What underlying OS issues could cause this? I have built the kernel with
the same config options for both installations with the same computer doing
the building. Both installations are using the same kernel, firmware and
driver version (built with the kernel).
Keith
1 year, 8 months
[PATCH] auto-t: remove requirement for /var/lib/{ead,iwd}
by James Prestwood
The host systems configuration directories for IWD/EAD were
being mounted in the virtual machine. This required that the
host create these directories before hand. Instead we can
just set up the system and IWD/EAD to use directories in /tmp
that we create when we start the VM. This avoids the need for
any host configuration.
---
autotests/testEAD/connection_test.py | 11 ++++++++---
autotests/util/iwd.py | 10 +++++-----
tools/test-runner | 6 +++---
3 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/autotests/testEAD/connection_test.py b/autotests/testEAD/connection_test.py
index c51d7237..bdf242b6 100644
--- a/autotests/testEAD/connection_test.py
+++ b/autotests/testEAD/connection_test.py
@@ -2,6 +2,7 @@
import unittest
import sys
+import os
sys.path.append('../util')
from iwd import IWD
@@ -11,7 +12,9 @@ from ead import EAD
class Test(unittest.TestCase):
def test_connection_success(self):
- ctx.start_process(['ead', '-i', 'eth1', '-d'])
+ env = os.environ.copy()
+ env['STATE_DIRECTORY'] = '/tmp/ead'
+ ctx.start_process(['ead', '-i', 'eth1', '-d'], env=env)
ead = EAD()
@@ -25,11 +28,13 @@ class Test(unittest.TestCase):
@classmethod
def setUpClass(cls):
- IWD.copy_to_storage('default.8021x', storage_dir='/var/lib/ead')
+ os.mkdir('/tmp/ead')
+
+ IWD.copy_to_storage('default.8021x', storage_dir='/tmp/ead')
@classmethod
def tearDownClass(cls):
- IWD.clear_storage()
+ IWD.clear_storage(storage_dir='/tmp/ead')
if __name__ == '__main__':
unittest.main(exit=True)
diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index ef843a95..76d96289 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -17,8 +17,8 @@ from enum import Enum
from config import ctx
-IWD_STORAGE_DIR = '/var/lib/iwd'
-IWD_CONFIG_DIR = '/etc/iwd'
+IWD_STORAGE_DIR = '/tmp/iwd'
+IWD_CONFIG_DIR = '/tmp'
DBUS_OBJECT_MANAGER = 'org.freedesktop.DBus.ObjectManager'
DBUS_PROPERTIES = 'org.freedesktop.DBus.Properties'
@@ -909,9 +909,9 @@ class IWD(AsyncOpAbstract):
GLib.source_remove(timeout)
@staticmethod
- def clear_storage():
- os.system('rm -rf ' + IWD_STORAGE_DIR + '/*')
- os.system('rm -rf ' + IWD_STORAGE_DIR + '/hotspot/*')
+ def clear_storage(storage_dir=IWD_STORAGE_DIR):
+ os.system('rm -rf ' + storage_dir + '/*')
+ os.system('rm -rf ' + storage_dir + '/hotspot/*')
@staticmethod
def create_in_storage(file_name, file_content):
diff --git a/tools/test-runner b/tools/test-runner
index 3b9c1854..809a3905 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -112,8 +112,6 @@ mount_table = [
MountInfo('devpts', '/dev/pts', 'mode=0620', MS_NOSUID|MS_NOEXEC),
MountInfo('tmpfs', '/dev/shm', 'mode=1777', MS_NOSUID|MS_NODEV|MS_STRICTATIME),
MountInfo('tmpfs', '/run', 'mode=0755', MS_NOSUID|MS_NODEV|MS_STRICTATIME),
- MountInfo('tmpfs', '/var/lib/iwd', 'mode=0755', 0),
- MountInfo('tmpfs', '/var/lib/ead', 'mode=0755', 0),
MountInfo('tmpfs', '/tmp', '', 0),
MountInfo('tmpfs', '/usr/share/dbus-1', 'mode=0755', MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME),
MountInfo('debugfs', '/sys/kernel/debug', '', 0)
@@ -572,7 +570,7 @@ class TestContext:
env = os.environ.copy()
env['CONFIGURATION_DIRECTORY'] = config_dir
- env['STATE_DIRECTORY'] = '/var/lib/iwd'
+ env['STATE_DIRECTORY'] = '/tmp/iwd'
if self.is_verbose('iwd-dhcp'):
env['IWD_DHCP_DEBUG'] = '1'
@@ -742,6 +740,8 @@ def prepare_sandbox():
for entry in dev_table:
os.symlink(entry.target, entry.linkpath)
+ os.mkdir('/tmp/iwd')
+
os.setsid()
fcntl.ioctl(STDIN_FILENO, TIOCSTTY, 1)
--
2.26.2
1 year, 8 months