D-Bus: Interworking network selection
Add the "InterworkingSelect" method to the DBus API to trigger an Interworking scan with ANQP fetches. When a BSS that matches a configured credential is found, the result is emitted using the signal "InterworkingAPAdded". Completion of the full InterworkingSelect operation is indicated with the "InterworkingSelectDone" signal. Signed-off-by: Damien Dejean <damiendejean@chromium.org>
This commit is contained in:
parent
b44e199676
commit
c8e4283f90
9 changed files with 281 additions and 7 deletions
|
@ -6136,3 +6136,69 @@ def test_dbus_creds(dev, apdev):
|
|||
raise Exception("Credential remove failed")
|
||||
if not "FAIL" in dev[0].get_cred(1, 'domain'):
|
||||
raise Exception("Credential remove failed")
|
||||
|
||||
def test_dbus_interworking(dev, apdev):
|
||||
"D-Bus interworking selection"
|
||||
(bus, wpas_obj, path, if_obj) = prepare_dbus(dev[0])
|
||||
iface = dbus.Interface(if_obj, WPAS_DBUS_IFACE)
|
||||
|
||||
params = {"ssid": "test-interworking", "wpa": "2",
|
||||
"wpa_key_mgmt": "WPA-EAP", "rsn_pairwise": "CCMP",
|
||||
"ieee8021x": "1", "eapol_version": "2",
|
||||
"eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf",
|
||||
"ca_cert": "auth_serv/ca.pem",
|
||||
"server_cert": "auth_serv/server.pem",
|
||||
"private_key": "auth_serv/server.key",
|
||||
"interworking": "1",
|
||||
"domain_name": "server.w1.fi",
|
||||
"nai_realm": "0,server.w1.fi,21[2:4][5:7]",
|
||||
"roaming_consortium": "2233445566",
|
||||
"hs20": "1", "anqp_domain_id": "1234"}
|
||||
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
|
||||
class TestDbusInterworking(TestDbus):
|
||||
def __init__(self, bus):
|
||||
TestDbus.__init__(self, bus)
|
||||
self.interworking_ap_seen = False
|
||||
self.interworking_select_done = False
|
||||
|
||||
def __enter__(self):
|
||||
gobject.timeout_add(1, self.run_select)
|
||||
gobject.timeout_add(15000, self.timeout)
|
||||
self.add_signal(self.interworkingAPAdded, WPAS_DBUS_IFACE,
|
||||
"InterworkingAPAdded")
|
||||
self.add_signal(self.interworkingSelectDone, WPAS_DBUS_IFACE,
|
||||
"InterworkingSelectDone")
|
||||
self.loop.run()
|
||||
return self
|
||||
|
||||
def interworkingAPAdded(self, bss, cred, properties):
|
||||
logger.debug("interworkingAPAdded: bss=%s cred=%s %s" % (bss, cred, str(properties)))
|
||||
if self.cred == cred:
|
||||
self.interworking_ap_seen = True
|
||||
|
||||
def interworkingSelectDone(self):
|
||||
logger.debug("interworkingSelectDone")
|
||||
self.interworking_select_done = True
|
||||
self.loop.quit()
|
||||
|
||||
def run_select(self, *args):
|
||||
args = {"domain": "server.w1.fi",
|
||||
"realm": "server.w1.fi",
|
||||
"eap": "TTLS",
|
||||
"phase2": "auth=MSCHAPV2",
|
||||
"username": "user",
|
||||
"password": "password",
|
||||
"domain_suffix_match": "server.w1.fi",
|
||||
"ca_cert": "auth_serv/ca.pem"}
|
||||
self.cred = iface.AddCred(dbus.Dictionary(args, signature='sv'))
|
||||
iface.InterworkingSelect()
|
||||
return False
|
||||
|
||||
def success(self):
|
||||
return self.interworking_ap_seen and self.interworking_select_done
|
||||
|
||||
with TestDbusInterworking(bus) as t:
|
||||
if not t.success():
|
||||
raise Exception("Expected signals not seen")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue