tests: bssid_blacklist and bssid_whitelist
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
79cd993a62
commit
c2096d9981
3 changed files with 67 additions and 1 deletions
|
@ -201,3 +201,42 @@ def test_ap_open_out_of_memory(dev, apdev):
|
|||
# verify that a new interface can still be added when memory allocation does
|
||||
# not fail
|
||||
hostapd.add_ap(apdev[1]['ifname'], { "ssid": "open" })
|
||||
|
||||
def test_bssid_black_white_list(dev, apdev):
|
||||
"""BSSID black/white list"""
|
||||
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" })
|
||||
hapd2 = hostapd.add_ap(apdev[1]['ifname'], { "ssid": "open" })
|
||||
|
||||
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
|
||||
bssid_whitelist=apdev[1]['bssid'])
|
||||
dev[1].connect("open", key_mgmt="NONE", scan_freq="2412",
|
||||
bssid_blacklist=apdev[1]['bssid'])
|
||||
dev[2].connect("open", key_mgmt="NONE", scan_freq="2412",
|
||||
bssid_whitelist="00:00:00:00:00:00/00:00:00:00:00:00",
|
||||
bssid_blacklist=apdev[1]['bssid'])
|
||||
if dev[0].get_status_field('bssid') != apdev[1]['bssid']:
|
||||
raise Exception("dev[0] connected to unexpected AP")
|
||||
if dev[1].get_status_field('bssid') != apdev[0]['bssid']:
|
||||
raise Exception("dev[1] connected to unexpected AP")
|
||||
if dev[2].get_status_field('bssid') != apdev[0]['bssid']:
|
||||
raise Exception("dev[2] connected to unexpected AP")
|
||||
dev[0].request("REMOVE_NETWORK all")
|
||||
dev[1].request("REMOVE_NETWORK all")
|
||||
dev[2].request("REMOVE_NETWORK all")
|
||||
|
||||
dev[2].connect("open", key_mgmt="NONE", scan_freq="2412",
|
||||
bssid_whitelist="00:00:00:00:00:00", wait_connect=False)
|
||||
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
|
||||
bssid_whitelist="11:22:33:44:55:66/ff:00:00:00:00:00 " + apdev[1]['bssid'] + " aa:bb:cc:dd:ee:ff")
|
||||
dev[1].connect("open", key_mgmt="NONE", scan_freq="2412",
|
||||
bssid_blacklist="11:22:33:44:55:66/ff:00:00:00:00:00 " + apdev[1]['bssid'] + " aa:bb:cc:dd:ee:ff")
|
||||
if dev[0].get_status_field('bssid') != apdev[1]['bssid']:
|
||||
raise Exception("dev[0] connected to unexpected AP")
|
||||
if dev[1].get_status_field('bssid') != apdev[0]['bssid']:
|
||||
raise Exception("dev[1] connected to unexpected AP")
|
||||
dev[0].request("REMOVE_NETWORK all")
|
||||
dev[1].request("REMOVE_NETWORK all")
|
||||
ev = dev[2].wait_event(["CTRL-EVENT-CONNECTED"], timeout=0.1)
|
||||
if ev is not None:
|
||||
raise Exception("Unexpected dev[2] connectin")
|
||||
dev[2].request("REMOVE_NETWORK all")
|
||||
|
|
|
@ -202,6 +202,32 @@ def test_wpas_ctrl_network(dev):
|
|||
if "FAIL" not in dev[0].request('BSSID ' + str(id)):
|
||||
raise Exception("Unexpected BSSID success")
|
||||
|
||||
tests = [ "02:11:22:33:44:55",
|
||||
"02:11:22:33:44:55 02:ae:be:ce:53:77",
|
||||
"02:11:22:33:44:55/ff:00:ff:00:ff:00",
|
||||
"02:11:22:33:44:55/ff:00:ff:00:ff:00 f2:99:88:77:66:55",
|
||||
"f2:99:88:77:66:55 02:11:22:33:44:55/ff:00:ff:00:ff:00",
|
||||
"f2:99:88:77:66:55 02:11:22:33:44:55/ff:00:ff:00:ff:00 12:34:56:78:90:ab",
|
||||
"02:11:22:33:44:55/ff:ff:ff:00:00:00 02:ae:be:ce:53:77/00:00:00:00:00:ff" ]
|
||||
for val in tests:
|
||||
dev[0].set_network(id, "bssid_blacklist", val)
|
||||
res = dev[0].get_network(id, "bssid_blacklist")
|
||||
if res != val:
|
||||
raise Exception("Unexpected bssid_blacklist value: %s != %s" % (res, val))
|
||||
dev[0].set_network(id, "bssid_whitelist", val)
|
||||
res = dev[0].get_network(id, "bssid_whitelist")
|
||||
if res != val:
|
||||
raise Exception("Unexpected bssid_whitelist value: %s != %s" % (res, val))
|
||||
|
||||
tests = [ "foo",
|
||||
"00:11:22:33:44:5",
|
||||
"00:11:22:33:44:55q",
|
||||
"00:11:22:33:44:55/",
|
||||
"00:11:22:33:44:55/66:77:88:99:aa:b" ]
|
||||
for val in tests:
|
||||
if "FAIL" not in dev[0].request("SET_NETWORK %d bssid_blacklist %s" % (id, val)):
|
||||
raise Exception("Invalid bssid_blacklist value accepted")
|
||||
|
||||
def test_wpas_ctrl_many_networks(dev, apdev):
|
||||
"""wpa_supplicant ctrl_iface LIST_NETWORKS with huge number of networks"""
|
||||
for i in range(1000):
|
||||
|
|
|
@ -806,7 +806,8 @@ class WpaSupplicant:
|
|||
"disable_max_amsdu", "ampdu_factor", "ampdu_density",
|
||||
"disable_ht40", "disable_sgi", "disable_ldpc",
|
||||
"ht40_intolerant", "update_identifier", "mac_addr",
|
||||
"erp", "bg_scan_period" ]
|
||||
"erp", "bg_scan_period", "bssid_blacklist",
|
||||
"bssid_whitelist" ]
|
||||
for field in not_quoted:
|
||||
if field in kwargs and kwargs[field]:
|
||||
self.set_network(id, field, kwargs[field])
|
||||
|
|
Loading…
Reference in a new issue