tests: Replace hapd_connected() with hapd.wait_sta()
These were doing practically the same thing, so get rid of the external helper function and standardize on using hapd.wait_sta(). Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
e2c364e2cd
commit
c0d607ec8f
2 changed files with 10 additions and 15 deletions
|
@ -1330,11 +1330,6 @@ def reply_eapol(info, hapd, addr, msg, key_info, nonce, data, kck):
|
|||
eapol_key_mic(kck, msg)
|
||||
send_eapol(hapd, addr, build_eapol(msg))
|
||||
|
||||
def hapd_connected(hapd):
|
||||
ev = hapd.wait_event(["AP-STA-CONNECTED"], timeout=15)
|
||||
if ev is None:
|
||||
raise Exception("Timeout on AP-STA-CONNECTED from hostapd")
|
||||
|
||||
def eapol_test(apdev, dev, wpa2=True, ieee80211w=0):
|
||||
bssid = apdev['bssid']
|
||||
if wpa2:
|
||||
|
@ -1391,7 +1386,7 @@ def test_ap_wpa2_psk_ext_eapol(dev, apdev):
|
|||
send_eapol(hapd, addr, build_eapol(msg))
|
||||
|
||||
reply_eapol("4/4", hapd, addr, msg, 0x030a, None, None, kck)
|
||||
hapd_connected(hapd)
|
||||
hapd.wait_sta(timeout=15)
|
||||
|
||||
@remote_compatible
|
||||
def test_ap_wpa2_psk_ext_eapol_retry1(dev, apdev):
|
||||
|
@ -1418,7 +1413,7 @@ def test_ap_wpa2_psk_ext_eapol_retry1(dev, apdev):
|
|||
raise Exception("ANonce changed")
|
||||
|
||||
reply_eapol("4/4", hapd, addr, msg, 0x030a, None, None, kck)
|
||||
hapd_connected(hapd)
|
||||
hapd.wait_sta(timeout=15)
|
||||
|
||||
@remote_compatible
|
||||
def test_ap_wpa2_psk_ext_eapol_retry1b(dev, apdev):
|
||||
|
@ -1440,7 +1435,7 @@ def test_ap_wpa2_psk_ext_eapol_retry1b(dev, apdev):
|
|||
raise Exception("ANonce changed")
|
||||
|
||||
reply_eapol("4/4", hapd, addr, msg, 0x030a, None, None, kck)
|
||||
hapd_connected(hapd)
|
||||
hapd.wait_sta(timeout=15)
|
||||
|
||||
@remote_compatible
|
||||
def test_ap_wpa2_psk_ext_eapol_retry1c(dev, apdev):
|
||||
|
@ -1464,7 +1459,7 @@ def test_ap_wpa2_psk_ext_eapol_retry1c(dev, apdev):
|
|||
if anonce != msg['rsn_key_nonce']:
|
||||
raise Exception("ANonce changed")
|
||||
reply_eapol("4/4", hapd, addr, msg, 0x030a, None, None, kck)
|
||||
hapd_connected(hapd)
|
||||
hapd.wait_sta(timeout=15)
|
||||
|
||||
@remote_compatible
|
||||
def test_ap_wpa2_psk_ext_eapol_retry1d(dev, apdev):
|
||||
|
@ -1488,7 +1483,7 @@ def test_ap_wpa2_psk_ext_eapol_retry1d(dev, apdev):
|
|||
if anonce != msg['rsn_key_nonce']:
|
||||
raise Exception("ANonce changed")
|
||||
reply_eapol("4/4", hapd, addr, msg, 0x030a, None, None, kck)
|
||||
hapd_connected(hapd)
|
||||
hapd.wait_sta(timeout=15)
|
||||
|
||||
@remote_compatible
|
||||
def test_ap_wpa2_psk_ext_eapol_type_diff(dev, apdev):
|
||||
|
@ -1519,7 +1514,7 @@ def test_ap_wpa2_psk_ext_eapol_type_diff(dev, apdev):
|
|||
send_eapol(hapd, addr, build_eapol(msg))
|
||||
|
||||
reply_eapol("4/4", hapd, addr, msg, 0x030a, None, None, kck)
|
||||
hapd_connected(hapd)
|
||||
hapd.wait_sta(timeout=15)
|
||||
|
||||
@remote_compatible
|
||||
def test_ap_wpa_psk_ext_eapol(dev, apdev):
|
||||
|
@ -1547,7 +1542,7 @@ def test_ap_wpa_psk_ext_eapol(dev, apdev):
|
|||
send_eapol(hapd, addr, build_eapol(msg))
|
||||
|
||||
reply_eapol("4/4", hapd, addr, msg, 0x030a, None, None, kck)
|
||||
hapd_connected(hapd)
|
||||
hapd.wait_sta(timeout=15)
|
||||
|
||||
@remote_compatible
|
||||
def test_ap_wpa2_psk_ext_eapol_key_info(dev, apdev):
|
||||
|
@ -1593,7 +1588,7 @@ def test_ap_wpa2_psk_ext_eapol_key_info(dev, apdev):
|
|||
send_eapol(hapd, addr, build_eapol(msg))
|
||||
|
||||
reply_eapol("4/4", hapd, addr, msg, 0x030a, None, None, kck)
|
||||
hapd_connected(hapd)
|
||||
hapd.wait_sta(timeout=15)
|
||||
|
||||
def build_eapol_key_1_4(anonce, replay_counter=1, key_data=b'', key_len=16):
|
||||
msg = {}
|
||||
|
|
|
@ -15,7 +15,7 @@ import hwsim_utils
|
|||
from utils import HwsimSkip
|
||||
|
||||
from test_ap_ht import set_world_reg
|
||||
from test_ap_psk import parse_eapol, build_eapol, pmk_to_ptk, eapol_key_mic, recv_eapol, send_eapol, reply_eapol, hapd_connected, build_eapol_key_3_4, aes_wrap, pad_key_data
|
||||
from test_ap_psk import parse_eapol, build_eapol, pmk_to_ptk, eapol_key_mic, recv_eapol, send_eapol, reply_eapol, build_eapol_key_3_4, aes_wrap, pad_key_data
|
||||
|
||||
#TODO: Refuse setting up AP with OCV but without MFP support
|
||||
#TODO: Refuse to connect to AP that advertises OCV but not MFP
|
||||
|
@ -424,7 +424,7 @@ class APConnection:
|
|||
|
||||
reply_eapol("4/4", self.hapd, self.addr, self.msg, 0x030a, None, None,
|
||||
self.kck)
|
||||
hapd_connected(self.hapd)
|
||||
self.hapd.wait_sta(timeout=15)
|
||||
|
||||
@remote_compatible
|
||||
def test_wpa2_ocv_ap_mismatch(dev, apdev):
|
||||
|
|
Loading…
Reference in a new issue