From 6f7b96145f8354b9ef9831d75710e7bdea1313e8 Mon Sep 17 00:00:00 2001 From: Anton Nayshtut Date: Mon, 22 Jun 2015 11:27:13 +0300 Subject: [PATCH] tests: hostapd global-to-local control interface redirection This implements basic global-to-local control interface command redirection tests. Signed-off-by: Jouni Malinen --- tests/hwsim/hostapd.py | 3 +++ tests/hwsim/test_hapd_ctrl.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py index 69eeb1d34..c8df67923 100644 --- a/tests/hwsim/hostapd.py +++ b/tests/hwsim/hostapd.py @@ -44,6 +44,9 @@ class HostapdGlobal: break return None + def request(self, cmd): + return self.ctrl.request(cmd) + def add(self, ifname): res = self.ctrl.request("ADD " + ifname + " " + hapd_ctrl) if not "OK" in res: diff --git a/tests/hwsim/test_hapd_ctrl.py b/tests/hwsim/test_hapd_ctrl.py index da2c27019..d176641fc 100644 --- a/tests/hwsim/test_hapd_ctrl.py +++ b/tests/hwsim/test_hapd_ctrl.py @@ -435,3 +435,17 @@ def test_hapd_ctrl_set_error_cases(dev, apdev): for e in no_err: if "OK" not in hapd.request("SET " + e): raise Exception("Unexpected SET failure: '%s'" % e) + +def test_hapd_ctrl_global(dev, apdev): + """hostapd and GET ctrl_iface command""" + ssid = "hapd-ctrl" + params = { "ssid": ssid } + ifname = apdev[0]['ifname'] + hapd = hostapd.add_ap(ifname, params) + hapd_global = hostapd.HostapdGlobal() + res = hapd_global.request("IFNAME=" + ifname + " PING") + if "PONG" not in res: + raise Exception("Could not ping hostapd interface " + ifname + " via global control interface") + res = hapd_global.request("IFNAME=" + ifname + " GET version") + if "FAIL" in res: + raise Exception("Could not get hostapd version for " + ifname + " via global control interface")