From 709f18d501fbfc9dfd75aa205f506479f8f6db2d Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 29 Oct 2013 17:14:02 +0200 Subject: [PATCH] tests: Add a test for dynamic hostapd config change test_ap_change_ssid verifies that the SET and RELOAD control interface commands can be used to change the SSID of a hostapd-controlled WPA2-PSK AP, i.e., for a case where the PSK needs to be derived again after the SSID change. Signed-hostap: Jouni Malinen --- tests/hwsim/test_ap_dynamic.py | 35 ++++++++++++++++++++++++++++++++++ tests/hwsim/wpasupplicant.py | 1 + 2 files changed, 36 insertions(+) create mode 100644 tests/hwsim/test_ap_dynamic.py diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py new file mode 100644 index 000000000..49b88ca8f --- /dev/null +++ b/tests/hwsim/test_ap_dynamic.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +# +# Test cases for dynamic BSS changes with hostapd +# Copyright (c) 2013, Qualcomm Atheros, Inc. +# +# This software may be distributed under the terms of the BSD license. +# See README for more details. + +import time +import subprocess +import logging +logger = logging.getLogger(__name__) + +import hwsim_utils +import hostapd + +def test_ap_change_ssid(dev, apdev): + """Dynamic SSID change with hostapd and WPA2-PSK""" + params = hostapd.wpa2_params(ssid="test-wpa2-psk-start", + passphrase="12345678") + hostapd.add_ap(apdev[0]['ifname'], params) + id = dev[0].connect("test-wpa2-psk-start", psk="12345678") + dev[0].request("DISCONNECT") + + logger.info("Change SSID dynamically") + hapd = hostapd.Hostapd(apdev[0]['ifname']) + res = hapd.request("SET ssid test-wpa2-psk-new") + if "OK" not in res: + raise Exception("SET command failed") + res = hapd.request("RELOAD") + if "OK" not in res: + raise Exception("RELOAD command failed") + + dev[0].set_network_quoted(id, "ssid", "test-wpa2-psk-new") + dev[0].connect_network(id) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 0a8f9e9ba..00d5f953a 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -554,6 +554,7 @@ class WpaSupplicant: else: self.dump_monitor() self.select_network(id) + return id def scan(self, type=None): if type: