test: choose default device in force-roam
James Prestwood
PATCH 1/5 test: choose default device in force-roam
This makes the usage much more convenient if the system has only a single device.
--- test/force-roam | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
test/force-roam +23 -4
@@ -3,14 +3,33 @@ import sys import dbus -if (len(sys.argv) != 3): - print("Usage: %s <device> <mac>" % (sys.argv[0])) +if len(sys.argv) < 2 or 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]), +device = None + +if len(sys.argv) == 2: + manager = dbus.Interface(bus.get_object("net.connman.iwd", "/"), + "org.freedesktop.DBus.ObjectManager") + objects = manager.GetManagedObjects() + for path in objects: + for interface in objects[path]: + if interface == "net.connman.iwd.StationDebug": + device = dbus.Interface(bus.get_object("net.connman.iwd", path), "net.connman.iwd.StationDebug") + break + + if not device: + print("StationDebug interface not found") + exit() -mac = sys.argv[2].replace(':', '') + mac = sys.argv[1] +else: + device = dbus.Interface(bus.get_object("net.connman.iwd", sys.argv[1]), + "net.connman.iwd.StationDebug") + mac = sys.argv[2] +mac = mac.replace(':', '') device.Roam(dbus.ByteArray.fromhex(mac))
Signature · 1 line
2.31.1
Denis Kenzior
Hi James,
Quoted 6 lines · James Prestwood
This makes the usage much more convenient if the system has only a single device.
--- test/force-roam | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
All applied, thanks.
Regards,
-Denis
James Prestwood
PATCH 2/5 test-runner: set DBUS_SYSTEM_BUS_ADDRESS for --shell
In reply to James PrestwoodAfter namespaces were added, the dbus address was customized to be /tmp/dbus{0..N}. This prevented any dbus applications started in the shell from working properly.
Set DBUS_SYSTEM_BUS_ADDRESS to the environment prior to entering the shell.
--- tools/test-runner | 1 + 1 file changed, 1 insertion(+)
tools/test-runner +1 -0
@@ -1416,6 +1416,7 @@ def run_auto_tests(ctx, args): # a set of tests was passed in just start out in the first. # os.chdir(tests[0]) + os.environ['DBUS_SYSTEM_BUS_ADDRESS'] = ctx.dbus_address os.system('/bin/bash') exit()
Signature · 1 line
2.31.1
James Prestwood
PATCH 3/5 station: fix use-after-free on neighbor reports
In reply to James PrestwoodWhen netdev goes down so does station, but prior to netdev calling the neighbor report callback. The way the logic was written station is dereferenced prior to checking for any errors, causing a use after free.
Since -ENODEV is used in this case check for that early before accessing station.
--- src/station.c | 6 ++++++ 1 file changed, 6 insertions(+)
src/station.c +6 -0
@@ -1709,6 +1709,9 @@ static void station_early_neighbor_report_cb(struct netdev *netdev, int err, {struct station *station = user_data; +if (err == -ENODEV ) +return ; +l_debug ("ifindex: %u, error: %d(%s)" ,netdev_get_ifindex (station->netdev), err, err <0 ?strerror (-err) :"" );
@@ -2281,6 +2284,9 @@ static void station_neighbor_report_cb(struct netdev *netdev, int err,struct scan_freq_set *freq_set;int r; +if (err == -ENODEV ) +return ; +l_debug ("ifindex: %u, error: %d(%s)" ,netdev_get_ifindex (station->netdev), err, err <0 ?strerror (-err) :"" );
Signature · 1 line
2.31.1
James Prestwood
PATCH 4/5 station: check if connected before allowing Roam()
In reply to James Prestwood--- src/station.c | 3 +++ 1 file changed, 3 insertions(+)
src/station.c +3 -0
@@ -4082,6 +4082,9 @@ static struct l_dbus_message *station_force_roam(struct l_dbus *dbus,if (mac_len !=6 )return dbus_error_invalid_args (message); +if (!station->connected_network) +return dbus_error_not_connected (message); + target =network_bss_find_by_addr (station->connected_network, mac);if (!target || target == station->connected_bss)return dbus_error_invalid_args (message);
Signature · 1 line
2.31.1
James Prestwood
PATCH 5/5 handshake: free chandef if already set
In reply to James PrestwoodThis can happen with FT, since the handshake object is reused.
--- src/handshake.c | 3 +++ 1 file changed, 3 insertions(+)
src/handshake.c +3 -0
@@ -1024,6 +1024,9 @@ bool handshake_state_add_ecc_sae_pt(struct handshake_state *s,void handshake_state_set_chandef (struct handshake_state *s,struct band_chandef *chandef) { +if (s->chandef) +l_free (s->chandef); + s->chandef = chandef; }
Signature · 1 line
2.31.1