tests: Make it less likely to overflow wlan5 control iface socket

Number of test cases did not read all control interface socket events
from the dynamically added wlan5 interface. This could result in hitting
maximum socket TX queue length and failures in the following test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-10-04 01:42:42 +03:00
parent 7d56bd734c
commit 4b9d79b66e
8 changed files with 82 additions and 1 deletions

View file

@ -3318,16 +3318,22 @@ def _test_ap_wpa2_eap_in_bridge(dev, apdev):
subprocess.call(['iw', ifname, 'set', '4addr', 'on'])
subprocess.check_call(['brctl', 'addif', br_ifname, ifname])
wpas.interface_add(ifname, br_ifname=br_ifname)
wpas.dump_monitor()
id = eap_connect(wpas, apdev[0], "PAX", "pax.user@example.com",
password_hex="0123456789abcdef0123456789abcdef")
wpas.dump_monitor()
eap_reauth(wpas, "PAX")
wpas.dump_monitor()
# Try again as a regression test for packet socket workaround
eap_reauth(wpas, "PAX")
wpas.dump_monitor()
wpas.request("DISCONNECT")
wpas.wait_disconnected()
wpas.dump_monitor()
wpas.request("RECONNECT")
wpas.wait_connected()
wpas.dump_monitor()
def test_ap_wpa2_eap_session_ticket(dev, apdev):
"""WPA2-Enterprise connection using EAP-TTLS and TLS session ticket enabled"""

View file

@ -187,18 +187,24 @@ def test_ap_pmf_sta_sa_query(dev, apdev):
wpas.set_network(id, "frequency", "2412")
wpas.connect_network(id)
bssid = wpas.own_addr()
wpas.dump_monitor()
dev[0].connect(ssid, psk="12345678", ieee80211w="1",
key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
scan_freq="2412")
wpas.dump_monitor()
wpas.request("DEAUTHENTICATE " + addr + " test=0")
wpas.dump_monitor()
wpas.request("DISASSOCIATE " + addr + " test=0")
wpas.dump_monitor()
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
if ev is not None:
raise Exception("Unexpected disconnection")
wpas.request("DEAUTHENTICATE " + addr + " reason=6 test=0")
wpas.dump_monitor()
wpas.request("DISASSOCIATE " + addr + " reason=7 test=0")
wpas.dump_monitor()
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
if ev is not None:
raise Exception("Unexpected disconnection")
@ -206,6 +212,7 @@ def test_ap_pmf_sta_sa_query(dev, apdev):
raise Exception("STA did not send SA Query")
if wt.get_sta_counter("valid_saqueryresp_rx", bssid, addr) < 1:
raise Exception("AP did not reply to SA Query")
wpas.dump_monitor()
def test_ap_pmf_sta_sa_query_no_response(dev, apdev):
"""WPA2-PSK AP with station using SA Query and getting no response"""
@ -226,22 +233,30 @@ def test_ap_pmf_sta_sa_query_no_response(dev, apdev):
wpas.set_network(id, "frequency", "2412")
wpas.connect_network(id)
bssid = wpas.own_addr()
wpas.dump_monitor()
dev[0].connect(ssid, psk="12345678", ieee80211w="1",
key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
scan_freq="2412")
wpas.dump_monitor()
wpas.request("DEAUTHENTICATE " + addr + " test=0")
wpas.dump_monitor()
wpas.request("DISASSOCIATE " + addr + " test=0")
wpas.dump_monitor()
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
if ev is not None:
raise Exception("Unexpected disconnection")
wpas.request("SET ext_mgmt_frame_handling 1")
wpas.request("DEAUTHENTICATE " + addr + " reason=6 test=0")
wpas.dump_monitor()
wpas.request("DISASSOCIATE " + addr + " reason=7 test=0")
wpas.dump_monitor()
dev[0].wait_disconnected()
wpas.dump_monitor()
wpas.request("SET ext_mgmt_frame_handling 0")
dev[0].wait_connected()
wpas.dump_monitor()
def test_ap_pmf_sta_unprot_deauth_burst(dev, apdev):
"""WPA2-PSK AP with station receiving burst of unprotected Deauthentication frames"""

View file

