Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH 1/4] test-runner: fix crash if ofono is not installed
@ 2020-03-16 19:22 James Prestwood
  2020-03-16 19:22 ` [PATCH 2/4] test-runner: fix crash for tests using radius_server James Prestwood
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: James Prestwood @ 2020-03-16 19:22 UTC (permalink / raw)
  To: iwd

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

The goto was jumping to a label which freed the wiphy list which
had not yet been initialized. This also fixes another similar issue
if chdir fails (in this case tmpfs_extra_stuff would get freed
before being allocated).
---
 tools/test-runner.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 804a1038..42bd60e2 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -2073,7 +2073,7 @@ static void create_network_and_run_tests(void *data, void *user_data)
 	if (chdir(config_dir_path) < 0) {
 		l_error("Failed to change to test directory: %s",
 							strerror(errno));
-		goto exit_hwsim;
+		goto free_hw_settings;
 	}
 
 	tmpfs_extra_stuff =
@@ -2097,7 +2097,7 @@ static void create_network_and_run_tests(void *data, void *user_data)
 
 			if (!ofono_found || !phonesim_found) {
 				l_info("ofono or phonesim not found, skipping");
-				goto exit_hwsim;
+				goto free_tmpfs_extra;
 			}
 
 			ofono_req = true;
@@ -2268,7 +2268,6 @@ exit_hostapd:
 remove_abs_paths:
 	remove_absolute_path_dirs(tmpfs_extra_stuff);
 
-exit_hwsim:
 	/*
 	 * If running in hwsim mode, we want to completely free/destroy the
 	 * wiphy list since it will be re-populated on the next test. For the
@@ -2280,8 +2279,10 @@ exit_hwsim:
 	else
 		l_queue_foreach(wiphy_list, wiphy_reset, NULL);
 
-	l_settings_free(hw_settings);
+free_tmpfs_extra:
 	l_strfreev(tmpfs_extra_stuff);
+free_hw_settings:
+	l_settings_free(hw_settings);
 }
 
 struct stat_totals {
-- 
2.21.1

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

* [PATCH 2/4] test-runner: fix crash for tests using radius_server
  2020-03-16 19:22 [PATCH 1/4] test-runner: fix crash if ofono is not installed James Prestwood
@ 2020-03-16 19:22 ` James Prestwood
  2020-03-16 19:22 ` [PATCH 3/4] test-runner: fix improper loading of radius_config James Prestwood
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: James Prestwood @ 2020-03-16 19:22 UTC (permalink / raw)
  To: iwd

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

Tests which use a standalone RADIUS server may crash due to
the wiphy array not taking into account the 'radius_server'
key which is skipped during setup.
---
 tools/test-runner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 42bd60e2..1f0bc4dd 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -1373,7 +1373,7 @@ static bool configure_hostapd_instances(struct l_settings *hw_settings,
 
 	hostapd_config_file_paths = l_new(char *, i + 1);
 	wiphys = alloca(sizeof(struct wiphy *) * (i + 1));
-	wiphys[i] = NULL;
+	memset(wiphys, 0, sizeof(struct wiphy *) * (i + 1));
 
 	hostapd_pids_out[0] = -1;
 
-- 
2.21.1

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

* [PATCH 3/4] test-runner: fix improper loading of radius_config
  2020-03-16 19:22 [PATCH 1/4] test-runner: fix crash if ofono is not installed James Prestwood
  2020-03-16 19:22 ` [PATCH 2/4] test-runner: fix crash for tests using radius_server James Prestwood
