]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Static MAC ACL
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 13 Mar 2014 21:27:11 +0000 (23:27 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 13 Mar 2014 21:27:11 +0000 (23:27 +0200)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/hostapd.macaddr [new file with mode: 0644]
tests/hwsim/test_ap_params.py

diff --git a/tests/hwsim/hostapd.macaddr b/tests/hwsim/hostapd.macaddr
new file mode 100644 (file)
index 0000000..7fa42cd
--- /dev/null
@@ -0,0 +1 @@
+02:00:00:00:00:00
index 0c09544bc8e416841f50dfe9733655a801d34070..af085064d8149bf03ed615e1214e6e342d176b42 100644 (file)
@@ -71,3 +71,35 @@ def test_ap_country(dev, apdev):
         hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
     finally:
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+
+def test_ap_acl_accept(dev, apdev):
+    """MAC ACL accept list"""
+    ssid = "acl"
+    params = {}
+    params['ssid'] = ssid
+    params['accept_mac_file'] = "hostapd.macaddr"
+    hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+    dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
+    dev[1].connect(ssid, key_mgmt="NONE", scan_freq="2412")
+    dev[0].request("REMOVE_NETWORK all")
+    dev[1].request("REMOVE_NETWORK all")
+    hapd.request("SET macaddr_acl 1")
+    dev[1].dump_monitor()
+    dev[1].connect(ssid, key_mgmt="NONE", scan_freq="2412", wait_connect=False)
+    dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
+    ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
+    if ev is not None:
+        raise Exception("Unexpected association")
+
+def test_ap_acl_deny(dev, apdev):
+    """MAC ACL deny list"""
+    ssid = "acl"
+    params = {}
+    params['ssid'] = ssid
+    params['deny_mac_file'] = "hostapd.macaddr"
+    hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+    dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412", wait_connect=False)
+    dev[1].connect(ssid, key_mgmt="NONE", scan_freq="2412")
+    ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
+    if ev is not None:
+        raise Exception("Unexpected association")