diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py index b10c05f10..507e74e6d 100644 --- a/tests/hwsim/test_p2p_autogo.py +++ b/tests/hwsim/test_p2p_autogo.py @@ -18,6 +18,7 @@ def autogo(go): logger.info("Start autonomous GO " + go.ifname) res = go.p2p_start_go() logger.debug("res: " + str(res)) + return res def connect_cli(go, client): logger.info("Try to connect the client to the GO") @@ -95,3 +96,38 @@ def test_autogo_tdls(dev): dev[2].remove_group() dev[1].remove_group() dev[0].remove_group() + +def test_autogo_legacy(dev): + """P2P autonomous GO and legacy clients""" + res = autogo(dev[0]) + + logger.info("Connect P2P client") + connect_cli(dev[0], dev[1]) + + logger.info("Connect legacy WPS client") + pin = dev[2].wps_read_pin() + dev[0].p2p_go_authorize_client(pin) + dev[2].request("SET ignore_old_scan_res 1") + dev[2].request("P2P_SET disabled 1") + dev[2].dump_monitor() + dev[2].request("WPS_PIN any " + pin) + ev = dev[2].wait_event(["CTRL-EVENT-CONNECTED"], timeout=30) + if ev is None: + raise Exception("Association with the GO timed out") + status = dev[2].get_status() + if status['wpa_state'] != 'COMPLETED': + raise Exception("Not fully connected") + hwsim_utils.test_connectivity_p2p_sta(dev[1], dev[2]) + dev[2].request("DISCONNECT") + + logger.info("Connect legacy non-WPS client") + dev[2].request("FLUSH") + dev[2].request("P2P_SET disabled 1") + dev[2].connect(ssid=res['ssid'], psk=res['passphrase'], proto='RSN', + key_mgmt='WPA-PSK', pairwise='CCMP', group='CCMP', + scan_freq=res['freq']) + hwsim_utils.test_connectivity_p2p_sta(dev[1], dev[2]) + dev[2].request("DISCONNECT") + + dev[0].remove_group() + dev[1].wait_go_ending_session() diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 640d98521..dc742f55c 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -57,6 +57,7 @@ class WpaSupplicant: logger.info("FLUSH to " + self.ifname + " failed: " + res) self.request("SET ignore_old_scan_res 0") self.request("P2P_SET per_sta_psk 0") + self.request("P2P_SET disabled 0") self.group_ifname = None self.dump_monitor() @@ -450,7 +451,7 @@ class WpaSupplicant: raise Exception("Failed to request TDLS teardown") return None - def connect(self, ssid, psk=None, proto=None, key_mgmt=None, wep_key0=None, ieee80211w=None): + def connect(self, ssid, psk=None, proto=None, key_mgmt=None, wep_key0=None, ieee80211w=None, pairwise=None, group=None, scan_freq=None): logger.info("Connect STA " + self.ifname + " to AP") id = self.add_network() self.set_network_quoted(id, "ssid", ssid) @@ -462,8 +463,14 @@ class WpaSupplicant: self.set_network(id, "key_mgmt", key_mgmt) if ieee80211w: self.set_network(id, "ieee80211w", ieee80211w) + if pairwise: + self.set_network(id, "pairwise", pairwise) + if group: + self.set_network(id, "group", group) if wep_key0: self.set_network(id, "wep_key0", wep_key0) + if scan_freq: + self.set_network(id, "scan_freq", scan_freq) self.connect_network(id) def scan(self, type=None):