mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 08:48:31 -05:00
tests: INTERFACE_ADD/REMOVE with vif addition/removal
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
efa232f915
commit
25f2cb618c
@ -10,6 +10,7 @@ import subprocess
|
||||
import time
|
||||
|
||||
import hostapd
|
||||
import hwsim_utils
|
||||
from wpasupplicant import WpaSupplicant
|
||||
from utils import alloc_fail
|
||||
|
||||
@ -1347,3 +1348,18 @@ def test_wpas_ctrl_dump(dev, apdev):
|
||||
raise Exception("Mismatch in config field " + field)
|
||||
if "beacon_int" not in vals:
|
||||
raise Exception("Missing config field")
|
||||
|
||||
def test_wpas_ctrl_interface_add(dev, apdev):
|
||||
"""wpa_supplicant INTERFACE_ADD/REMOVE with vif creation/removal"""
|
||||
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" })
|
||||
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
|
||||
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||
|
||||
ifname = "test-" + dev[0].ifname
|
||||
dev[0].interface_add(ifname, create=True)
|
||||
wpas = WpaSupplicant(ifname=ifname)
|
||||
wpas.connect("open", key_mgmt="NONE", scan_freq="2412")
|
||||
hwsim_utils.test_connectivity(wpas, hapd)
|
||||
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||
dev[0].global_request("INTERFACE_REMOVE " + ifname)
|
||||
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||
|
@ -54,7 +54,7 @@ class WpaSupplicant:
|
||||
self.ifname = None
|
||||
|
||||
def interface_add(self, ifname, config="", driver="nl80211",
|
||||
drv_params=None, br_ifname=None):
|
||||
drv_params=None, br_ifname=None, create=False):
|
||||
try:
|
||||
groups = subprocess.check_output(["id"])
|
||||
group = "admin" if "(admin)" in groups else "adm"
|
||||
@ -67,8 +67,15 @@ class WpaSupplicant:
|
||||
if not drv_params:
|
||||
cmd += '\t'
|
||||
cmd += '\t' + br_ifname
|
||||
if create:
|
||||
if not br_ifname:
|
||||
cmd += '\t'
|
||||
if not drv_params:
|
||||
cmd += '\t'
|
||||
cmd += '\tcreate'
|
||||
if "FAIL" in self.global_request(cmd):
|
||||
raise Exception("Failed to add a dynamic wpa_supplicant interface")
|
||||
if not create:
|
||||
self.set_ifname(ifname)
|
||||
|
||||
def interface_remove(self, ifname):
|
||||
|
Loading…
Reference in New Issue
Block a user