@ -1857,8 +1857,10 @@ def _test_ap_wpa2_psk_wpas_in_bridge(dev, apdev):
subprocess.call(['iw', ifname, 'set', '4addr', 'on'])
subprocess.check_call(['brctl', 'addif', br_ifname, ifname])
wpas.interface_add(ifname, br_ifname=br_ifname)
wpas.dump_monitor()
wpas.connect(ssid, psk=passphrase, scan_freq="2412")
wpas.dump_monitor()
def test_ap_wpa2_psk_ifdown(dev, apdev):
"""AP with open mode and external ifconfig down"""

View file

@ -3475,22 +3475,26 @@ def test_ap_wps_ap_scan_2(dev, apdev):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
wpas.dump_monitor()
if "OK" not in wpas.request("AP_SCAN 2"):
raise Exception("Failed to set AP_SCAN 2")
wpas.flush_scan_cache()
wpas.scan_for_bss(apdev[0]['bssid'], freq="2412")
wpas.dump_monitor()
wpas.request("WPS_PBC " + apdev[0]['bssid'])
ev = wpas.wait_event(["WPS-SUCCESS"], timeout=15)
if ev is None:
raise Exception("WPS-SUCCESS event timed out")
wpas.wait_connected(timeout=30)
wpas.dump_monitor()
wpas.request("DISCONNECT")
wpas.request("BSS_FLUSH 0")
wpas.dump_monitor()
wpas.request("REASSOCIATE")
wpas.wait_connected(timeout=30)
wpas.dump_monitor()
def test_ap_wps_eapol_workaround(dev, apdev):
"""EAPOL workaround code path for 802.1X header length mismatch"""

View file

