[RFC 3/3] tests: Test two mesh nodes connecting with h2e anti-clogging

Nicolas Cavallari nicolas.cavallari at green-communications.fr
Thu Sep 18 08:31:40 PDT 2025


Signed-off-by: Nicolas Cavallari <nicolas.cavallari at green-communications.fr>
---
While this test works with hwsim, it fails 99% of the time on real
hardware, because nodes are almost never detected at the same time.
This is not specific to h2e.  What happens is as follows:

* node A detects node B, sends a Commit and goes to state Committed
* node B drops the Commit since node A is not yet known
* node B finally detects node A, sends a Commit and goes to state
  Committed
* node A rejects the Commit with an anti-clogging token request and goes
  to state Nothing
* node B receives the token request, resends the Commit+token and
  goes to state Committed.
* node A accepts the Commit+token, sends a Commit and a Confirm and goes
  to state Confirmed.
* node B rejects the Commit with an anti-clogging token request and goes
  to state Nothing (!)
* node B drops the Confirm in state Nothing
* node A receives the token request, resends the Commit+token and goes
  to state Committed (!)
* node B accepts the Commit+token, sends a Commit+reused token and a
  Confirm and goes into state Confirmed (!)
* node A drops the Commit with a reused token
* node A receives the Confirm in state Committed and sends a
  Commit+reused token (!)
* node B drops the Commit with a reused token
* Everything is stalled.
* When node A's retransmit timer fires, it resends a Commit with a
  reused token which will be dropped by node B.
* When node B's retransmit timer fires, it resends a Confirm, causing
  node A to resend a Commit with a reused token which will be dropped by
  node B.

As implemented, the protocol seems unsound and cannot guarantee forward
progress in the event of packet losses.
---
 tests/hwsim/test_wpas_mesh.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py
index 1aa3b5c17..bfec1afa2 100644
--- a/tests/hwsim/test_wpas_mesh.py
+++ b/tests/hwsim/test_wpas_mesh.py
@@ -2555,6 +2555,24 @@ def run_mesh_sae_anti_clogging(dev, apdev):
     check_mesh_peer_connected(dev[2])
     check_mesh_peer_connected(dev[0])
 
+def test_mesh_h2e_anti_clogging(dev, apdev):
+    """Mesh using SAE H2E and anti-clogging"""
+    check_mesh_support(dev[0], secure=True)
+    check_mesh_support(dev[1], secure=True)
+    dev[0].request("SET sae_groups ")
+    id0 = add_mesh_secure_net(dev[0])
+    dev[0].set_network(id0, "sae_pwe", "1")
+    dev[0].set_network(id0, "anti_clogging_threshold", "0")
+    dev[0].mesh_group_add(id0)
+
+    dev[1].request("SET sae_groups ")
+    id1 = add_mesh_secure_net(dev[1])
+    dev[1].set_network(id1, "sae_pwe", "1")
+    dev[1].set_network(id1, "anti_clogging_threshold", "0")
+    dev[1].mesh_group_add(id1)
+
+    check_mesh_joined_connected(dev)
+
 def test_mesh_link_probe(dev, apdev, params):
     """Mesh link probing"""
     addr0 = dev[0].own_addr()
-- 
2.51.0




More information about the Hostap mailing list