[PATCH 2/3] tests: Insert sleep after DATA_TEST_FRAME where needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Benjamin Berg <benjamin.berg@xxxxxxxxx>

If the frame is not fully processed the neighbor entries of the bridge
will not yet be updated. Add a sleep to ensure that the tests are not
racy.

Signed-off-by: Benjamin Berg <benjamin.berg@xxxxxxxxx>
---
 tests/hwsim/test_ap_hs20.py     | 13 +++++++++++--
 tests/hwsim/test_hs20_filter.py |  6 ++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py
index 35cb0b8fe9..8b6359113e 100644
--- a/tests/hwsim/test_ap_hs20.py
+++ b/tests/hwsim/test_ap_hs20.py
@@ -4357,16 +4357,19 @@ def _test_ap_hs20_proxyarp(dev, apdev):
     if "OK" not in dev[1].request("DATA_TEST_FRAME " + binascii.hexlify(pkt).decode()):
         raise Exception("DATA_TEST_FRAME failed")
 
+    # Wait for frames to be processed
+    time.sleep(0.1)
+
     matches = get_permanent_neighbors("ap-br0")
     logger.info("After connect: " + str(matches))
-    if len(matches) != 3:
-        raise Exception("Unexpected number of neighbor entries after connect")
     if 'aaaa:bbbb:cccc::2 dev ap-br0 lladdr 02:00:00:00:00:00 PERMANENT' not in matches:
         raise Exception("dev0 addr missing")
     if 'aaaa:bbbb:dddd::2 dev ap-br0 lladdr 02:00:00:00:01:00 PERMANENT' not in matches:
         raise Exception("dev1 addr(1) missing")
     if 'aaaa:bbbb:eeee::2 dev ap-br0 lladdr 02:00:00:00:01:00 PERMANENT' not in matches:
         raise Exception("dev1 addr(2) missing")
+    if len(matches) != 3:
+        raise Exception("Unexpected number of neighbor entries after connect")
     dev[0].request("DISCONNECT")
     dev[1].request("DISCONNECT")
     time.sleep(0.5)
@@ -4489,6 +4492,9 @@ def _test_ap_hs20_proxyarp_dgaf(dev, apdev, disabled):
     if "OK" not in hapd.request("DATA_TEST_FRAME ifname=ap-br0 " + binascii.hexlify(pkt).decode()):
         raise Exception("DATA_TEST_FRAME failed")
 
+    # Wait for frames to be processed
+    time.sleep(0.1)
+
     matches = get_permanent_neighbors("ap-br0")
     logger.info("After connect: " + str(matches))
     if len(matches) != 2:
@@ -4949,6 +4955,9 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
     if "OK" not in hapd.request("DATA_TEST_FRAME ifname=ap-br0 " + binascii.hexlify(pkt).decode()):
         raise Exception("DATA_TEST_FRAME failed")
 
+    # Wait for frames to be processed
+    time.sleep(0.1)
+
     macs = get_bridge_macs("ap-br0")
     logger.info("After connect (showmacs): " + str(macs))
 
diff --git a/tests/hwsim/test_hs20_filter.py b/tests/hwsim/test_hs20_filter.py
index 11cf347563..b916da567e 100644
--- a/tests/hwsim/test_hs20_filter.py
+++ b/tests/hwsim/test_hs20_filter.py
@@ -172,6 +172,9 @@ def test_ip4_drop_gratuitous_arp(devs, apdevs, params):
             if "OK" not in hapd.request('DATA_TEST_FRAME ' + pkt):
                 raise Exception("DATA_TEST_FRAME failed")
 
+            # Wait for frames to be processed
+            time.sleep(0.1)
+
             if hapd.own_addr() in subprocess.check_output(['ip', 'neigh', 'show']).decode():
                 raise Exception("gratuitous ARP frame updated erroneously")
         finally:
@@ -199,6 +202,9 @@ def test_ip6_drop_unsolicited_na(devs, apdevs, params):
             if "OK" not in hapd.request('DATA_TEST_FRAME ' + pkt):
                 raise Exception("DATA_TEST_FRAME failed")
 
+            # Wait for frames to be processed
+            time.sleep(0.1)
+
             if hapd.own_addr() in subprocess.check_output(['ip', 'neigh', 'show']).decode():
                 raise Exception("unsolicited NA frame updated erroneously")
         finally:
-- 
2.46.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux