aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Prestwood <prestwoj@gmail.com>2024-05-14 07:19:23 -0700
committerDenis Kenzior <denkenz@gmail.com>2024-05-14 10:30:48 -0500
commitfdbbd8b383626265c1454801d24cdfa6234d1416 (patch)
tree6662f6140bc8335147b1297f0dbc9b1057b1fb08
parent70d1d71612cfd5db6433af9081ab29f44cb0adc6 (diff)
unit: add test for band fallbackHEADmaster
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.
-rw-r--r--unit/test-band.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/unit/test-band.c b/unit/test-band.c
index 855fb67f7..606bb854a 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();
}