aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2017-02-05 15:11:29 (GMT)
committerJouni Malinen <j@w1.fi>2017-02-05 15:19:44 (GMT)
commiteb04c3bf8ab404cafc1160e073f66754996dedce (patch)
treec55848eb97ea5817c8220815136b9b876d33eb45
parent95497a5fc1f860aff802170a8ef9222b22611acb (diff)
downloadhostap-eb04c3bf8ab404cafc1160e073f66754996dedce.zip
hostap-eb04c3bf8ab404cafc1160e073f66754996dedce.tar.gz
hostap-eb04c3bf8ab404cafc1160e073f66754996dedce.tar.bz2
tests: RADIUS Accounting local failure cases
Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--tests/hwsim/test_radius.py49
1 files changed, 48 insertions, 1 deletions
diff --git a/tests/hwsim/test_radius.py b/tests/hwsim/test_radius.py
index e47e3e0..d628510 100644
--- a/tests/hwsim/test_radius.py
+++ b/tests/hwsim/test_radius.py
@@ -18,7 +18,7 @@ import threading
import time
import hostapd
-from utils import HwsimSkip, require_under_vm, skip_with_fips, fail_test
+from utils import HwsimSkip, require_under_vm, skip_with_fips, alloc_fail, fail_test, wait_fail_trigger
from test_ap_hs20 import build_dhcp_ack
from test_ap_ft import ft_params1
@@ -1421,3 +1421,50 @@ def test_radius_mppe_failure(dev, apdev):
wait_connect=False, scan_freq="2412")
dev[0].wait_disconnected()
dev[0].request("REMOVE_NETWORK all")
+
+def test_radius_acct_failure(dev, apdev):
+ """RADIUS Accounting and failure to add attributes"""
+ # Connection goes through, but Accounting-Request cannot be sent out due to
+ # NAS-Identifier being too long to fit into a RADIUS attribute.
+ params = { "ssid": "radius-acct-open",
+ 'acct_server_addr': "127.0.0.1",
+ 'acct_server_port': "1813",
+ 'acct_server_shared_secret': "radius",
+ 'nas_identifier': 255*'A' }
+ hapd = hostapd.add_ap(apdev[0], params)
+ dev[0].connect("radius-acct-open", key_mgmt="NONE", scan_freq="2412")
+
+def test_radius_acct_failure_oom(dev, apdev):
+ """RADIUS Accounting and failure to add attributes due to OOM"""
+ params = { "ssid": "radius-acct-open",
+ 'acct_server_addr': "127.0.0.1",
+ 'acct_server_port': "1813",
+ 'acct_server_shared_secret': "radius",
+ 'radius_acct_interim_interval': "1",
+ 'nas_identifier': 250*'A',
+ 'radius_acct_req_attr': [ "126:s:" + 250*'B',
+ "77:s:" + 250*'C',
+ "127:s:" + 250*'D',
+ "181:s:" + 250*'E' ] }
+ hapd = hostapd.add_ap(apdev[0], params)
+
+ with alloc_fail(hapd, 1, "radius_msg_add_attr;=accounting_msg"):
+ dev[0].connect("radius-acct-open", key_mgmt="NONE", scan_freq="2412")
+ wait_fail_trigger(hapd, "GET_ALLOC_FAIL")
+
+ with alloc_fail(hapd, 1, "accounting_sta_report"):
+ dev[1].connect("radius-acct-open", key_mgmt="NONE", scan_freq="2412")
+ wait_fail_trigger(hapd, "GET_ALLOC_FAIL")
+
+def test_radius_acct_failure_sta_data(dev, apdev):
+ """RADIUS Accounting and failure to get STA data"""
+ params = { "ssid": "radius-acct-open",
+ 'acct_server_addr': "127.0.0.1",
+ 'acct_server_port': "1813",
+ 'acct_server_shared_secret': "radius" }
+ hapd = hostapd.add_ap(apdev[0], params)
+
+ with fail_test(hapd, 1, "accounting_sta_update_stats"):
+ dev[0].connect("radius-acct-open", key_mgmt="NONE", scan_freq="2412")
+ dev[0].request("DISCONNECT")
+ dev[0].wait_disconnected()