@ -26,7 +26,10 @@ def test_connect_cmd_open(dev, apdev):
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
wpas.connect("sta-connect", key_mgmt="NONE", scan_freq="2412",
bg_scan_period="1")
wpas.dump_monitor()
wpas.request("DISCONNECT")
wpas.wait_disconnected()
wpas.dump_monitor()
def test_connect_cmd_wep(dev, apdev):
"""WEP Open System using cfg80211 connect command"""
@ -37,8 +40,11 @@ def test_connect_cmd_wep(dev, apdev):
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
wpas.connect("sta-connect-wep", key_mgmt="NONE", scan_freq="2412",
wep_key0='"hello"')
wpas.dump_monitor()
hwsim_utils.test_connectivity(wpas, hapd)
wpas.request("DISCONNECT")
wpas.wait_disconnected()
wpas.dump_monitor()
def test_connect_cmd_wep_shared(dev, apdev):
"""WEP Shared key using cfg80211 connect command"""
@ -50,13 +56,17 @@ def test_connect_cmd_wep_shared(dev, apdev):
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
id = wpas.connect("sta-connect-wep", key_mgmt="NONE", scan_freq="2412",
auth_alg="SHARED", wep_key0='"hello"')
wpas.dump_monitor()
hwsim_utils.test_connectivity(wpas, hapd)
wpas.request("DISCONNECT")
wpas.remove_network(id)
wpas.connect("sta-connect-wep", key_mgmt="NONE", scan_freq="2412",
auth_alg="OPEN SHARED", wep_key0='"hello"')
wpas.dump_monitor()
hwsim_utils.test_connectivity(wpas, hapd)
wpas.request("DISCONNECT")
wpas.wait_disconnected()
wpas.dump_monitor()
def test_connect_cmd_p2p_management(dev, apdev):
"""Open connection using cfg80211 connect command and AP using P2P management"""
@ -68,7 +78,10 @@ def test_connect_cmd_p2p_management(dev, apdev):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
wpas.connect("sta-connect", key_mgmt="NONE", scan_freq="2412")
wpas.dump_monitor()
wpas.request("DISCONNECT")
wpas.wait_disconnected()
wpas.dump_monitor()
def test_connect_cmd_wpa2_psk(dev, apdev):
"""WPA2-PSK connection using cfg80211 connect command"""
@ -78,7 +91,10 @@ def test_connect_cmd_wpa2_psk(dev, apdev):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
wpas.connect("sta-connect", psk="12345678", scan_freq="2412")
wpas.dump_monitor()
wpas.request("DISCONNECT")
wpas.wait_disconnected()
wpas.dump_monitor()
def test_connect_cmd_concurrent_grpform_while_connecting(dev, apdev):
"""Concurrent P2P group formation while connecting to an AP using cfg80211 connect command"""
@ -88,6 +104,7 @@ def test_connect_cmd_concurrent_grpform_while_connecting(dev, apdev):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
wpas.connect("test-open", key_mgmt="NONE", wait_connect=False)
wpas.dump_monitor()
logger.info("Form a P2P group while connecting to an AP")
wpas.request("SET p2p_no_group_iface 0")
@ -96,10 +113,15 @@ def test_connect_cmd_concurrent_grpform_while_connecting(dev, apdev):
r_dev=wpas, r_freq=2412)
check_grpform_results(i_res, r_res)
remove_group(dev[0], wpas)
wpas.dump_monitor()
logger.info("Confirm AP connection after P2P group removal")
hwsim_utils.test_connectivity(wpas, hapd)
wpas.request("DISCONNECT")
wpas.wait_disconnected()
wpas.dump_monitor()
def test_connect_cmd_reject_assoc(dev, apdev):
"""Connection using cfg80211 connect command getting rejected"""
params = { "ssid": "sta-connect",
@ -119,6 +141,9 @@ def test_connect_cmd_reject_assoc(dev, apdev):
if "status_code=27" not in ev:
raise Exception("Unexpected rejection status code")
wpas.request("DISCONNECT")
wpas.dump_monitor()
def test_connect_cmd_disconnect_event(dev, apdev):
"""Connection using cfg80211 connect command getting disconnected by the AP"""
params = { "ssid": "sta-connect" }
@ -138,6 +163,7 @@ def test_connect_cmd_disconnect_event(dev, apdev):
# testing purposes. Anyway, wait some time to allow the debug log to capture
# the following NL80211_CMD_DISCONNECT event.
time.sleep(0.1)
wpas.dump_monitor()
def test_connect_cmd_roam(dev, apdev):
"""cfg80211 connect command to trigger roam"""
@ -147,7 +173,12 @@ def test_connect_cmd_roam(dev, apdev):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
wpas.connect("sta-connect", key_mgmt="NONE", scan_freq="2412")
wpas.dump_monitor()
hostapd.add_ap(apdev[1]['ifname'], params)
wpas.scan_for_bss(apdev[1]['bssid'], freq=2412, force_scan=True)
wpas.roam(apdev[1]['bssid'])
time.sleep(0.1)
wpas.request("DISCONNECT")
wpas.wait_disconnected()
wpas.dump_monitor()

View file

@ -486,6 +486,7 @@ def test_autogo_join_auto_go_not_found(dev):
autogo(wpas, freq=2412)
addr = wpas.p2p_dev_addr()
bssid = wpas.p2p_interface_addr()
wpas.dump_monitor()
dev[1].global_request("SET p2p_no_group_iface 0")
dev[1].scan_for_bss(bssid, freq=2412)
@ -496,12 +497,15 @@ def test_autogo_join_auto_go_not_found(dev):
# exchange.
if "OK" not in wpas.group_request("STOP_AP"):
raise Exception("STOP_AP failed")
wpas.dump_monitor()
wpas.group_request("SET ext_mgmt_frame_handling 1")
wpas.p2p_listen()
wpas.dump_monitor()
time.sleep(0.02)
dev[1].global_request("P2P_CONNECT " + addr + " pbc auto")
ev = dev[1].wait_global_event(["P2P-FALLBACK-TO-GO-NEG-ENABLED"], 15)
wpas.dump_monitor()
if ev is None:
raise Exception("Could not trigger old-scan-only case")
return
@ -512,6 +516,7 @@ def test_autogo_join_auto_go_not_found(dev):
raise Exception("Fallback to GO Negotiation not seen")
if "reason=GO-not-found" not in ev:
raise Exception("Unexpected reason for fallback: " + ev)
wpas.dump_monitor()
def test_autogo_join_auto(dev):
"""P2P_CONNECT-auto joining a group"""

View file

@ -348,13 +348,16 @@ def test_autogo_force_diff_channel(dev, apdev):
hapd = hostapd.add_ap(apdev[0]['ifname'],
{"ssid" : 'ap-test', "channel" : '1'})
wpas.connect("ap-test", key_mgmt = "NONE", scan_freq = "2412")
wpas.dump_monitor()
channels = { 2 : 2417, 5 : 2432, 9 : 2452 }
for key in channels:
res_go = autogo(wpas, channels[key])
wpas.dump_monitor()
hwsim_utils.test_connectivity(wpas, hapd)
if int(res_go['freq']) == 2412:
raise Exception("Group operation channel is: 2412 excepted: " + res_go['freq'])
wpas.remove_group(res_go['ifname'])
wpas.dump_monitor()
def test_go_neg_forced_freq_diff_than_bss_freq(dev, apdev):
"""P2P channel selection: GO negotiation with forced freq different than station interface"""

View file

@ -25,7 +25,9 @@ def test_p2p_device_grpform(dev, apdev):
[i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
r_dev=wpas, r_intent=0)
check_grpform_results(i_res, r_res)
wpas.dump_monitor()
remove_group(dev[0], wpas)
wpas.dump_monitor()
res = wpas.global_request("IFNAME=p2p-dev-" + iface + " STATUS-DRIVER")
lines = res.splitlines()
@ -49,7 +51,9 @@ def test_p2p_device_grpform2(dev, apdev):
[i_res, r_res] = go_neg_pin_authorized(i_dev=wpas, i_intent=15,
r_dev=dev[0], r_intent=0)
check_grpform_results(i_res, r_res)
wpas.dump_monitor()
remove_group(wpas, dev[0])
wpas.dump_monitor()
def test_p2p_device_group_remove(dev, apdev):
"""P2P group removal via the P2P ctrl interface with driver using cfg80211 P2P Device"""
@ -96,6 +100,7 @@ def test_p2p_device_nfc_invite(dev, apdev):
res = wpas.global_request("P2P_LISTEN")
if "FAIL" in res:
raise Exception("Failed to start Listen mode")
wpas.dump_monitor()
pw = wpas.global_request("WPS_NFC_TOKEN NDEF").rstrip()
if "FAIL" in pw:
raise Exception("Failed to generate password token")
@ -105,6 +110,7 @@ def test_p2p_device_nfc_invite(dev, apdev):
sel = wpas.global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG").rstrip()
if "FAIL" in sel:
raise Exception("Failed to generate NFC connection handover select")
wpas.dump_monitor()
logger.info("Read NFC Tag on the GO to trigger invitation")
res = dev[0].global_request("WPS_NFC_TAG_READ " + sel)
@ -115,8 +121,10 @@ def test_p2p_device_nfc_invite(dev, apdev):
if ev is None:
raise Exception("Joining the group timed out")
res = wpas.group_form_result(ev)
wpas.dump_monitor()
hwsim_utils.test_connectivity_p2p(dev[0], wpas)
check_ip_addr(res)
wpas.dump_monitor()
def test_p2p_device_misuses(dev, apdev):
"""cfg80211 P2P Device misuses"""
@ -189,11 +197,13 @@ def test_p2p_device_incorrect_command_interface(dev, apdev):
ev = wpas.wait_event(["P2P-DEVICE-FOUND"], timeout=0.1)
if ev is not None:
raise Exception("Unexpected P2P-DEVICE-FOUND event on station interface")
wpas.dump_monitor()
pin = wpas.wps_read_pin()
dev[0].p2p_go_neg_auth(wpas.p2p_dev_addr(), pin, "enter", go_intent=14,
freq=2412)
wpas.request('P2P_STOP_FIND')
wpas.dump_monitor()
if "OK" not in wpas.request('P2P_CONNECT ' + dev[0].p2p_dev_addr() + ' ' + pin + ' display go_intent=1'):
raise Exception("P2P_CONNECT failed")
@ -201,6 +211,7 @@ def test_p2p_device_incorrect_command_interface(dev, apdev):
if ev is None:
raise Exception("Group formation timed out")
wpas.group_form_result(ev)
wpas.dump_monitor()
ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=15)
if ev is None:
@ -209,6 +220,7 @@ def test_p2p_device_incorrect_command_interface(dev, apdev):
dev[0].remove_group()
wpas.wait_go_ending_session()
wpas.dump_monitor()
def test_p2p_device_incorrect_command_interface2(dev, apdev):
"""cfg80211 P2P Device and P2P_GROUP_ADD command on incorrect interface"""
@ -216,12 +228,15 @@ def test_p2p_device_incorrect_command_interface2(dev, apdev):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add(iface)
print wpas.request('P2P_GROUP_ADD')
if "OK" not in wpas.request('P2P_GROUP_ADD'):
raise Exception("P2P_GROUP_ADD failed")
ev = wpas.wait_global_event(["P2P-GROUP-STARTED"], timeout=15)
if ev is None:
raise Exception("Group formation timed out")
res = wpas.group_form_result(ev)
wpas.dump_monitor()
logger.info("Group results: " + str(res))
wpas.remove_group()
if not res['ifname'].startswith('p2p-' + iface + '-'):
raise Exception("Unexpected group ifname: " + res['ifname'])
wpas.dump_monitor()