mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-06 04:04:01 -05:00
tests: INTERFACE_ADD/REMOVE with vif without creation/removal
This is also a regression test for INTERFACE_ADD parsing. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
da3db6812d
commit
138bf11852
@ -1363,3 +1363,27 @@ def test_wpas_ctrl_interface_add(dev, apdev):
|
|||||||
hwsim_utils.test_connectivity(dev[0], hapd)
|
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||||
dev[0].global_request("INTERFACE_REMOVE " + ifname)
|
dev[0].global_request("INTERFACE_REMOVE " + ifname)
|
||||||
hwsim_utils.test_connectivity(dev[0], hapd)
|
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||||
|
|
||||||
|
def test_wpas_ctrl_interface_add2(dev, apdev):
|
||||||
|
"""wpa_supplicant INTERFACE_ADD/REMOVE with vif without creation/removal"""
|
||||||
|
ifname = "test-ext-" + dev[0].ifname
|
||||||
|
try:
|
||||||
|
_test_wpas_ctrl_interface_add2(dev, apdev, ifname)
|
||||||
|
finally:
|
||||||
|
subprocess.call(['iw', 'dev', ifname, 'del'])
|
||||||
|
|
||||||
|
def _test_wpas_ctrl_interface_add2(dev, apdev, ifname):
|
||||||
|
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)
|
||||||
|
|
||||||
|
subprocess.call(['iw', 'dev', dev[0].ifname, 'interface', 'add', ifname,
|
||||||
|
'type', 'station'])
|
||||||
|
dev[0].interface_add(ifname, set_ifname=False, all_params=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)
|
||||||
|
del wpas
|
||||||
|
dev[0].global_request("INTERFACE_REMOVE " + ifname)
|
||||||
|
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||||
|
@ -54,7 +54,8 @@ class WpaSupplicant:
|
|||||||
self.ifname = None
|
self.ifname = None
|
||||||
|
|
||||||
def interface_add(self, ifname, config="", driver="nl80211",
|
def interface_add(self, ifname, config="", driver="nl80211",
|
||||||
drv_params=None, br_ifname=None, create=False):
|
drv_params=None, br_ifname=None, create=False,
|
||||||
|
set_ifname=True, all_params=False):
|
||||||
try:
|
try:
|
||||||
groups = subprocess.check_output(["id"])
|
groups = subprocess.check_output(["id"])
|
||||||
group = "admin" if "(admin)" in groups else "adm"
|
group = "admin" if "(admin)" in groups else "adm"
|
||||||
@ -73,9 +74,15 @@ class WpaSupplicant:
|
|||||||
if not drv_params:
|
if not drv_params:
|
||||||
cmd += '\t'
|
cmd += '\t'
|
||||||
cmd += '\tcreate'
|
cmd += '\tcreate'
|
||||||
|
if all_params and not create:
|
||||||
|
if not br_ifname:
|
||||||
|
cmd += '\t'
|
||||||
|
if not drv_params:
|
||||||
|
cmd += '\t'
|
||||||
|
cmd += '\t'
|
||||||
if "FAIL" in self.global_request(cmd):
|
if "FAIL" in self.global_request(cmd):
|
||||||
raise Exception("Failed to add a dynamic wpa_supplicant interface")
|
raise Exception("Failed to add a dynamic wpa_supplicant interface")
|
||||||
if not create:
|
if not create and set_ifname:
|
||||||
self.set_ifname(ifname)
|
self.set_ifname(ifname)
|
||||||
|
|
||||||
def interface_remove(self, ifname):
|
def interface_remove(self, ifname):
|
||||||
|
Loading…
Reference in New Issue
Block a user