mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-31 09:14:03 -05:00
tests: Fix ap_track_sta false negative by using common finalizer
ap_track_sta fails with this message. --------------- wlan0: Country code not reset back to 00: is US wlan0: Country code cleared back to 00 --------------- Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
e0eb6e536d
commit
41318114b6
@ -11,24 +11,18 @@ import time
|
|||||||
|
|
||||||
import hostapd
|
import hostapd
|
||||||
from wpasupplicant import WpaSupplicant
|
from wpasupplicant import WpaSupplicant
|
||||||
from utils import parse_ie
|
from utils import parse_ie, disable_hapd, clear_regdom_dev
|
||||||
|
|
||||||
def test_ap_track_sta(dev, apdev):
|
def test_ap_track_sta(dev, apdev):
|
||||||
"""Dualband AP tracking unconnected stations"""
|
"""Dualband AP tracking unconnected stations"""
|
||||||
try:
|
|
||||||
_test_ap_track_sta(dev, apdev)
|
|
||||||
finally:
|
|
||||||
subprocess.call(['iw', 'reg', 'set', '00'])
|
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
def _test_ap_track_sta(dev, apdev):
|
try:
|
||||||
params = {"ssid": "track",
|
params = {"ssid": "track",
|
||||||
"country_code": "US",
|
"country_code": "US",
|
||||||
"hw_mode": "g",
|
"hw_mode": "g",
|
||||||
"channel": "6",
|
"channel": "6",
|
||||||
"track_sta_max_num": "2"}
|
"track_sta_max_num": "2"}
|
||||||
hapd = hostapd.add_ap(apdev[0], params)
|
hapd = hostapd.add_ap(apdev[0], params)
|
||||||
bssid = apdev[0]['bssid']
|
|
||||||
|
|
||||||
params = {"ssid": "track",
|
params = {"ssid": "track",
|
||||||
"country_code": "US",
|
"country_code": "US",
|
||||||
@ -37,8 +31,15 @@ def _test_ap_track_sta(dev, apdev):
|
|||||||
"track_sta_max_num": "100",
|
"track_sta_max_num": "100",
|
||||||
"track_sta_max_age": "1"}
|
"track_sta_max_age": "1"}
|
||||||
hapd2 = hostapd.add_ap(apdev[1], params)
|
hapd2 = hostapd.add_ap(apdev[1], params)
|
||||||
bssid2 = apdev[1]['bssid']
|
|
||||||
|
|
||||||
|
_test_ap_track_sta(dev, hapd, apdev[0]['bssid'], hapd2,
|
||||||
|
apdev[1]['bssid'])
|
||||||
|
finally:
|
||||||
|
disable_hapd(hapd)
|
||||||
|
disable_hapd(hapd2)
|
||||||
|
clear_regdom_dev(dev, 3)
|
||||||
|
|
||||||
|
def _test_ap_track_sta(dev, hapd, bssid, hapd2, bssid2):
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
dev[0].scan_for_bss(bssid, freq=2437, force_scan=True)
|
dev[0].scan_for_bss(bssid, freq=2437, force_scan=True)
|
||||||
dev[0].scan_for_bss(bssid2, freq=5200, force_scan=True)
|
dev[0].scan_for_bss(bssid2, freq=5200, force_scan=True)
|
||||||
|
@ -148,10 +148,13 @@ def clear_country(dev):
|
|||||||
dev[1].dump_monitor()
|
dev[1].dump_monitor()
|
||||||
|
|
||||||
def clear_regdom(hapd, dev, count=1):
|
def clear_regdom(hapd, dev, count=1):
|
||||||
|
disable_hapd(hapd)
|
||||||
|
clear_regdom_dev(dev, count)
|
||||||
|
|
||||||
|
def disable_hapd(hapd):
|
||||||
if hapd:
|
if hapd:
|
||||||
hapd.request("DISABLE")
|
hapd.request("DISABLE")
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
clear_regdom_dev(dev, count)
|
|
||||||
|
|
||||||
def clear_regdom_dev(dev, count=1):
|
def clear_regdom_dev(dev, count=1):
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
|
Loading…
Reference in New Issue
Block a user