]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Simplify EHT tests that need to work with older tshark versions
authorBenjamin Berg <benjamin.berg@intel.com>
Mon, 6 Jan 2025 15:31:29 +0000 (17:31 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 26 Jan 2025 07:41:51 +0000 (09:41 +0200)
run_tshark() accepts now multiple filters. Change the tests that
required support for older tshark accordingly.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
tests/hwsim/test_eht.py

index e44b0710c66884eb2e1d4984c45ce93e58313594..8f1a51d4cdb27ea8815083a3250142496a62b7ca 100644 (file)
@@ -906,16 +906,12 @@ def test_eht_mld_connect_probes(dev, apdev, params):
         wpas.connect(ssid, sae_password= passphrase, ieee80211w="2",
                      key_mgmt="SAE", scan_freq="2412")
 
+        filters = ['wlan.fc.type_subtype == 0x0004 && wlan.ext_tag.length == 8 && wlan.ext_tag.number == 107 && wlan.eht.multi_link_control == 0x0011 && wlan.eht.multi_link.common_info.length == 2 && wlan.eht.multi_link.common_info.mld_id == 0 && wlan.eht.multi_link.sta_profile.subelt_id == 0 && wlan.eht.multi_link.sta_profile.subelt_len == 2 && wlan.eht.multi_link.type_1.sta_profile_count == 1 && wlan.eht.multi_link.sta_profile_id_list == 1',
+                   'wlan.fc.type_subtype == 0x0004 && wlan.ext_tag.number == 107 && wlan.ext_tag.data == 11:00:02:00:00:02:11:00']
         out = run_tshark(os.path.join(params['logdir'], 'hwsim0.pcapng'),
-                         'wlan.fc.type_subtype == 0x0004 && wlan.ext_tag.length == 8 && wlan.ext_tag.number == 107 && wlan.eht.multi_link_control == 0x0011 && wlan.eht.multi_link.common_info.length == 2 && wlan.eht.multi_link.common_info.mld_id == 0 && wlan.eht.multi_link.sta_profile.subelt_id == 0 && wlan.eht.multi_link.sta_profile.subelt_len == 2 && wlan.eht.multi_link.type_1.sta_profile_count == 1 && wlan.eht.multi_link.sta_profile_id_list == 1',
-                         display=['frame.number'])
+                         filters, display=['frame.number'])
         if not out.splitlines():
-            # Fall back to older tshark version without support for EHT dissecting
-            out = run_tshark(os.path.join(params['logdir'], 'hwsim0.pcapng'),
-                             'wlan.fc.type_subtype == 0x0004 && wlan.ext_tag.number == 107 && wlan.ext_tag.data == 11:00:02:00:00:02:11:00',
-                             display=['frame.number'])
-            if not out.splitlines():
-                raise Exception('ML probe request not found')
+            raise Exception('ML probe request not found')
 
         # Probe Response frame has the ML element, which will be fragmented
         out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"),
@@ -1037,16 +1033,10 @@ def test_eht_connect_invalid_link(dev, apdev, params):
         eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True,
                           valid_links=1, active_links=1)
 
+        filters = ['wlan.fc.type_subtype == 0x0000 && wlan.ext_tag.length == 11 && wlan.ext_tag.number == 107 && wlan.eht.multi_link_control == 0x0100 && wlan.eht.multi_link.common_info.length == 9 && wlan.eht.multi_link.common_info.mld_mac_address == %s && wlan.eht.multi_link.common_info.mld_capabilities == 0x0000' % wpas.own_addr(),
+                   'wlan.fc.type_subtype == 0x0000 && wlan.ext_tag.data == 00:01:09:%s:00:00' % wpas.own_addr()]
         out = run_tshark(os.path.join(params['logdir'], 'hwsim0.pcapng'),
-                         'wlan.fc.type_subtype == 0x0000 && wlan.ext_tag.length == 11 && wlan.ext_tag.number == 107 && wlan.eht.multi_link_control == 0x0100 && wlan.eht.multi_link.common_info.length == 9 && wlan.eht.multi_link.common_info.mld_mac_address == %s && wlan.eht.multi_link.common_info.mld_capabilities == 0x0000' % wpas.own_addr(),
-                         display=['frame.number'])
-        if out.splitlines():
-            return
-
-        # Fall back to older tshark version without support for EHT dissecting
-        out = run_tshark(os.path.join(params['logdir'], 'hwsim0.pcapng'),
-                         'wlan.fc.type_subtype == 0x0000 && wlan.ext_tag.data == 00:01:09:%s:00:00' % wpas.own_addr(),
-                         display=['frame.number'])
+                         filters, display=['frame.number'])
         if not out.splitlines():
             raise Exception('Association request send by mac80211 had unexpected ML element content (probably it contained a second link)')