tests: Make ap_track_sta_no_probe_resp more robust
Check whether the unexpected BSS entry is based on having received a Beacon frame instead of Probe Response frame. While this test case is using a huge beacon_int value, it is still possible for mac80211_hwsim timing to work in a way that a Beacon frame is sent. That made this test case fail in some rare cases. Fix this by ignoring the BSS entry if it is based on Beacon frame instead of Probe Response frame. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
e3b38d6e04
commit
a00a3458ed
2 changed files with 24 additions and 2 deletions
|
@ -11,6 +11,7 @@ import time
|
|||
|
||||
import hostapd
|
||||
from wpasupplicant import WpaSupplicant
|
||||
from utils import parse_ie
|
||||
|
||||
def test_ap_track_sta(dev, apdev):
|
||||
"""Dualband AP tracking unconnected stations"""
|
||||
|
@ -110,8 +111,15 @@ def _test_ap_track_sta_no_probe_resp(dev, apdev):
|
|||
dev[0].scan(freq=2437, type="ONLY")
|
||||
dev[0].scan(freq=2437, type="ONLY")
|
||||
|
||||
if dev[0].get_bss(bssid):
|
||||
raise Exception("2.4 GHz AP found unexpectedly")
|
||||
bss = dev[0].get_bss(bssid)
|
||||
if bss:
|
||||
ie = parse_ie(bss['ie'])
|
||||
# Check whether this is from a Beacon frame (TIM element included) since
|
||||
# it is possible that a Beacon frame was received during the active
|
||||
# scan. This test should fail only if a Probe Response frame was
|
||||
# received.
|
||||
if 5 not in ie:
|
||||
raise Exception("2.4 GHz AP found unexpectedly")
|
||||
|
||||
def test_ap_track_sta_no_auth(dev, apdev):
|
||||
"""Dualband AP rejecting authentication from dualband STA on 2.4 GHz"""
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
# This software may be distributed under the terms of the BSD license.
|
||||
# See README for more details.
|
||||
|
||||
import binascii
|
||||
import os
|
||||
import struct
|
||||
import time
|
||||
import remotehost
|
||||
|
||||
|
@ -102,3 +104,15 @@ def get_phy(ap, ifname=None):
|
|||
phy = "phy" + words[1]
|
||||
break
|
||||
return phy
|
||||
|
||||
def parse_ie(buf):
|
||||
ret = {}
|
||||
data = binascii.unhexlify(buf)
|
||||
while len(data) >= 2:
|
||||
ie,elen = struct.unpack('BB', data[0:2])
|
||||
data = data[2:]
|
||||
if elen > len(data):
|
||||
break
|
||||
ret[ie] = data[0:elen]
|
||||
data = data[elen:]
|
||||
return ret
|
||||
|
|
Loading…
Reference in a new issue