aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-10-26 09:29:16 (GMT)
committerJouni Malinen <j@w1.fi>2014-10-26 09:29:16 (GMT)
commit8619c33420d2abce96356a9c811f85e837e64bf3 (patch)
treec52a902a1a4cb7c876bad66dbed109ac8ec76572 /tests
parent392dfd37e8508cf1bb5fdf127ec2674f3e38ec67 (diff)
downloadhostap-8619c33420d2abce96356a9c811f85e837e64bf3.zip
hostap-8619c33420d2abce96356a9c811f85e837e64bf3.tar.gz
hostap-8619c33420d2abce96356a9c811f85e837e64bf3.tar.bz2
tests: External bridge control for hostapd interface
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_ap_psk.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py
index cef82ff..dfa3d3a 100644
--- a/tests/hwsim/test_ap_psk.py
+++ b/tests/hwsim/test_ap_psk.py
@@ -328,6 +328,51 @@ def test_ap_wpa2_bridge_fdb(dev, apdev):
subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'down'])
subprocess.call(['sudo', 'brctl', 'delbr', 'ap-br0'])
+def test_ap_wpa2_already_in_bridge(dev, apdev):
+ """hostapd behavior with interface already in bridge"""
+ ifname = apdev[0]['ifname']
+ br_ifname = 'ext-ap-br0'
+ try:
+ ssid = "test-wpa2-psk"
+ passphrase = "12345678"
+ subprocess.call(['brctl', 'addbr', br_ifname])
+ subprocess.call(['brctl', 'setfd', br_ifname, '0'])
+ subprocess.call(['ip', 'link', 'set', 'dev', br_ifname, 'up'])
+ subprocess.call(['iw', ifname, 'set', 'type', '__ap'])
+ subprocess.call(['brctl', 'addif', br_ifname, ifname])
+ params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
+ hapd = hostapd.add_ap(ifname, params)
+ if hapd.get_driver_status_field('brname') != br_ifname:
+ raise Exception("Bridge name not identified correctly")
+ dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
+ finally:
+ subprocess.call(['ip', 'link', 'set', 'dev', br_ifname, 'down'])
+ subprocess.call(['brctl', 'delif', br_ifname, ifname])
+ subprocess.call(['iw', ifname, 'set', 'type', 'station'])
+ subprocess.call(['brctl', 'delbr', br_ifname])
+
+def test_ap_wpa2_ext_add_to_bridge(dev, apdev):
+ """hostapd behavior with interface added to bridge externally"""
+ ifname = apdev[0]['ifname']
+ br_ifname = 'ext-ap-br0'
+ try:
+ ssid = "test-wpa2-psk"
+ passphrase = "12345678"
+ params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
+ hapd = hostapd.add_ap(ifname, params)
+
+ subprocess.call(['brctl', 'addbr', br_ifname])
+ subprocess.call(['brctl', 'setfd', br_ifname, '0'])
+ subprocess.call(['ip', 'link', 'set', 'dev', br_ifname, 'up'])
+ subprocess.call(['brctl', 'addif', br_ifname, ifname])
+ dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
+ if hapd.get_driver_status_field('brname') != br_ifname:
+ raise Exception("Bridge name not identified correctly")
+ finally:
+ subprocess.call(['ip', 'link', 'set', 'dev', br_ifname, 'down'])
+ subprocess.call(['brctl', 'delif', br_ifname, ifname])
+ subprocess.call(['brctl', 'delbr', br_ifname])
+
def test_ap_wpa2_psk_ext(dev, apdev):
"""WPA2-PSK AP using external EAPOL I/O"""
bssid = apdev[0]['bssid']