($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 2/2] unit: add test for band fallback
Date: Tue, 14 May 2024 07:19:23 -0700	[thread overview]
Message-ID: <20240514141923.291148-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20240514141923.291148-1-prestwoj@gmail.com>

This test uses the same country/country3 values seen by an AP vendor
which causes issues with IWD. The alpha2 is ES (Spain) and the 3rd
byte is 4, indicating to use the E-4. The issue then comes when the
neighbor report claims the BSS is under operating class 3 which is
not part of E-4.

With the fallback implemented, this test will pass since it will
try and lookup only on ES (the EU table) which operating class 3 is
part of.
---
 unit/test-band.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/unit/test-band.c b/unit/test-band.c
index 855fb67f..606bb854 100644
--- a/unit/test-band.c
+++ b/unit/test-band.c
@@ -670,6 +670,19 @@ static void test_conversions(const void *data)
 	assert(!band_channel_to_freq(192, BAND_FREQ_5_GHZ));
 }
 
+static void test_conversion_fallback(const void *data)
+{
+	enum band_freq band;
+	const uint8_t cc[] = {'E', 'S', 0x04};
+
+	/*
+	 * Without a fallback, this would fail. There is no operclass 3 in the
+	 * global operating table (E-4)
+	 */
+	band = band_oper_class_to_band(cc, 3);
+	assert(band == BAND_FREQ_5_GHZ);
+}
+
 int main(int argc, char *argv[])
 {
 	l_test_init(&argc, &argv);
@@ -736,6 +749,7 @@ int main(int argc, char *argv[])
 	l_test_add("/band/6ghz/freq", test_6ghz_freqs, NULL);
 
 	l_test_add("/band/conversions", test_conversions, NULL);
+	l_test_add("/band/conversion fallback", test_conversion_fallback, NULL);
 
 	return l_test_run();
 }
-- 
2.34.1


  reply	other threads:[~2024-05-14 14:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 14:19 [PATCH 1/2] band: support band lookup fallback for buggy APs James Prestwood
2024-05-14 14:19 ` James Prestwood [this message]
2024-05-14 15:33 ` 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=20240514141923.291148-2-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).