]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Verify hostapd mgmt_tx() success
authorJouni Malinen <j@w1.fi>
Sun, 18 Dec 2016 10:22:13 +0000 (12:22 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 18 Dec 2016 11:01:49 +0000 (13:01 +0200)
Raise an exception if MGMT_TX command to hostapd fails. Previously, such
errors were ignored silently.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/hostapd.py

index 51ad02e179de5b9990b98506151f8eb39b66b898..5c583a22a28b2d3df210811c905d90e3c138a00e 100644 (file)
@@ -326,7 +326,8 @@ class Hostapd:
     def mgmt_tx(self, msg):
         t = (msg['fc'], 0) + mac2tuple(msg['da']) + mac2tuple(msg['sa']) + mac2tuple(msg['bssid']) + (0,)
         hdr = struct.pack('<HH6B6B6BH', *t)
-        self.request("MGMT_TX " + binascii.hexlify(hdr + msg['payload']))
+        if "OK" not in self.request("MGMT_TX " + binascii.hexlify(hdr + msg['payload'])):
+            raise Exception("MGMT_TX command to hostapd failed")
 
     def get_sta(self, addr, info=None, next=False):
         cmd = "STA-NEXT " if next else "STA "