diff --git a/tests/hwsim/example-hostapd.config b/tests/hwsim/example-hostapd.config index caaf4fce4..40e594cb3 100644 --- a/tests/hwsim/example-hostapd.config +++ b/tests/hwsim/example-hostapd.config @@ -43,6 +43,7 @@ CONFIG_TLSV12=y CONFIG_FULL_DYNAMIC_VLAN=y CONFIG_LIBNL32=y +CONFIG_LIBNL3_ROUTE=y CONFIG_PEERKEY=y CONFIG_IEEE80211W=y CONFIG_IEEE80211R=y diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py index df4de5305..b4b74e89d 100644 --- a/tests/hwsim/test_ap_psk.py +++ b/tests/hwsim/test_ap_psk.py @@ -7,6 +7,8 @@ import logging logger = logging.getLogger() import os +import subprocess +import time import hostapd import hwsim_utils @@ -290,3 +292,38 @@ def test_ap_wpa2_strict_rekey(dev, apdev): if ev is None: raise Exception("GTK rekey timed out") hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) + +def test_ap_wpa2_bridge_fdb(dev, apdev): + """Bridge FDB entry removal""" + try: + ssid = "test-wpa2-psk" + passphrase = "12345678" + params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase) + params['bridge'] = 'ap-br0' + hostapd.add_ap(apdev[0]['ifname'], params) + subprocess.call(['sudo', 'brctl', 'setfd', 'ap-br0', '0']) + subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'up']) + dev[0].connect(ssid, psk=passphrase, scan_freq="2412", + bssid=apdev[0]['bssid']) + dev[1].connect(ssid, psk=passphrase, scan_freq="2412", + bssid=apdev[0]['bssid']) + addr0 = dev[0].p2p_interface_addr() + hwsim_utils.test_connectivity_sta(dev[0], dev[1]) + cmd = subprocess.Popen(['brctl', 'showmacs', 'ap-br0'], + stdout=subprocess.PIPE) + macs1 = cmd.stdout.read() + dev[0].request("DISCONNECT") + dev[1].request("DISCONNECT") + time.sleep(1) + cmd = subprocess.Popen(['brctl', 'showmacs', 'ap-br0'], + stdout=subprocess.PIPE) + macs2 = cmd.stdout.read() + + addr1 = dev[1].p2p_interface_addr() + if addr0 not in macs1 or addr1 not in macs1: + raise Exception("Bridge FDB entry missing") + if addr0 in macs2 or addr1 in macs2: + raise Exception("Bridge FDB entry was not removed") + finally: + subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'down']) + subprocess.call(['sudo', 'brctl', 'delbr', 'ap-br0'])