Browse Source

tests: hostapd DUP_NETWORK error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 8 years ago
parent
commit
ea173088c7
1 changed files with 13 additions and 1 deletions
  1. 13 1
      tests/hwsim/test_hapd_ctrl.py

+ 13 - 1
tests/hwsim/test_hapd_ctrl.py

@@ -494,7 +494,7 @@ def dup_network(hapd_global, src, dst, param):
                                                                   dst))
 
 def test_hapd_dup_network_global_wpa2(dev, apdev):
-    """hostapd and DUP_NETWORK command (WPA2"""
+    """hostapd and DUP_NETWORK command (WPA2)"""
     passphrase="12345678"
     src_ssid = "hapd-ctrl-src"
     dst_ssid = "hapd-ctrl-dst"
@@ -520,6 +520,18 @@ def test_hapd_dup_network_global_wpa2(dev, apdev):
     if "FAIL" in dst_hapd.request("STA " + addr):
             raise Exception("Could not connect using duplicated wpa params")
 
+    tests = [ "a",
+              "no-such-ifname no-such-ifname",
+              src_ifname + " no-such-ifname",
+              src_ifname + " no-such-ifname no-such-param",
+              src_ifname + " " + dst_ifname + " no-such-param" ]
+    for t in tests:
+        if "FAIL" not in hapd_global.request("DUP_NETWORK " + t):
+            raise Exception("Invalid DUP_NETWORK accepted: " + t)
+    with alloc_fail(src_hapd, 1, "hostapd_ctrl_iface_dup_param"):
+        if "FAIL" not in hapd_global.request("DUP_NETWORK %s %s wpa" % (src_ifname, dst_ifname)):
+            raise Exception("DUP_NETWORK accepted during OOM")
+
 def test_hapd_dup_network_global_wpa(dev, apdev):
     """hostapd and DUP_NETWORK command (WPA)"""
     skip_with_fips(dev[0])