]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: FDB entry addition/removal
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 24 Sep 2014 13:13:44 +0000 (16:13 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 29 Sep 2014 11:03:15 +0000 (14:03 +0300)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/example-hostapd.config
tests/hwsim/test_ap_psk.py

index caaf4fce4a61f0dcdf337319e1520ceffa89e134..40e594cb37bc635d3f7efa779ca3fa2da0ea2470 100644 (file)
@@ -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
index df4de53056c21f24a4499caac11f6b4f6d77e41d..b4b74e89dab512d38923a6ac429d0621ff8cfbf4 100644 (file)
@@ -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'])