aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-10-19 17:55:02 (GMT)
committerJouni Malinen <j@w1.fi>2014-10-19 19:27:37 (GMT)
commitf6420942cb18c478c4ed8c14733bcdd3bbc8f01f (patch)
tree782727a54b429325616e8114c0e56fa1bcb92caf /tests
parent4a6cc86272ec8367d934e06d7be1c74d3ea02255 (diff)
downloadhostap-f6420942cb18c478c4ed8c14733bcdd3bbc8f01f.zip
hostap-f6420942cb18c478c4ed8c14733bcdd3bbc8f01f.tar.gz
hostap-f6420942cb18c478c4ed8c14733bcdd3bbc8f01f.tar.bz2
tests: Add own_addr() for both Hostapd and WpaSupplicant classes
This makes it easier to use instances of control interfaces in common code without having to separately address hostapd and wpa_supplicant behavior differences. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/hostapd.py6
-rw-r--r--tests/hwsim/wpasupplicant.py7
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index 97672aa..83defb0 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -54,6 +54,12 @@ class Hostapd:
self.ctrl = wpaspy.Ctrl(os.path.join(hapd_ctrl, ifname))
self.mon = wpaspy.Ctrl(os.path.join(hapd_ctrl, ifname))
self.mon.attach()
+ self.bssid = None
+
+ def own_addr(self):
+ if self.bssid is None:
+ self.bssid = self.get_status_field('bssid[0]')
+ return self.bssid
def request(self, cmd):
logger.debug(self.ifname + ": CTRL: " + cmd)
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index c58f137..da677ce 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -335,6 +335,13 @@ class WpaSupplicant:
def p2p_interface_addr(self):
return self.get_group_status_field("address")
+ def own_addr(self):
+ try:
+ res = self.p2p_interface_addr()
+ except:
+ res = self.p2p_dev_addr()
+ return res
+
def p2p_listen(self):
return self.global_request("P2P_LISTEN")