tests: Check per-wiphy specific country code between test cases
This allows more accurate logging of failures related to the cfg80211 country=98 (intersection) case. This version is trying to give some more time to allow the country code to clear, but that does not seem to be sufficient with the current cfg80211 implementation for country=98 (but might be for other cases). The additional check for country=98 at the beginning of each test case is an attempt to force cfg80211 to restore world roaming state with a new association and disconnection at the station side detected after the AP side has already stopped. This is needed after the Linux kernel commit 113f3aaa81bd ("cfg80211: Prevent regulatory restore during STA disconnect in concurrent interfaces"). Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
ba3146e154
commit
c55799e54c
1 changed files with 55 additions and 0 deletions
|
@ -392,6 +392,12 @@ def main():
|
||||||
num_tests = len(tests_to_run)
|
num_tests = len(tests_to_run)
|
||||||
if args.stdin_ctrl:
|
if args.stdin_ctrl:
|
||||||
set_term_echo(sys.stdin.fileno(), False)
|
set_term_echo(sys.stdin.fileno(), False)
|
||||||
|
|
||||||
|
check_country_00 = True
|
||||||
|
for d in dev:
|
||||||
|
if d.get_driver_status_field("country") != "00":
|
||||||
|
check_country_00 = False
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if args.stdin_ctrl:
|
if args.stdin_ctrl:
|
||||||
test = sys.stdin.readline()
|
test = sys.stdin.readline()
|
||||||
|
@ -415,6 +421,31 @@ def main():
|
||||||
break
|
break
|
||||||
t = tests_to_run.pop(0)
|
t = tests_to_run.pop(0)
|
||||||
|
|
||||||
|
if dev[0].get_driver_status_field("country") == "98":
|
||||||
|
# Work around cfg80211 regulatory issues in clearing intersected
|
||||||
|
# country code 98. Need to make station disconnect without any
|
||||||
|
# other wiphy being active in the system.
|
||||||
|
logger.info("country=98 workaround - try to clear state")
|
||||||
|
id = dev[1].add_network()
|
||||||
|
dev[1].set_network(id, "mode", "2")
|
||||||
|
dev[1].set_network_quoted(id, "ssid", "country98")
|
||||||
|
dev[1].set_network(id, "key_mgmt", "NONE")
|
||||||
|
dev[1].set_network(id, "frequency", "2412")
|
||||||
|
dev[1].set_network(id, "scan_freq", "2412")
|
||||||
|
dev[1].select_network(id)
|
||||||
|
ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"])
|
||||||
|
if ev:
|
||||||
|
dev[0].connect("country98", key_mgmt="NONE", scan_freq="2412")
|
||||||
|
dev[1].request("DISCONNECT")
|
||||||
|
dev[0].wait_disconnected()
|
||||||
|
dev[0].request("DISCONNECT")
|
||||||
|
dev[0].request("ABORT_SCAN")
|
||||||
|
time.sleep(1)
|
||||||
|
dev[0].reset()
|
||||||
|
dev[1].reset()
|
||||||
|
dev[0].dump_monitor()
|
||||||
|
dev[1].dump_monitor()
|
||||||
|
|
||||||
name = t.__name__.replace('test_', '', 1)
|
name = t.__name__.replace('test_', '', 1)
|
||||||
open('/dev/kmsg', 'w').write('running hwsim test case %s\n' % name)
|
open('/dev/kmsg', 'w').write('running hwsim test case %s\n' % name)
|
||||||
if log_handler:
|
if log_handler:
|
||||||
|
@ -467,6 +498,30 @@ def main():
|
||||||
else:
|
else:
|
||||||
t(dev)
|
t(dev)
|
||||||
result = "PASS"
|
result = "PASS"
|
||||||
|
if check_country_00:
|
||||||
|
for d in dev:
|
||||||
|
country = d.get_driver_status_field("country")
|
||||||
|
if country != "00":
|
||||||
|
d.dump_monitor()
|
||||||
|
logger.info("Country code not reset back to 00: is " + country)
|
||||||
|
print "Country code not reset back to 00: is " + country
|
||||||
|
result = "FAIL"
|
||||||
|
|
||||||
|
# Try to wait for cfg80211 regulatory state to
|
||||||
|
# clear.
|
||||||
|
d.cmd_execute(['iw', 'reg', 'set', '00'])
|
||||||
|
for i in range(5):
|
||||||
|
time.sleep(1)
|
||||||
|
country = d.get_driver_status_field("country")
|
||||||
|
if country == "00":
|
||||||
|
break
|
||||||
|
if country == "00":
|
||||||
|
print "Country code cleared back to 00"
|
||||||
|
logger.info("Country code cleared back to 00")
|
||||||
|
else:
|
||||||
|
print "Country code remains set - expect following test cases to fail"
|
||||||
|
logger.info("Country code remains set - expect following test cases to fail")
|
||||||
|
break
|
||||||
except HwsimSkip, e:
|
except HwsimSkip, e:
|
||||||
logger.info("Skip test case: %s" % e)
|
logger.info("Skip test case: %s" % e)
|
||||||
result = "SKIP"
|
result = "SKIP"
|
||||||
|
|
Loading…
Reference in a new issue