X-Git-Url: http://www.project-moonshot.org/gitweb/?p=mech_eap.git;a=blobdiff_plain;f=libeap%2Ftests%2Fhwsim%2Ftest_cfg80211.py;h=b212961403dada25e6d228163d7d63e840058c95;hp=e67ad987526bb1f2010f90bf98986319357d9317;hb=d1dd9aae6741e74f20bfc35e1db598652680279d;hpb=bd3bd69af16ab99706ba70ed11a3e291e968e5c6 diff --git a/libeap/tests/hwsim/test_cfg80211.py b/libeap/tests/hwsim/test_cfg80211.py index e67ad98..b212961 100644 --- a/libeap/tests/hwsim/test_cfg80211.py +++ b/libeap/tests/hwsim/test_cfg80211.py @@ -4,17 +4,18 @@ # This software may be distributed under the terms of the BSD license. # See README for more details. +from remotehost import remote_compatible import logging logger = logging.getLogger() import binascii import os -import subprocess import time import hostapd import hwsim_utils from tshark import run_tshark from nl80211 import * +from wpasupplicant import WpaSupplicant def nl80211_command(dev, cmd, attr): res = dev.request("VENDOR ffffffff {} {}".format(nl80211_cmd[cmd], @@ -23,9 +24,10 @@ def nl80211_command(dev, cmd, attr): raise Exception("nl80211 command failed") return binascii.unhexlify(res) +@remote_compatible def test_cfg80211_disassociate(dev, apdev): """cfg80211 disassociation command""" - hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" }) + hapd = hostapd.add_ap(apdev[0], { "ssid": "open" }) dev[0].connect("open", key_mgmt="NONE", scan_freq="2412") ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5) if ev is None: @@ -65,12 +67,12 @@ def nl80211_remain_on_channel(dev, ifindex, freq, duration): def test_cfg80211_tx_frame(dev, apdev, params): """cfg80211 offchannel TX frame command""" - ifindex = int(dev[0].get_driver_status_field("ifindex")) - - frame = binascii.unhexlify("d000000002000000010002000000000002000000010000000409506f9a090001dd5e506f9a0902020025080401001f0502006414060500585804510b0906000200000000000b1000585804510b0102030405060708090a0b0d1d000200000000000108000000000000000000101100084465766963652041110500585804510bdd190050f204104a0001101012000200011049000600372a000120") - dev[0].request("P2P_GROUP_ADD freq=2412") - res = nl80211_frame(dev[0], ifindex, frame, freq=2422, duration=500, + dev[0].p2p_start_go(freq='2412') + go = WpaSupplicant(dev[0].group_ifname) + frame = binascii.unhexlify("d0000000020000000100" + go.own_addr().translate(None, ':') + "02000000010000000409506f9a090001dd5e506f9a0902020025080401001f0502006414060500585804510b0906000200000000000b1000585804510b0102030405060708090a0b0d1d000200000000000108000000000000000000101100084465766963652041110500585804510bdd190050f204104a0001101012000200011049000600372a000120") + ifindex = int(go.get_driver_status_field("ifindex")) + res = nl80211_frame(go, ifindex, frame, freq=2422, duration=500, offchannel_tx_ok=True) time.sleep(0.1) @@ -78,11 +80,13 @@ def test_cfg80211_tx_frame(dev, apdev, params): #nl80211_frame_wait_cancel(dev[0], ifindex, res[nl80211_attr['COOKIE']]) # note: this Action frame ends up getting sent incorrectly on 2422 MHz - nl80211_frame(dev[0], ifindex, frame, freq=2412) + nl80211_frame(go, ifindex, frame, freq=2412) time.sleep(1.5) # note: also the Deauthenticate frame sent by the GO going down ends up # being transmitted incorrectly on 2422 MHz. + del go + out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"), "wlan.fc.type_subtype == 13", ["radiotap.channel.freq"]) if out is not None: @@ -94,9 +98,10 @@ def test_cfg80211_tx_frame(dev, apdev, params): if freq[1] != "2412": raise Exception("Second Action frame on unexpected channel: %s MHz" % freq[1]) +@remote_compatible def test_cfg80211_wep_key_idx_change(dev, apdev): """WEP Shared Key authentication and key index change without deauth""" - hapd = hostapd.add_ap(apdev[0]['ifname'], + hapd = hostapd.add_ap(apdev[0], { "ssid": "wep-shared-key", "wep_key0": '"hello12345678"', "wep_key1": '"other12345678"', @@ -123,9 +128,10 @@ def test_cfg80211_wep_key_idx_change(dev, apdev): dev[0].wait_connected(timeout=10, error="Reassociation timed out") hwsim_utils.test_connectivity(dev[0], hapd) +@remote_compatible def test_cfg80211_hostapd_ext_sta_remove(dev, apdev): """cfg80211 DEL_STATION issued externally to hostapd""" - hapd = hostapd.add_ap(apdev[0]['ifname'], + hapd = hostapd.add_ap(apdev[0], { "ssid": "open" }) id = dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")