tests: External MAC address change
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
3e0272ca00
commit
393869c551
1 changed files with 37 additions and 0 deletions
|
@ -109,6 +109,43 @@ def test_sta_dynamic_down_up(dev, apdev):
|
|||
raise Exception("Reconnection not reported")
|
||||
hwsim_utils.test_connectivity(wpas.ifname, apdev[0]['ifname'])
|
||||
|
||||
def test_sta_dynamic_ext_mac_addr_change(dev, apdev):
|
||||
"""Dynamically added wpa_supplicant interface with external MAC address change"""
|
||||
params = hostapd.wpa2_params(ssid="sta-dynamic", passphrase="12345678")
|
||||
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
|
||||
|
||||
logger.info("Create a dynamic wpa_supplicant interface and connect")
|
||||
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
|
||||
wpas.interface_add("wlan5")
|
||||
wpas.connect("sta-dynamic", psk="12345678", scan_freq="2412")
|
||||
hwsim_utils.test_connectivity(wpas.ifname, apdev[0]['ifname'])
|
||||
subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'down'])
|
||||
ev = wpas.wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=10)
|
||||
if ev is None:
|
||||
raise Exception("Disconnection not reported")
|
||||
if wpas.get_status_field("wpa_state") != "INTERFACE_DISABLED":
|
||||
raise Exception("Unexpected wpa_state")
|
||||
prev_addr = wpas.p2p_interface_addr()
|
||||
new_addr = '02:11:22:33:44:55'
|
||||
try:
|
||||
subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', wpas.ifname,
|
||||
'address', new_addr])
|
||||
subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'up'])
|
||||
ev = wpas.wait_event(["CTRL-EVENT-CONNECTED"], timeout=15)
|
||||
if ev is None:
|
||||
raise Exception("Reconnection not reported")
|
||||
if wpas.get_driver_status_field('addr') != new_addr:
|
||||
raise Exception("Address change not reported")
|
||||
hwsim_utils.test_connectivity(wpas.ifname, apdev[0]['ifname'])
|
||||
sta = hapd.get_sta(new_addr)
|
||||
if sta['addr'] != new_addr:
|
||||
raise Exception("STA association with new address not found")
|
||||
finally:
|
||||
subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'down'])
|
||||
subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', wpas.ifname,
|
||||
'address', prev_addr])
|
||||
subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'up'])
|
||||
|
||||
def test_sta_dynamic_random_mac_addr(dev, apdev):
|
||||
"""Dynamically added wpa_supplicant interface and random MAC address"""
|
||||
params = hostapd.wpa2_params(ssid="sta-dynamic", passphrase="12345678")
|
||||
|
|
Loading…
Reference in a new issue