mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-29 02:38:22 -05:00
tests: Make ap_max_num_sta_no_probe_resp more robust
It was possible for the AP's Beacon frame to be seen by dev[0] when running a scan. This is not an error case. Make this test case more robust by verifying with a sniffer whether a Probe Response frame was sent to unexpected STA. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
58059e6c0c
commit
bc321e1597
@ -6,10 +6,12 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import hwsim_utils
|
import hwsim_utils
|
||||||
import hostapd
|
import hostapd
|
||||||
|
from tshark import run_tshark
|
||||||
|
|
||||||
def test_ap_fragmentation_rts_set_high(dev, apdev):
|
def test_ap_fragmentation_rts_set_high(dev, apdev):
|
||||||
"""WPA2-PSK AP with fragmentation and RTS thresholds larger than frame length"""
|
"""WPA2-PSK AP with fragmentation and RTS thresholds larger than frame length"""
|
||||||
@ -249,8 +251,9 @@ def test_ap_max_num_sta(dev, apdev):
|
|||||||
if ev is not None:
|
if ev is not None:
|
||||||
raise Exception("Unexpected association")
|
raise Exception("Unexpected association")
|
||||||
|
|
||||||
def test_ap_max_num_sta_no_probe_resp(dev, apdev):
|
def test_ap_max_num_sta_no_probe_resp(dev, apdev, params):
|
||||||
"""Maximum STA count and limit on Probe Response frames"""
|
"""Maximum STA count and limit on Probe Response frames"""
|
||||||
|
logdir = params['logdir']
|
||||||
dev[0].flush_scan_cache()
|
dev[0].flush_scan_cache()
|
||||||
ssid = "max"
|
ssid = "max"
|
||||||
params = {}
|
params = {}
|
||||||
@ -262,9 +265,20 @@ def test_ap_max_num_sta_no_probe_resp(dev, apdev):
|
|||||||
dev[1].connect(ssid, key_mgmt="NONE", scan_freq="2412")
|
dev[1].connect(ssid, key_mgmt="NONE", scan_freq="2412")
|
||||||
dev[0].scan(freq=2412, type="ONLY")
|
dev[0].scan(freq=2412, type="ONLY")
|
||||||
dev[0].scan(freq=2412, type="ONLY")
|
dev[0].scan(freq=2412, type="ONLY")
|
||||||
if dev[0].get_bss(apdev[0]['bssid']) != None:
|
seen = dev[0].get_bss(apdev[0]['bssid']) != None
|
||||||
raise Exception("AP found unexpectedly")
|
|
||||||
dev[1].scan(freq=2412, type="ONLY")
|
dev[1].scan(freq=2412, type="ONLY")
|
||||||
|
if seen:
|
||||||
|
out = run_tshark(os.path.join(logdir, "hwsim0.pcapng"),
|
||||||
|
"wlan.fc.type_subtype == 5", ["wlan.da" ])
|
||||||
|
if out:
|
||||||
|
if dev[0].own_addr() not in out:
|
||||||
|
# Discovery happened through Beacon frame reception. That's not
|
||||||
|
# an error case.
|
||||||
|
seen = False
|
||||||
|
if dev[1].own_addr() not in out:
|
||||||
|
raise Exception("No Probe Response frames to dev[1] seen")
|
||||||
|
if seen:
|
||||||
|
raise Exception("AP found unexpectedly")
|
||||||
|
|
||||||
def test_ap_tx_queue_params(dev, apdev):
|
def test_ap_tx_queue_params(dev, apdev):
|
||||||
"""Open AP with TX queue params set"""
|
"""Open AP with TX queue params set"""
|
||||||
|
Loading…
Reference in New Issue
Block a user