]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Add own_addr() for both Hostapd and WpaSupplicant classes
authorJouni Malinen <j@w1.fi>
Sun, 19 Oct 2014 17:55:02 +0000 (20:55 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 19 Oct 2014 19:27:37 +0000 (22:27 +0300)
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>
tests/hwsim/hostapd.py
tests/hwsim/wpasupplicant.py

index 97672aa2eb4c86c341c94d64da44b387317d9cd8..83defb08ecd5ace38b744e0d9f7d658e9d4c769f 100644 (file)
@@ -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)
index c58f1377af50d2112ed2560e945e8da1ed6acc10..da677cebbe7c1697076ccf62c1d906b58319e155 100644 (file)
@@ -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")