diff options
author | Bob Copeland <me@bobcopeland.com> | 2016-02-28 01:51:25 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2016-03-07 09:05:22 (GMT) |
commit | fa7f9570f236949beeb5282b1380bbbfa133f3d9 (patch) | |
tree | 6c98d340d6c30a88e8f249a466339a98c1053af2 | |
parent | dbd183c717a0f2594a4ace11b4b69a915f060d49 (diff) | |
download | hostap-fa7f9570f236949beeb5282b1380bbbfa133f3d9.zip hostap-fa7f9570f236949beeb5282b1380bbbfa133f3d9.tar.gz hostap-fa7f9570f236949beeb5282b1380bbbfa133f3d9.tar.bz2 |
tests: Add a test for mesh gate forwarding
This test checks that mesh nodes forward frames for unknown
destinations to the mesh gates.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
-rw-r--r-- | tests/hwsim/test_wpas_mesh.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py index a05f686..7f9cd83 100644 --- a/tests/hwsim/test_wpas_mesh.py +++ b/tests/hwsim/test_wpas_mesh.py @@ -8,11 +8,14 @@ import logging logger = logging.getLogger() +import os import subprocess +import time import hwsim_utils from wpasupplicant import WpaSupplicant from utils import HwsimSkip, alloc_fail +from tshark import run_tshark def check_mesh_support(dev, secure=False): if "MESH" not in dev.get_capability("modes"): @@ -699,3 +702,51 @@ def _test_wpas_mesh_reconnect(dev): check_mesh_peer_connected(dev[1]) dev[0].dump_monitor() dev[1].dump_monitor() + +def test_wpas_mesh_gate_forwarding(dev, apdev, p): + """Mesh forwards traffic to unknown sta to mesh gates""" + addr0 = dev[0].own_addr() + addr1 = dev[1].own_addr() + addr2 = dev[2].own_addr() + external_sta = '02:11:22:33:44:55' + + # start 3 node connected mesh + check_mesh_support(dev[0]) + for i in range(3): + add_open_mesh_network(dev[i]) + check_mesh_group_added(dev[i]) + for i in range(3): + check_mesh_peer_connected(dev[i]) + + hwsim_utils.test_connectivity(dev[0], dev[1]) + hwsim_utils.test_connectivity(dev[1], dev[2]) + hwsim_utils.test_connectivity(dev[0], dev[2]) + + # dev0 and dev1 are mesh gates + subprocess.call(['iw', 'dev', dev[0].ifname, 'set', 'mesh_param', + 'mesh_gate_announcements=1']) + subprocess.call(['iw', 'dev', dev[1].ifname, 'set', 'mesh_param', + 'mesh_gate_announcements=1']) + + # wait for gate announcement frames + time.sleep(1) + + # data frame from dev2 -> external sta should be sent to both gates + dev[2].request("DATA_TEST_CONFIG 1") + dev[2].request("DATA_TEST_TX {} {} 0".format(external_sta, addr2)) + dev[2].request("DATA_TEST_CONFIG 0") + + capfile = os.path.join(p['logdir'], "hwsim0.pcapng") + filt = "wlan.sa==%s && wlan_mgt.fixed.mesh_addr5==%s" % (addr2, + external_sta) + for i in range(15): + da = run_tshark(capfile, filt, [ "wlan.da" ]) + if addr0 in da and addr1 in da: + logger.debug("Frames seen in tshark iteration %d" % i) + break + time.sleep(0.3) + + if addr0 not in da: + raise Exception("Frame to gate %s not observed" % addr0) + if addr1 not in da: + raise Exception("Frame to gate %s not observed" % addr1) |