This is being added as a developer method and should not be used
in production. For testing purposes though, it is quite useful as
it forces IWD to roam to a provided BSS and bypasses IWD's roaming
and ranking logic for choosing a roam candidate.
To use this a BSSID is provided as the only parameter. If this
BSS is not in IWD's current scan results -EINVAL will be returned.
If IWD knows about the BSS it will attempt to roam to it whether
that is via FT, FT-over-DS, or Reassociation. These details are
still sorted out in IWDs station_transition_start() logic.
---
src/station.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/src/station.c b/src/station.c
index d2234e15..62eebfa2 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3721,12 +3721,47 @@ static struct l_dbus_message *station_get_diagnostics(struct
l_dbus *dbus,
return NULL;
}
+static struct l_dbus_message *station_force_roam(struct l_dbus *dbus,
+ struct l_dbus_message *message,
+ void *user_data)
+{
+ struct station *station = user_data;
+ struct scan_bss *target;
+ struct l_dbus_message_iter iter;
+ uint8_t *mac;
+ uint32_t mac_len;
+
+ if (!l_dbus_message_get_arguments(message, "ay", &iter))
+ goto invalid_args;
+
+ if (!l_dbus_message_iter_get_fixed_array(&iter, &mac, &mac_len))
+ goto invalid_args;
+
+ if (mac_len != 6)
+ return dbus_error_invalid_args(message);
+
+ l_debug("Attempting roam to BSS "MAC, MAC_STR(mac));
+
+ target = network_bss_find_by_addr(station->connected_network, mac);
+ if (!target || target == station->connected_bss)
+ return dbus_error_invalid_args(message);
+
+ station_transition_start(station, target);
+
+ return l_dbus_message_new_method_return(message);
+
+invalid_args:
+ return dbus_error_invalid_args(message);
+}
+
static void station_setup_diagnostic_interface(
struct l_dbus_interface *interface)
{
l_dbus_interface_method(interface, "GetDiagnostics", 0,
station_get_diagnostics, "a{sv}", "",
"diagnostics");
+ l_dbus_interface_method(interface, "Roam", 0, station_force_roam,
+ "", "ay", "mac");
}
static void station_destroy_diagnostic_interface(void *user_data)
--
2.26.2
Show replies by date
This is not a production method and it is recommended to deny access
unless being used for testing.
---
src/iwd-dbus.conf | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/iwd-dbus.conf b/src/iwd-dbus.conf
index 6b07ba9e..c36401c8 100644
--- a/src/iwd-dbus.conf
+++ b/src/iwd-dbus.conf
@@ -11,20 +11,24 @@
<allow own="net.connman.iwd"/>
<allow send_destination="net.connman.iwd"/>
<allow send_interface="net.connman.iwd.Agent"/>
+ <deny send_interface="net.connman.iwd.StationDiagnostic"
send_member="Roam"/>
</policy>
<policy group="wheel">
<allow send_destination="net.connman.iwd"/>
<allow send_interface="net.connman.iwd.Agent"/>
+ <deny send_interface="net.connman.iwd.StationDiagnostic"
send_member="Roam"/>
</policy>
<policy at_console="true">
<allow send_destination="net.connman.iwd"/>
<allow send_interface="net.connman.iwd.Agent"/>
+ <deny send_interface="net.connman.iwd.StationDiagnostic"
send_member="Roam"/>
</policy>
<policy context="default">
<deny send_destination="net.connman.iwd"/>
+ <deny send_interface="net.connman.iwd.StationDiagnostic"
send_member="Roam"/>
</policy>
</busconfig>
--
2.26.2
Hi James,
This is not a production method and it is recommended to deny access
unless being used for testing.
---
src/iwd-dbus.conf | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/iwd-dbus.conf b/src/iwd-dbus.conf
index 6b07ba9e..c36401c8 100644
--- a/src/iwd-dbus.conf
+++ b/src/iwd-dbus.conf
@@ -11,20 +11,24 @@
<allow own="net.connman.iwd"/>
<allow send_destination="net.connman.iwd"/>
<allow send_interface="net.connman.iwd.Agent"/>
+ <deny send_interface="net.connman.iwd.StationDiagnostic"
send_member="Roam"/>
</policy>
<policy group="wheel">
<allow send_destination="net.connman.iwd"/>
<allow send_interface="net.connman.iwd.Agent"/>
+ <deny send_interface="net.connman.iwd.StationDiagnostic"
send_member="Roam"/>
</policy>
<policy at_console="true">
<allow send_destination="net.connman.iwd"/>
<allow send_interface="net.connman.iwd.Agent"/>
+ <deny send_interface="net.connman.iwd.StationDiagnostic"
send_member="Roam"/>
</policy>
<policy context="default">
<deny send_destination="net.connman.iwd"/>
+ <deny send_interface="net.connman.iwd.StationDiagnostic"
send_member="Roam"/>
</policy>
</busconfig>
I actually dislike this. If something that is just for developers, then we should add a
switch that starts iwd in developer mode and then these methods are added.
My problem is that even if you add a policy here, the D-Bus introspection will still show
the method to everybody.
Regards
Marcel
Hi Marcel,
<snip>
I actually dislike this. If something that is just for developers,
then we should add a switch that starts iwd in developer mode and
then these methods are added.
Sure, I'm fine with a hidden main.conf option as well.
My problem is that even if you add a policy here, the D-Bus
introspection will still show the method to everybody.
Regards
Marcel
Thanks,
James
Hi James,
> I actually dislike this. If something that is just for
developers,
> then we should add a switch that starts iwd in developer mode and
> then these methods are added.
Sure, I'm fine with a hidden main.conf option as well.
either that or a command line option to iwd.
Regards
Marcel
---
test/force-roam | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100755 test/force-roam
diff --git a/test/force-roam b/test/force-roam
new file mode 100755
index 00000000..b590c84a
--- /dev/null
+++ b/test/force-roam
@@ -0,0 +1,16 @@
+#!/usr/bin/python3
+
+import sys
+import dbus
+
+if (len(sys.argv) != 3):
+ print("Usage: %s <device> <mac>" % (sys.argv[0]))
+ sys.exit(1)
+
+bus = dbus.SystemBus()
+device = dbus.Interface(bus.get_object("net.connman.iwd", sys.argv[1]),
+ "net.connman.iwd.StationDiagnostic")
+
+mac = sys.argv[2].replace(':', '')
+
+device.Roam(dbus.ByteArray.fromhex(mac))
--
2.26.2