@ 2020-03-16 19:22 ` James Prestwood
  2020-03-16 19:22 ` [PATCH 4/4] netdev: fix auth protocols not setting ->connected James Prestwood
  2020-03-16 20:22 ` [PATCH 1/4] test-runner: fix crash if ofono is not installed Denis Kenzior
  3 siblings, 0 replies; 5+ messages in thread
From: James Prestwood @ 2020-03-16 19:22 UTC (permalink / raw)
  To: iwd

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

This key is special in hostapd, and was being treated as a normal hostapd
config file. This special radius config file needs to be kept unpaired from
any interfaces so now its passed in as a separate argument and appended to
the end of the hostapd execute command.
---
 tools/test-runner.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 1f0bc4dd..320dea0b 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -989,7 +989,7 @@ static void stop_ofono(pid_t pid)
 }
 
 static pid_t start_hostapd(char **config_files, struct wiphy **wiphys,
-				const char *test_name)
+				const char *test_name, const char *radius_conf)
 {
 	char **argv;
 	pid_t pid;
@@ -1029,6 +1029,9 @@ static pid_t start_hostapd(char **config_files, struct wiphy **wiphys,
 		argv[idx++] = config_files[i];
 	}
 
+	if (radius_conf)
+		argv[idx++] = (void *)radius_conf;
+
 	if (verbose) {
 		argv[idx++] = "-d";
 		argv[idx++] = NULL;
@@ -1358,6 +1361,7 @@ static bool configure_hostapd_instances(struct l_settings *hw_settings,
 	int i;
 	char **hostapd_config_file_paths;
 	struct wiphy **wiphys;
+	const char *radius_config = NULL;
 
 	*phys_used = 0;
 
@@ -1398,8 +1402,12 @@ static bool configure_hostapd_instances(struct l_settings *hw_settings,
 			goto done;
 		}
 
-		if (!strcmp(hostap_keys[i], "radius_server"))
+		if (!strcmp(hostap_keys[i], "radius_server")) {
+			radius_config = l_settings_get_value(hw_settings,
+						HW_CONFIG_GROUP_HOSTAPD,
+						"radius_server");
 			continue;
+		}
 
 		for (wiphy_entry = l_queue_get_entries(wiphy_list);
 					wiphy_entry;
@@ -1478,7 +1486,8 @@ hostapd_done:
 	}
 
 	hostapd_pids_out[0] = start_hostapd(hostapd_config_file_paths, wiphys,
-						basename(config_dir_path));
+						basename(config_dir_path),
+						radius_config);
 	hostapd_pids_out[1] = -1;
 
 done:
-- 
2.21.1

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

* [PATCH 4/4] netdev: fix auth protocols not setting ->connected
  2020-03-16 19:22 [PATCH 1/4] test-runner: fix crash if ofono is not installed James Prestwood
  2020-03-16 19:22 ` [PATCH 2/4] test-runner: fix crash for tests using radius_server James Prestwood
  2020-03-16 19:22 ` [PATCH 3/4] test-runner: fix improper loading of radius_config James Prestwood
@ 2020-03-16 19:22 ` James Prestwood
  2020-03-16 20:22 ` [PATCH 1/4] test-runner: fix crash if ofono is not installed Denis Kenzior
  3 siblings, 0 replies; 5+ messages in thread
From: James Prestwood @ 2020-03-16 19:22 UTC (permalink / raw)
  To: iwd

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

This causes netdev to think another supplicant is running when it
recieves a connect event due to an auth protocol running.
---
 src/netdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/netdev.c b/src/netdev.c
index a5071471..c11a483f 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -2413,7 +2413,9 @@ static int netdev_connect_common(struct netdev *netdev,
 					NL80211_EXT_FEATURE_CAN_REPLACE_PTK0))
 		handshake_state_set_no_rekey(hs, true);
 
-	auth_proto_start(netdev->ap);
+	/* set connected since the auth protocols cannot do so internally */
+	if (netdev->ap && auth_proto_start(netdev->ap))
+		netdev->connected = true;
 
 	return 0;
 }
-- 
2.21.1

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

* Re: [PATCH 1/4] test-runner: fix crash if ofono is not installed
  2020-03-16 19:22 [PATCH 1/4] test-runner: fix crash if ofono is not installed James Prestwood
                   ` (2 preceding siblings ...)
  2020-03-16 19:22 ` [PATCH 4/4] netdev: fix auth protocols not setting ->connected James Prestwood
@ 2020-03-16 20:22 ` Denis Kenzior
  3 siblings, 0 replies; 5+ messages in thread
From: Denis Kenzior @ 2020-03-16 20:22 UTC (permalink / raw)
  To: iwd

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

Hi James,

On 3/16/20 2:22 PM, James Prestwood wrote:
> The goto was jumping to a label which freed the wiphy list which
> had not yet been initialized. This also fixes another similar issue
> if chdir fails (in this case tmpfs_extra_stuff would get freed
> before being allocated).
> ---
>   tools/test-runner.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 

All applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2020-03-16 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-16 19:22 [PATCH 1/4] test-runner: fix crash if ofono is not installed James Prestwood
2020-03-16 19:22 ` [PATCH 2/4] test-runner: fix crash for tests using radius_server James Prestwood
2020-03-16 19:22 ` [PATCH 3/4] test-runner: fix improper loading of radius_config James Prestwood
2020-03-16 19:22 ` [PATCH 4/4] netdev: fix auth protocols not setting ->connected James Prestwood
2020-03-16 20:22 ` [PATCH 1/4] test-runner: fix crash if ofono is not installed Denis Kenzior

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