tests: Fix peerkey_sniffer_check with newer Wireshark version
Wireshark renamed eapol.keydes.key_info to wlan_rsna_eapol.keydes.key_info and that broke this test case when upgrading Wireshark. Fix this by trying to use both the new and the old name. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
6219943d57
commit
2db07d16bf
2 changed files with 25 additions and 5 deletions
|
@ -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 ]
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue