From e4d1000cacea72a5d4befcd93528d31466ee7255 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 13 Feb 2023 23:17:08 +0200 Subject: [PATCH] tests: Verify hostapd STA vlan_id value Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_ft.py | 14 ++++++++++++++ tests/hwsim/test_ap_vlan.py | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py index 48c5b522e..5bb76165e 100644 --- a/tests/hwsim/test_ap_ft.py +++ b/tests/hwsim/test_ap_ft.py @@ -378,6 +378,20 @@ def test_ap_ft_vlan(dev, apdev): if filename.startswith('/tmp/'): os.unlink(filename) + sta = hapd0.get_sta(dev[0].own_addr()) + if not (sta and "vlan_id" in sta): + raise Exception("VLAN information not in STA output") + vlan_id = int(sta["vlan_id"]) + if vlan_id != 1: + raise Exception("Unexpected vlan_id %d" % vlan_id) + + sta = hapd1.get_sta(dev[0].own_addr()) + if not (sta and "vlan_id" in sta): + raise Exception("VLAN information not in STA output") + vlan_id = int(sta["vlan_id"]) + if vlan_id != 1: + raise Exception("Unexpected vlan_id %d" % vlan_id) + def test_ap_ft_vlan_disconnected(dev, apdev): """WPA2-PSK-FT AP with VLAN and local key generation""" ssid = "test-ft" diff --git a/tests/hwsim/test_ap_vlan.py b/tests/hwsim/test_ap_vlan.py index e50f76252..d2271fad8 100644 --- a/tests/hwsim/test_ap_vlan.py +++ b/tests/hwsim/test_ap_vlan.py @@ -782,6 +782,14 @@ def test_ap_vlan_psk(dev, apdev, params): hwsim_utils.test_connectivity_iface(dev[1], hapd, "brvlan2") hwsim_utils.test_connectivity_iface(dev[2], hapd, "brvlan3") + for i in range(3): + sta = hapd.get_sta(dev[i].own_addr()) + if not (sta and "vlan_id" in sta): + raise Exception("VLAN information not in STA output") + vlan_id = int(sta["vlan_id"]) + if vlan_id != i + 1: + raise Exception("Unexpected vlan_id %d for dev[%d]" % (vlan_id, i)) + def test_ap_vlan_sae(dev, apdev, params): """AP VLAN based on SAE Password Identifier""" for i in range(3): @@ -804,3 +812,11 @@ def test_ap_vlan_sae(dev, apdev, params): hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1") hwsim_utils.test_connectivity_iface(dev[1], hapd, "brvlan2") hwsim_utils.test_connectivity_iface(dev[2], hapd, "brvlan3") + + for i in range(3): + sta = hapd.get_sta(dev[i].own_addr()) + if not (sta and "vlan_id" in sta): + raise Exception("VLAN information not in STA output") + vlan_id = int(sta["vlan_id"]) + if vlan_id != i + 1: + raise Exception("Unexpected vlan_id %d for dev[%d]" % (vlan_id, i))