aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2015-01-29 14:26:31 (GMT)
committerJouni Malinen <j@w1.fi>2015-01-29 14:26:31 (GMT)
commit2c528e9690457e35dfadcdcdc79f4ccda635ed32 (patch)
tree1af2241148e5136640d33b85bc72f26603bd2a9e
parent4a4cd04cad80ae0811afab26563ca2522e503e7e (diff)
downloadhostap-2c528e9690457e35dfadcdcdc79f4ccda635ed32.zip
hostap-2c528e9690457e35dfadcdcdc79f4ccda635ed32.tar.gz
hostap-2c528e9690457e35dfadcdcdc79f4ccda635ed32.tar.bz2
tests: cfg80211 DEL_STATION issued externally to hostapd
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
-rw-r--r--tests/hwsim/nl80211.py3
-rw-r--r--tests/hwsim/test_cfg80211.py19
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/hwsim/nl80211.py b/tests/hwsim/nl80211.py
index 1abd701..440c820 100644
--- a/tests/hwsim/nl80211.py
+++ b/tests/hwsim/nl80211.py
@@ -328,6 +328,9 @@ def build_nl80211_attr_u32(id, val):
def build_nl80211_attr_u16(id, val):
return build_nl80211_attr(id, struct.pack("@HH", val, 0))
+def build_nl80211_attr_u8(id, val):
+ return build_nl80211_attr(id, struct.pack("@4B", val, 0, 0, 0))
+
def build_nl80211_attr_flag(id):
return build_nl80211_attr(id, '')
diff --git a/tests/hwsim/test_cfg80211.py b/tests/hwsim/test_cfg80211.py
index 36e8ad9..e67ad98 100644
--- a/tests/hwsim/test_cfg80211.py
+++ b/tests/hwsim/test_cfg80211.py
@@ -122,3 +122,22 @@ def test_cfg80211_wep_key_idx_change(dev, apdev):
# the previous command results in deauth event followed by auto-reconnect
dev[0].wait_connected(timeout=10, error="Reassociation timed out")
hwsim_utils.test_connectivity(dev[0], hapd)
+
+def test_cfg80211_hostapd_ext_sta_remove(dev, apdev):
+ """cfg80211 DEL_STATION issued externally to hostapd"""
+ hapd = hostapd.add_ap(apdev[0]['ifname'],
+ { "ssid": "open" })
+ id = dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
+
+ ifindex = int(hapd.get_driver_status_field("ifindex"))
+ attrs = build_nl80211_attr_u32('IFINDEX', ifindex)
+ attrs += build_nl80211_attr_u16('REASON_CODE', 1)
+ attrs += build_nl80211_attr_u8('MGMT_SUBTYPE', 12)
+ attrs += build_nl80211_attr_mac('MAC', dev[0].own_addr())
+ nl80211_command(hapd, 'DEL_STATION', attrs)
+
+ # Currently, hostapd ignores the NL80211_CMD_DEL_STATION event if
+ # drv->device_ap_sme == 0 (which is the case with mac80211_hwsim), so no
+ # further action happens here. If that event were to be used to remove the
+ # STA entry from hostapd even in device_ap_sme == 0 case, this test case
+ # could be extended to cover additional operations.