tests: Add SA Query test with PMF

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-03-30 15:31:50 +02:00
parent 835a546b20
commit 5b06bdf795
2 changed files with 17 additions and 0 deletions

View file

@ -32,9 +32,19 @@ def test_ap_pmf_required(dev):
hwsim_utils.test_connectivity(dev[0].ifname, ap_ifname) hwsim_utils.test_connectivity(dev[0].ifname, ap_ifname)
dev[1].connect(ssid, psk="12345678", ieee80211w="2", key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2") dev[1].connect(ssid, psk="12345678", ieee80211w="2", key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2")
hwsim_utils.test_connectivity(dev[1].ifname, ap_ifname) hwsim_utils.test_connectivity(dev[1].ifname, ap_ifname)
hapd = hostapd.Hostapd(ap_ifname)
hapd.request("SA_QUERY " + dev[0].p2p_interface_addr())
hapd.request("SA_QUERY " + dev[1].p2p_interface_addr())
wt.require_ap_pmf_mandatory(bssid) wt.require_ap_pmf_mandatory(bssid)
wt.require_sta_pmf(bssid, dev[0].p2p_interface_addr()) wt.require_sta_pmf(bssid, dev[0].p2p_interface_addr())
wt.require_sta_pmf_mandatory(bssid, dev[1].p2p_interface_addr()) wt.require_sta_pmf_mandatory(bssid, dev[1].p2p_interface_addr())
time.sleep(0.1)
if wt.get_sta_counter("valid_saqueryresp_tx", bssid,
dev[0].p2p_interface_addr()) < 1:
raise Exception("STA did not reply to SA Query")
if wt.get_sta_counter("valid_saqueryresp_tx", bssid,
dev[1].p2p_interface_addr()) < 1:
raise Exception("STA did not reply to SA Query")
def test_ap_pmf_optional(dev): def test_ap_pmf_optional(dev):
"""WPA2-PSK AP with PMF optional""" """WPA2-PSK AP with PMF optional"""

View file

@ -45,6 +45,13 @@ class Wlantest:
raise Exception("Could not get STA info from wlantest for " + addr) raise Exception("Could not get STA info from wlantest for " + addr)
return res return res
def get_sta_counter(self, field, bssid, addr):
res = subprocess.check_output([wlantest_cli, "get_sta_counter", field,
bssid, addr]);
if "FAIL" in res:
raise Exception("wlantest_cli command failed")
return int(res)
def tdls_clear(self, bssid, addr1, addr2): def tdls_clear(self, bssid, addr1, addr2):
subprocess.call([wlantest_cli, "clear_tdls_counters", bssid, addr1, subprocess.call([wlantest_cli, "clear_tdls_counters", bssid, addr1,
addr2]); addr2]);