diff --git a/tests/hwsim/test_peerkey.py b/tests/hwsim/test_peerkey.py index a3d6d22ef..ec182851c 100644 --- a/tests/hwsim/test_peerkey.py +++ b/tests/hwsim/test_peerkey.py @@ -65,9 +65,26 @@ def test_peerkey_sniffer_check(dev, apdev, params): addr0 = dev[0].own_addr() addr1 = dev[1].own_addr() - out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"), - "eapol.type == 3", - display=["wlan.sa", "wlan.da", "eapol.keydes.key_info"]) + # Wireshark renamed the EAPOL-Key key_info field, so need to try both the + # new and the old name to work with both versions. + try_other = False + try: + out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"), + "eapol.type == 3", + display=["wlan.sa", "wlan.da", + "wlan_rsna_eapol.keydes.key_info"]) + except Exception, e: + if "Unknown tshark field" in str(e): + try_other = True + pass + else: + raise + if try_other: + out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"), + "eapol.type == 3", + display=["wlan.sa", "wlan.da", + "eapol.keydes.key_info"], + wait=False) smk = [ False, False, False, False, False ] stk = [ False, False, False, False ] diff --git a/tests/hwsim/tshark.py b/tests/hwsim/tshark.py index 5faed5e43..d2a8c45ca 100644 --- a/tests/hwsim/tshark.py +++ b/tests/hwsim/tshark.py @@ -34,15 +34,18 @@ def run_tshark(filename, filter, display=None, wait=True): else: arg.append('-V') cmd = subprocess.Popen(arg, stdout=subprocess.PIPE, - stderr=open('/dev/null', 'w')) + stderr=subprocess.PIPE) except Exception, e: logger.info("Could run run tshark check: " + str(e)) cmd = None return None - out = cmd.communicate()[0] + output = cmd.communicate() + out = output[0] res = cmd.wait() if res == 1: + if "Some fields aren't valid" in output[1]: + raise Exception("Unknown tshark field") # remember this for efficiency _tshark_filter_arg = '-R' arg[3] = '-R'