Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH 01/16] hwsim: return radio ID on create
@ 2020-08-27 17:32 James Prestwood
  2020-08-27 17:32 ` [PATCH 02/16] auto-t: prepare autotests for test-runner re-write James Prestwood
                   ` (15 more replies)
  0 siblings, 16 replies; 18+ messages in thread
From: James Prestwood @ 2020-08-27 17:32 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]

Hwsim was relying on some internal behavior of mac80211_hwsim where new
radios are created with ID's starting at zero and incremented. While
this is a reasonable assumption its better to obtain the actual radio
ID since mac80211_hwsim returns it in the radio creation callback.

Now hwsim will return the radio ID when creating radios. Negative returns
are still errors, but any value >= 0 indicates the radio ID of the newly
created radio.
---
 tools/hwsim.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/hwsim.c b/tools/hwsim.c
index 02053fa1..467ccd2d 100644
--- a/tools/hwsim.c
+++ b/tools/hwsim.c
@@ -216,6 +216,7 @@ static void create_callback(struct l_genl_msg *msg, void *user_data)
 		radio_id = err;
 
 		l_info("Created new radio with id %u", radio_id);
+		exit_status = radio_id;
 	} else {
 		l_warn("Failed to get create return value");
 		exit_status = EXIT_FAILURE;
@@ -2605,7 +2606,8 @@ static void usage(void)
 	printf("\thwsim [options]\n");
 	printf("Options:\n"
 		"\t-L, --list [id]        List simulated radios\n"
-		"\t-C, --create           Create new simulated radio\n"
+		"\t-C, --create           Create new simulated radio. The "
+						"return value is the new radio ID\n"
 		"\t-D, --destroy <id>     Destroy existing radio\n"
 		"\t-n, --name <name>      Name of a radio to be created\n"
 		"\t-i, --nointerface      Do not create VIF\n"
@@ -2632,6 +2634,7 @@ static const struct option main_options[] = {
 int main(int argc, char *argv[])
 {
 	int actions = 0;
+	int ret;
 
 	for (;;) {
 		int opt;
@@ -2729,7 +2732,9 @@ int main(int argc, char *argv[])
 		goto done;
 	}
 
-	exit_status = l_main_run_with_signal(signal_handler, NULL);
+	ret = l_main_run_with_signal(signal_handler, NULL);
+	if (ret)
+		exit_status = ret;
 
 	l_genl_family_free(hwsim);
 	l_genl_family_free(nl80211);
-- 
2.21.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-08-27 20:21 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-27 17:32 [PATCH 01/16] hwsim: return radio ID on create James Prestwood
2020-08-27 17:32 ` [PATCH 02/16] auto-t: prepare autotests for test-runner re-write James Prestwood
2020-08-27 17:32 ` [PATCH 03/16] auto-t: introduce pure python " James Prestwood
2020-08-27 17:32 ` [PATCH 04/16] auto-t: hostapd.py: update to work with test-runner rewrite James Prestwood
2020-08-27 17:32 ` [PATCH 05/16] auto-t: testutil.py: " James Prestwood
2020-08-27 17:32 ` [PATCH 06/16] auto-t: ofono.py: fix timeout cleanup and wait for service James Prestwood
2020-08-27 17:32 ` [PATCH 07/16] auto-t: iwd.py: update to work with test-runner rewrite James Prestwood
2020-08-27 17:32 ` [PATCH 08/16] auto-t: iwd.py: fix multiple timeout cleanup issues James Prestwood
2020-08-27 17:32 ` [PATCH 09/16] auto-t: remove wiphy.py James Prestwood
2020-08-27 17:32 ` [PATCH 10/16] auto-t: fix hidden network test James Prestwood
2020-08-27 17:32 ` [PATCH 11/16] auto-t: fix testSAE autoconnect_test.py James Prestwood
2020-08-27 17:32 ` [PATCH 12/16] auto-t: skip ofono tests if ofonod isn't running James Prestwood
2020-08-27 17:32 ` [PATCH 13/16] auto-t: replace hard-coded interfaces James Prestwood
2020-08-27 17:32 ` [PATCH 14/16] auto-t: remove device.wait_for_connected James Prestwood
2020-08-27 17:32 ` [PATCH 15/16] tools: post test-runner rewrite cleanup James Prestwood
2020-08-27 17:32 ` [PATCH 16/16] doc: update test runner docs James Prestwood
2020-08-27 20:08 ` [PATCH 01/16] hwsim: return radio ID on create Denis Kenzior
2020-08-27 20:21   ` James Prestwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox