($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH] station: check disabled band configuration in station_init
Date: Mon,  2 Oct 2023 04:32:13 -0700	[thread overview]
Message-ID: <20231002113213.3852482-1-prestwoj@gmail.com> (raw)

For IWD to work correctly either 2.4GHz or 5GHz bands must be enabled
(even for 6GHz to work). Check this and don't allow IWD to initialize
if both 2.4 and 5GHz is disabled.
---
 src/station.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/station.c b/src/station.c
index a34d8ce3..f24b9aca 100644
--- a/src/station.c
+++ b/src/station.c
@@ -5203,6 +5203,19 @@ static void station_known_networks_changed(enum known_networks_event event,
 
 static int station_init(void)
 {
+	if (scan_get_band_rank_modifier(BAND_FREQ_2_4_GHZ))
+		allowed_bands |= BAND_FREQ_2_4_GHZ;
+	if (scan_get_band_rank_modifier(BAND_FREQ_5_GHZ))
+		allowed_bands |= BAND_FREQ_5_GHZ;
+	if (scan_get_band_rank_modifier(BAND_FREQ_6_GHZ))
+		allowed_bands |= BAND_FREQ_6_GHZ;
+
+	if (!(allowed_bands & (BAND_FREQ_2_4_GHZ | BAND_FREQ_5_GHZ))) {
+		l_error("At least 2.4GHz and 5GHz bands must be enabled for "
+			"IWD to start, check [Rank].BandModifier* setting");
+		return -ENOTSUP;
+	}
+
 	station_list = l_queue_new();
 	netdev_watch = netdev_watch_add(station_netdev_watch, NULL, NULL);
 	l_dbus_register_interface(dbus_get_bus(), IWD_STATION_INTERFACE,
@@ -5259,13 +5272,6 @@ static int station_init(void)
 						station_known_networks_changed,
 						NULL, NULL);
 
-	if (scan_get_band_rank_modifier(BAND_FREQ_2_4_GHZ))
-		allowed_bands |= BAND_FREQ_2_4_GHZ;
-	if (scan_get_band_rank_modifier(BAND_FREQ_5_GHZ))
-		allowed_bands |= BAND_FREQ_5_GHZ;
-	if (scan_get_band_rank_modifier(BAND_FREQ_6_GHZ))
-		allowed_bands |= BAND_FREQ_6_GHZ;
-
 	return 0;
 }
 
-- 
2.25.1


             reply	other threads:[~2023-10-02 11:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02 11:32 James Prestwood [this message]
2023-10-03 16:33 ` [PATCH] station: check disabled band configuration in station_init Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231002113213.3852482-1-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).