]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix FST scanning for non-FST APs
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 15 Dec 2016 12:10:17 +0000 (14:10 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 15 Dec 2016 12:17:14 +0000 (14:17 +0200)
The sta2.scan() calls were performing full scan of all channels and
reporting only the BSS entry that happened to be the first one in the
wpa_supplicant list. This is problematic since it is possible that the
target AP was not found and incorrect BSS was selected and used for
setting scan_freq which made the connection fail. Furthermore, there is
no need to use full scan for these test cases, so use a single channel
scan instead.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/test_fst_module.py

index 68a968532274176b7ed2e2c900030e43aba19f48..0d6f552eed9202db522e2c06479ae06ced181c05 100644 (file)
@@ -743,10 +743,8 @@ def test_fst_sta_connect_to_non_fst_ap(dev, apdev, test_params):
         try:
             orig_sta1_mbies = sta1.get_local_mbies()
             orig_sta2_mbies = sta2.get_local_mbies()
-            vals = sta2.scan()
-            freq = vals['freq']
             sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g",
-                                        key_mgmt="NONE", scan_freq=freq)
+                                        key_mgmt="NONE", scan_freq='2412')
             time.sleep(2)
             res_sta1_mbies = sta1.get_local_mbies()
             res_sta2_mbies = sta2.get_local_mbies()
@@ -831,9 +829,8 @@ def test_fst_second_sta_connect_to_non_fst_ap(dev, apdev, test_params):
             time.sleep(2)
             orig_sta1_mbies = sta1.get_local_mbies()
             orig_sta2_mbies = sta2.get_local_mbies()
-            vals = sta2.scan()
-            freq = vals['freq']
-            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
+            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g",
+                                        key_mgmt="NONE", scan_freq='2412')
             time.sleep(2)
             res_sta1_mbies = sta1.get_local_mbies()
             res_sta2_mbies = sta2.get_local_mbies()
@@ -857,9 +854,8 @@ def test_fst_second_sta_connect_to_fst_ap(dev, apdev, test_params):
     with HWSimRadio() as (radio, iface):
         non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
         try:
-            vals = sta2.scan()
-            freq = vals['freq']
-            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
+            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g",
+                                        key_mgmt="NONE", scan_freq='2412')
             time.sleep(2)
             orig_sta1_mbies = sta1.get_local_mbies()
             orig_sta2_mbies = sta2.get_local_mbies()
@@ -890,9 +886,8 @@ def test_fst_disconnect_1_of_2_stas_from_non_fst_ap(dev, apdev, test_params):
         try:
             vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
             sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
-            vals = sta2.scan()
-            freq = vals['freq']
-            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
+            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g",
+                                        key_mgmt="NONE", scan_freq='2412')
             time.sleep(2)
             orig_sta1_mbies = sta1.get_local_mbies()
             orig_sta2_mbies = sta2.get_local_mbies()
@@ -922,9 +917,8 @@ def test_fst_disconnect_1_of_2_stas_from_fst_ap(dev, apdev, test_params):
         try:
             vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
             sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
-            vals = sta2.scan()
-            freq = vals['freq']
-            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
+            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g",
+                                        key_mgmt="NONE", scan_freq='2412')
             time.sleep(2)
             orig_sta1_mbies = sta1.get_local_mbies()
             orig_sta2_mbies = sta2.get_local_mbies()
@@ -954,9 +948,8 @@ def test_fst_disconnect_2_of_2_stas_from_non_fst_ap(dev, apdev, test_params):
         try:
             vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
             sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
-            vals = sta2.scan()
-            freq = vals['freq']
-            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
+            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g",
+                                        key_mgmt="NONE", scan_freq='2412')
             time.sleep(2)
             sta1.disconnect()
             time.sleep(2)
@@ -988,9 +981,8 @@ def test_fst_disconnect_2_of_2_stas_from_fst_ap(dev, apdev, test_params):
         try:
             vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
             sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
-            vals = sta2.scan()
-            freq = vals['freq']
-            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
+            sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g",
+                                        key_mgmt="NONE", scan_freq='2412')
             time.sleep(2)
             sta2.disconnect_from_external_ap()
             time.sleep(2)