scan: add scan API specifically for OWE transition networks
James Prestwood
PATCH v6 1/5 scan: add scan API specifically for OWE transition networks
Specifically OWE networks with multiple open/hidden BSS's are troublesome to scan for with the current APIs. The scan parameters are limited to a single SSID and even if that was changed we have the potential of hitting the max SSID's per scan limit. In all, it puts the burden onto the caller to sort out the SSIDs/frequencies to scan for.
Rather than requiring station to handle this a new scan API was added, scan_owe_hidden() which takes a list of open BSS's and will automatically scan for the SSIDs in the OWE transition IE for each.
It is slightly optimized to first check if all the hidden SSID's are the same. This is the most likely case (e.g. single pair or single network) and a single scan command can be used. Otherwise individual scan commands are queued for each SSID/frequency combo.
--- src/scan.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++--- src/scan.h | 3 ++ 2 files changed, 134 insertions(+), 8 deletions(-)
src/scan.c +131 -8
@@ -583,6 +583,27 @@ static const struct wiphy_radio_work_item_ops work_ops = { .destroy = scan_request_free, }; +static struct scan_request *scan_request_new (struct scan_context *sc, +bool passive, +scan_trigger_func_t trigger, +scan_notify_func_t notify, +void *userdata, +scan_destroy_func_t destroy) +{ +struct scan_request *sr; + + sr = l_new(struct scan_request, 1); + sr->sc = sc; + sr->trigger = trigger; + sr->callback = notify; + sr->userdata = userdata; + sr->destroy = destroy; + sr->passive = passive; + sr->cmds =l_queue_new (); + +return sr; +} + static uint32_t scan_common(uint64_t wdev_id, bool passive, const struct scan_parameters *params, scan_trigger_func_t trigger,
@@ -597,14 +618,7 @@ static uint32_t scan_common(uint64_t wdev_id, bool passive,if (!sc)return 0 ; - sr = l_new(struct scan_request, 1); - sr->sc = sc; - sr->trigger = trigger; - sr->callback = notify; - sr->userdata = userdata; - sr->destroy = destroy; - sr->passive = passive; - sr->cmds =l_queue_new (); + sr =scan_request_new (sc, passive, trigger, notify, userdata, destroy);scan_cmds_add (sr->cmds, sc, passive, params);
@@ -656,6 +670,115 @@ uint32_t scan_active_full(uint64_t wdev_id, trigger, notify, userdata, destroy); } +static void add_owe_scan_cmd (struct scan_context *sc,struct scan_request *sr, +bool ignore_flush, +struct scan_freq_set *freqs, +const struct scan_bss *bss) +{ +struct l_genl_msg *cmd; +struct scan_parameters params = {}; +struct scan_freq_set *tmp; + +if (!freqs) { + tmp =scan_freq_set_new (); +scan_freq_set_add (tmp, bss->frequency); + params.freqs = tmp; + }else + params.freqs = freqs; + + params.ssid = bss->owe_trans_ssid; + params.ssid_len = bss->owe_trans_ssid_len; + params.flush = true; + + cmd =scan_build_cmd (sc, ignore_flush, false, ¶ms); + +l_genl_msg_enter_nested (cmd,NL80211_ATTR_SCAN_SSIDS ); +l_genl_msg_append_attr (cmd,0 , params.ssid_len, params.ssid); +l_genl_msg_leave_nested (cmd); + +l_queue_push_tail (sr->cmds, cmd); + +if (!freqs) +scan_freq_set_free (tmp); +} + +uint32_t scan_owe_hidden (uint64_t wdev_id,struct l_queue *list, +scan_trigger_func_t trigger,scan_notify_func_t notify, +void *userdata,scan_destroy_func_t destroy) +{ +struct scan_context *sc; +struct scan_request *sr; +struct scan_freq_set *freqs; +const struct l_queue_entry *entry; +const uint8_t *ssid =NULL ; +size_t ssid_len; +bool same_ssid = true; +struct scan_bss *bss; +bool ignore_flush = false; + + sc =l_queue_find (scan_contexts, scan_context_match, &wdev_id); + +if (!sc) +return 0 ; + + sr =scan_request_new (sc, false, trigger, notify, userdata, destroy); + + freqs =scan_freq_set_new (); + +/* +* Start building up a frequency list if all SSIDs are the same. This +* is hopefully the common case and will allow a single scan command. +*/ +for (entry =l_queue_get_entries (list); entry; entry = entry->next) { + bss = entry->data; + +scan_freq_set_add (freqs, bss->frequency); + +/* First */ +if (!ssid) { + ssid = bss->owe_trans_ssid; + ssid_len = bss->owe_trans_ssid_len; +continue ; + } + +if (ssid_len == bss->owe_trans_ssid_len && + !memcmp (ssid, bss->owe_trans_ssid, + bss->owe_trans_ssid_len)) +continue ; + + same_ssid = false; +break ; + } + +if (same_ssid) { + bss =l_queue_peek_head (list); + +add_owe_scan_cmd (sc, sr, ignore_flush, freqs, bss); + +scan_freq_set_free (freqs); + + goto done; + } + +scan_freq_set_free (freqs); + +/* SSIDs differed, use separate scan commands. */ +for (entry =l_queue_get_entries (list); entry; entry = entry->next) { + bss = entry->data; + +add_owe_scan_cmd (sc, sr, ignore_flush,NULL , bss); + +/* Ignore flush on all subsequent commands */ +if (!ignore_flush) + ignore_flush = true; + } + +done: +l_queue_push_tail (sc->requests, sr); + +return wiphy_radio_work_insert (sc->wiphy, &sr->work,2 , &work_ops); +} +bool scan_cancel (uint64_t wdev_id,uint32_t id) {struct scan_context *sc;
src/scan.h +3 -0
@@ -147,6 +147,9 @@ uint32_t scan_active_full(uint64_t wdev_id,const struct scan_parameters *params, scan_trigger_func_t trigger, scan_notify_func_t notify, void *userdata, scan_destroy_func_t destroy); +uint32_t scan_owe_hidden (uint64_t wdev_id,struct l_queue *list, +scan_trigger_func_t trigger,scan_notify_func_t notify, +void *userdata,scan_destroy_func_t destroy);bool scan_cancel (uint64_t wdev_id,uint32_t id); void scan_periodic_start(uint64_t wdev_id, scan_trigger_func_t trigger,
Signature · 1 line
2.31.1
James Prestwood
PATCH v6 2/5 network: add network_get_station
--- src/network.c | 5 +++++ src/network.h | 1 + 2 files changed, 6 insertions(+)
src/network.c +5 -0
@@ -392,6 +392,11 @@ struct l_settings *network_get_settings(const struct network *network)return network->settings; } +struct station *network_get_station (const struct network *network) +{ +return network->station; +} +static bool network_set_8021x_secrets (struct network *network) {const struct l_queue_entry *entry;
src/network.h +1 -0
@@ -44,6 +44,7 @@ enum security network_get_security(const struct network *network);bool network_set_passphrase (struct network *network,const char *passphrase);int network_get_signal_strength (const struct network *network);struct l_settings *network_get_settings (const struct network *network); +struct station *network_get_station (const struct network *network);bool network_set_psk (struct network *network,const uint8_t *psk);
Signature · 1 line
2.31.1
James Prestwood
PATCH v6 3/5 station: handle OWE Transition procedure
In reply to James PrestwoodOWE Transition is described in the WiFi Alliance OWE Specification version 1.1. The idea behind it is to support both legacy devices without any concept of OWE as well as modern ones which support the OWE protocol.
OWE is a somewhat special type of network. Where it advertises an RSN element but is still "open". This apparently confuses older devices so the OWE transition procedure was created.
The idea is simple: have two BSS's, one open, and one as a hidden OWE network. Each network advertises a vendor IE which points to the other. A device sees the open network and can connect (legacy) or parse the IE, scan for the hidden OWE network, and connect to that instead.
Care was taken to handle connections to hidden networks directly. The policy is being set that any hidden network with the WFA OWE IE is not connectable via ConnectHiddenNetwork(). These networks are special, and can only be connected to via the network object for the paired open network.
When scan results come in from any source (DBus, quick, autoconnect) each BSS is checked for the OWE Transition IE. A few paths can be taken here when the IE is found:
1. The BSS is open. The BSSID in the IE is checked against the current scan results (excluding hidden networks). If a match is found we should already have the hidden OWE BSS and nothing else needs to be done (3).
2. The BSS is open. The BSSID in the IE is not found in the current scan results, and the open network also has no OWE BSS in it. This will be processed after scan results.
3. The BSS is not open and contains the OWE IE. This BSS will automatically get added to the network object and nothing else needs to be done.
After the scan results each network is checked for any non-paired open BSS's. If found a scan is started for these BSS's per-network. Once these scan results come in the network is notified.
Quoted 1 line
From here
network.ccan detect that this is an OWE transition
network and connect to the OWE BSS rather than the open one.
--- src/station.c | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+)
v6:
* Process each network after all the scan results
src/station.c +226 -0
@@ -87,6 +87,7 @@ struct station {uint32_t dbus_scan_id;uint32_t quick_scan_id;uint32_t hidden_network_scan_id; +struct l_queue *owe_hidden_scan_ids;/* Roaming related members */ struct timespec roam_min_time;
@@ -254,6 +255,9 @@ static void station_autoconnect_start(struct station *station)if (!l_queue_isempty (station->anqp_pending))return ; +if (station->owe_hidden_scan_ids) +return ; +if (L_WARN_ON (station->autoconnect_list))l_queue_destroy (station->autoconnect_list,NULL );
@@ -395,6 +399,44 @@ static struct network *station_add_seen_bss(struct station *station,if (station_parse_bss_security (station, bss, &security) <0 )return NULL ; +/* Hidden OWE transition network */ +if (security ==SECURITY_NONE && bss->rsne && + !l_memeqzero (bss->owe_trans_bssid,6 )) { +/* +* WiFi Alliance OWE Specification v1.1 - Section 2.2.1: +* +* "2. An OWE AP shall use two different SSIDs, one for OWE +* and one for Open" +* +* "4. The OWE BSS shall include the OWE Transition Mode element +* in all Beacon and Probe Response frames to encapsulate +* the BSSID and SSID of the Open BSS" +* +* Meaning the hidden SSID should not match the SSID in the +* hidden network's OWE IE. Might as well restrict BSSID as well +* to be safe. +* +* In addition this SSID must be a valid utf8 string otherwise +* we could not look up the network. Note that this is not true +* for the open BSS IE, it can be non-utf8. +*/ +if (!util_ssid_is_utf8 (bss->owe_trans_ssid_len, + bss->owe_trans_ssid)) +return NULL ; + +if (!memcmp (bss->owe_trans_ssid, bss->ssid, bss->ssid_len)) +return NULL ; + +if (!memcmp (bss->owe_trans_bssid, bss->addr,6 )) +return NULL ; + +memcpy (ssid, bss->owe_trans_ssid,sizeof (bss->owe_trans_ssid)); + ssid[bss->owe_trans_ssid_len] ='\0' ; + +l_debug ("Found hidden OWE network, using %s for network lookup" , + ssid); + } + path =iwd_network_get_path (station, ssid, security); network =l_hashmap_lookup (station->networks, path);
@@ -645,6 +687,174 @@ static bool station_start_anqp(struct station *station, struct network *network,return true; } +/* +* Check if this is an Open/Hidden pair: +* +* Open SSID equals the SSID in OWE IE +* Open BSSID equals the BSSID in OWE IE +* +* OWE SSID equals the SSID in Open IE +* OWE BSSID equals the BSSID in Open IE +*/ +#define OPEN_OWE_PAIR (open, owe) \ +( \ + (open)->ssid_len == (owe)->owe_trans_ssid_len && \ + (open)->owe_trans_ssid_len == (owe)->ssid_len && \ + !memcmp((open)->ssid, (owe)->owe_trans_ssid, (open)->ssid_len) && \ + !memcmp((open)->owe_trans_ssid, (owe)->ssid, (owe)->ssid_len) && \ + !memcmp((open)->addr, (owe)->owe_trans_bssid, 6) && \ + !memcmp((open)->owe_trans_bssid, (owe)->addr, 6) \ +) + +static bool network_has_open_pair (struct network *network,struct scan_bss *owe) +{ +const struct l_queue_entry *entry; + +for (entry =network_bss_list_get_entries (network); entry; + entry = entry->next) { +struct scan_bss *open = entry->data; + +if (OPEN_OWE_PAIR (open, owe)) +return true; + } + +return false; +} + +static bool station_owe_transition_results (int err,struct l_queue *bss_list, +const struct scan_freq_set *freqs, +void *userdata) +{ +struct network *network = userdata; +struct station *station =network_get_station (network); +struct scan_bss *bss; + +station_property_set_scanning (station, false); + +if (err) +return err ==0 ; + +while ((bss =l_queue_pop_head (bss_list))) { +/* +* Don't handle the open BSS, hidden BSS, BSS with no OWE +* Transition IE, or an IE with a non-utf8 SSID +*/ +if (!bss->rsne ||l_memeqzero (bss->owe_trans_bssid,6 ) || +util_ssid_is_hidden (bss->ssid_len, bss->ssid) || + !util_ssid_is_utf8 (bss->owe_trans_ssid_len, + bss->owe_trans_ssid)) + goto free; + + +/* Check if we have an open BSS that matches */ +if (!network_has_open_pair (network, bss)) + goto free; + +l_debug ("Adding OWE transition network " MAC " to %s" , +MAC_STR (bss->addr),network_get_ssid (network)); + +l_queue_push_tail (station->bss_list, bss); +network_bss_add (network, bss); + +continue ; + +free: +scan_bss_free (bss); + } + +l_queue_destroy (bss_list,NULL ); + +return true; +} + +static void station_owe_transition_triggered (int err,void *user_data) +{ +struct network *network = user_data; +struct station *station =network_get_station (network); + +if (err <0 ) { +l_debug ("OWE transition scan trigger failed: %i" , err); +return ; + } + +l_debug ("OWE transition scan triggered" ); + +station_property_set_scanning (station, true); +} + +static void station_owe_transition_destroy (void *userdata) +{ +struct network *network = userdata; +struct station *station =network_get_station (network); + +l_queue_pop_head (station->owe_hidden_scan_ids); + +if (l_queue_isempty (station->owe_hidden_scan_ids)) { +l_queue_destroy (station->owe_hidden_scan_ids,NULL ); + station->owe_hidden_scan_ids =NULL ; + } + +WATCHLIST_NOTIFY (&event_watches, station_event_watch_func_t, +STATION_EVENT_OWE_HIDDEN_FINISHED , network); + +station_autoconnect_start (station); +} + +static void foreach_add_owe_scan (struct network *network,void *data) +{ +struct station *station = data; +const struct l_queue_entry *entry; +struct l_queue *list =NULL ; +uint32_t id; + +for (entry =network_bss_list_get_entries (network); entry; + entry = entry->next) { +struct scan_bss *open = entry->data; + +if (l_memeqzero (open->owe_trans_bssid,6 )) +continue ; + +/* only want the open networks with WFA OWE IE */ +if (open->rsne) +continue ; + +/* BSS already in network object */ +if (network_bss_find_by_addr (network, open->owe_trans_bssid)) +continue ; + +if (!list) + list =l_queue_new (); + +l_queue_push_tail (list, open); + } + +if (!list) +return ; + + id =scan_owe_hidden (netdev_get_wdev_id (station->netdev), list, + station_owe_transition_triggered, + station_owe_transition_results, + network, station_owe_transition_destroy); +if (!id) + goto done; + +if (!station->owe_hidden_scan_ids) + station->owe_hidden_scan_ids =l_queue_new (); + +l_queue_push_tail (station->owe_hidden_scan_ids,L_UINT_TO_PTR (id)); + +WATCHLIST_NOTIFY (&event_watches, station_event_watch_func_t, +STATION_EVENT_OWE_HIDDEN_STARTED , network); + +done: +l_queue_destroy (list,NULL ); +} + +static void station_process_owe_transition_networks (struct station *station) +{ +station_network_foreach (station, foreach_add_owe_scan, station); +} +static bool bss_free_if_ssid_not_utf8 (void *data,void *user_data) {struct scan_bss *bss = data;
@@ -991,6 +1201,8 @@ static bool new_scan_results(int err, struct l_queue *bss_list,station_set_scan_results (station, bss_list, freqs, true); +station_process_owe_transition_networks (station); +return true; }
@@ -1061,6 +1273,8 @@ static bool station_quick_scan_results(int err, struct l_queue *bss_list,station_set_scan_results (station, bss_list, freqs, true); +station_process_owe_transition_networks (station); + done:if (station->state ==STATION_STATE_AUTOCONNECT_QUICK )/*
@@ -3155,6 +3369,8 @@ static void station_dbus_scan_done(struct station *station, station->dbus_scan_id =0 ;station_property_set_scanning (station, false); +station_process_owe_transition_networks (station); +if (try_autoconnect) { station->autoconnect_can_start = true;station_autoconnect_start (station);
@@ -3705,6 +3921,16 @@ static void station_free(struct station *station)scan_cancel (netdev_get_wdev_id (station->netdev), station->hidden_network_scan_id); +if (station->owe_hidden_scan_ids) { +void *ptr; + +while ((ptr =l_queue_pop_head (station->owe_hidden_scan_ids))) +scan_cancel (netdev_get_wdev_id (station->netdev), +L_PTR_TO_UINT (ptr)); + +l_queue_destroy (station->owe_hidden_scan_ids,NULL ); + } +station_roam_state_clear (station);l_queue_destroy (station->networks_sorted,NULL );
Signature · 1 line
2.31.1
James Prestwood
PATCH v6 4/5 network: prefer OWE transition BSS over open
In reply to James PrestwoodThere isn't much control station has with how BSS's are inserted to a network object. The rank algorithm makes that decision. Because of this we could end up in a situation where the Open BSS is preferred over the OWE transition BSS.
In attempt to better handle this any Open BSS in this type of network will not be chosen unless its the only candidate (e.g. no other BSSs, inability to connect with OWE, or an improperly configured network).
--- src/network.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
src/network.c +16 -0
@@ -1110,6 +1110,11 @@ const struct l_queue_entry *network_bss_list_get_entries(return l_queue_get_entries (network->bss_list); } +static bool bss_is_owe (struct scan_bss *bss) +{ +return !l_memeqzero (bss->owe_trans_bssid,6 ) && bss->rsne; +} +struct scan_bss *network_bss_select (struct network *network,bool fallback_to_blacklist) {
@@ -1135,6 +1140,17 @@ struct scan_bss *network_bss_select(struct network *network,if (!candidate) candidate = bss; +/* OWE Transition BSS */ +if (!l_memeqzero (bss->owe_trans_bssid,6 )) { +/* Don't want to connect to the Open BSS if possible */ +if (!bss->rsne) +continue ; + +/* Candidate is not OWE, set this as new candidate */ +if (!bss_is_owe (candidate)) + candidate = bss; + } +/* check if temporarily blacklisted */ if (l_queue_find (network->blacklist, match_bss, bss))continue ;
Signature · 1 line
2.31.1
James Prestwood
PATCH v6 5/5 auto-t: add testOWE-transition
In reply to James PrestwoodThis adds several tests for OWE transition networks. Hostapd does have special options for these networks but currently their implementation is incorrect as the IE is not ever added to the OWE BSS. Besides that using vendor_elements provides a much easier way to create invalid IEs to test.
--- .../testOWE-transition/connection_test.py | 222 ++++++++++++++++++ autotests/testOWE-transition/hw.conf | 10 + autotests/testOWE-transition/main.conf | 2 + autotests/testOWE-transition/ssidOWE.conf | 14 ++ autotests/testOWE-transition/ssidOpen.conf | 8 + autotests/testOWE-transition/transition.open | 0 6 files changed, 256 insertions(+) create mode 100644 autotests/testOWE-transition/connection_test.py create mode 100644 autotests/testOWE-transition/hw.conf create mode 100644 autotests/testOWE-transition/main.conf create mode 100644 autotests/testOWE-transition/ssidOWE.conf create mode 100644 autotests/testOWE-transition/ssidOpen.conf create mode 100644 autotests/testOWE-transition/transition.open
autotests/testOWE-transition/connection_test.py new file +222 -0
@@ -0,0 +1,222 @@ +#!/usr/bin/python3 + +import unittest +import sys + +sys.path.append('../util') +import iwd +from iwd import IWD +from iwd import NetworkType +from hostapd import HostapdCLI +import testutil + +class Test(unittest.TestCase): + + def validate(self, wd, target, autoconnect=False, connect_hidden=False): + devices = wd.list_devices(1) + device = devices[0] + device.autoconnect = autoconnect + + if not autoconnect: + if not connect_hidden: + condition = 'not obj.scanning' + wd.wait_for_object_condition(device, condition) + + device.scan() + + condition = 'obj.scanning' + wd.wait_for_object_condition(device, condition) + + condition = 'not obj.scanning' + wd.wait_for_object_condition(device, condition) + + network = device.get_ordered_network('transition', scan_if_needed=False) + + network.network_object.connect() + else: + device.connect_hidden_network('owe-hidden') + + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) + + testutil.test_iface_operstate() + + if type(target) != list: + testutil.test_ifaces_connected(device.name, target.ifname) + self.assertIn(device.address, target.list_sta()) + else: + found = False + for t in target: + if device.address in t.list_sta(): + testutil.test_ifaces_connected(device.name, t.ifname) + found = True + + self.assertTrue(found) + + device.disconnect() + + # Normal success case + def test_owe_transition(self): + self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e') + self.hapd_open.reload() + self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e') + self.hapd_owe.reload() + + self.hapd_owe2.disable() + self.hapd_open2.disable() + + self.validate(self.wd, self.hapd_owe) + + # Normal success case + def test_owe_transition_multi_network(self): + self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e') + self.hapd_open.reload() + self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e') + self.hapd_owe.reload() + + self.hapd_open2.set_value('vendor_elements', 'dd17506f9a1c02000000f1000c6f77652d68696464656e2d32') + self.hapd_open2.set_value('ssid', 'transition-2') + self.hapd_open2.reload() + self.hapd_owe2.set_value('vendor_elements', 'dd17506f9a1c02000000f0000c7472616e736974696f6e2d32') + self.hapd_owe2.set_value('ssid', 'owe-hidden-2') + self.hapd_owe2.reload() + + self.validate(self.wd, self.hapd_owe) + + # Two pairs of open/OWE BSS's (OWE BSS's have different SSIDs) */ + def test_owe_transition_multi_bss(self): + self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e') + self.hapd_open.reload() + self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e') + self.hapd_owe.reload() + + self.hapd_open2.set_value('vendor_elements', 'dd17506f9a1c02000000f3000c6f77652d68696464656e2d32') + self.hapd_open2.set_value('ssid', 'transition') + self.hapd_open2.reload() + self.hapd_owe2.set_value('vendor_elements', 'dd15506f9a1c02000000f2000a7472616e736974696f6e') + self.hapd_owe2.set_value('ssid', 'owe-hidden-2') + self.hapd_owe2.reload() + + self.validate(self.wd, [self.hapd_owe, self.hapd_owe2]) + + # Two pairs of open/OWE BSS's (OWE BSS's have same SSID) */ + def test_owe_transition_multi_bss_same_ssid(self): + self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e') + self.hapd_open.reload() + self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e') + self.hapd_owe.reload() + + self.hapd_open2.set_value('vendor_elements', 'dd15506f9a1c02000000f3000a6f77652d68696464656e') + self.hapd_open2.set_value('ssid', 'transition') + self.hapd_open2.reload() + self.hapd_owe2.set_value('vendor_elements', 'dd15506f9a1c02000000f2000a7472616e736974696f6e') + self.hapd_owe2.set_value('ssid', 'owe-hidden') + self.hapd_owe2.reload() + + self.validate(self.wd, [self.hapd_owe, self.hapd_owe2]) + + # Normal success autoconnect case + def test_owe_transition_autoconnect(self): + self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e') + self.hapd_open.reload() + self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e') + self.hapd_owe.reload() + + self.hapd_owe2.disable() + self.hapd_open2.disable() + + IWD.copy_to_storage('transition.open') + + self.validate(self.wd, self.hapd_owe, autoconnect=True) + + # Open BSS has invalid BSSID in OWE transition element + # Expected connection to Open BSS + def test_owe_transition_invalid_open_bssid(self): + self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000ff000a6f77652d68696464656e') + self.hapd_open.reload() + self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e') + self.hapd_owe.reload() + + self.hapd_owe2.disable() + self.hapd_open2.disable() + + self.validate(self.wd, self.hapd_open) + + # OWE BSS has invalid BSSID in OWE transition element + # Expected connection to Open BSS + def test_owe_transition_invalid_owe_bssid(self): + self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e') + self.hapd_open.reload() + self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000ff000a7472616e736974696f6e') + self.hapd_owe.reload() + + self.hapd_owe2.disable() + self.hapd_open2.disable() + + self.validate(self.wd, self.hapd_open) + + # No OWE hidden network exists + # Expected connection to Open BSS + def test_owe_transition_no_hidden_found(self): + self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e') + self.hapd_open.reload() + self.hapd_owe.disable() + + self.hapd_owe2.disable() + self.hapd_open2.disable() + + self.validate(self.wd, self.hapd_open) + + # Directly connect to valid OWE hidden network + # Expected connection failure + def test_owe_transition_connect_hidden_valid(self): + self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e') + self.hapd_open.reload() + self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e') + self.hapd_owe.reload() + + self.hapd_owe2.disable() + self.hapd_open2.disable() + + with self.assertRaises(iwd.NotFoundEx): + self.validate(self.wd, self.hapd_owe, connect_hidden=True) + + # Directly connect to invalid OWE hidden network. The SSID in the OWE BSS + # IE points to itself. And the Open BSS IE points to a non-existent SSID. + # Expected connection failure + def test_owe_transition_connect_hidden_invalid(self): + self.hapd_open.set_value('vendor_elements', 'dd18506f9a1c02000000f1000d6e6f2d6f77652d68696464656e') + self.hapd_open.reload() + self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a6f77652d68696464656e') + self.hapd_owe.reload() + + self.hapd_owe2.disable() + self.hapd_open2.disable() + + with self.assertRaises(iwd.NotFoundEx): + self.validate(self.wd, self.hapd_owe, connect_hidden=True) + + def setUp(self): + self.wd = IWD(True) + self.hapd_owe = HostapdCLI(config='ssidOWE.conf') + self.hapd_open = HostapdCLI(config='ssidOpen.conf') + self.hapd_owe2 = HostapdCLI(config='ssidOWE-2.conf') + self.hapd_open2 = HostapdCLI(config='ssidOpen-2.conf') + + def tearDown(self): + IWD.clear_storage() + + self.wd = None + self.hapd_open = None + self.hapd_owe = None + + @classmethod + def setUpClass(cls): + pass + + @classmethod + def tearDownClass(cls): + IWD.clear_storage() + +if __name__ == '__main__': + unittest.main(exit=True)
autotests/testOWE-transition/hw.conf new file +10 -0
@@ -0,0 +1,10 @@ +[SETUP] +num_radios=5 +hwsim_medium=yes +start_iwd=0 + +[HOSTAPD] +rad0=ssidOpen.conf +rad1=ssidOWE.conf +rad2=ssidOpen-2.conf +rad3=ssidOWE-2.conf
autotests/testOWE-transition/main.conf new file +2 -0
@@ -0,0 +1,2 @@ +[Scan] +DisableMacAddressRandomization=true
autotests/testOWE-transition/ssidOWE.conf new file +14 -0
@@ -0,0 +1,14 @@ +ssid=owe-hidden +bssid=02:00:00:00:f1:00 +channel=1 +ignore_broadcast_ssid=1 +ieee80211w=1 + +wpa=2 +wpa_key_mgmt=OWE +rsn_pairwise=CCMP + +# You would conventionally use these options but hostapd does not include an +# IE for the OWE network, hence vendor_elements must be used directly +#owe_transition_ssid="transition" +#owe_transition_bssid=02:00:00:00:f0:00
autotests/testOWE-transition/ssidOpen.conf new file +8 -0
@@ -0,0 +1,8 @@ +channel=1 +ssid=transition +bssid=02:00:00:00:f0:00 + +# You would conventionally use these options but hostapd does not include an +# IE for the OWE network, hence vendor_elements must be used directly +#owe_transition_ssid="owe-hidden" +#owe_transition_bssid=02:00:00:00:f1:00
autotests/testOWE-transition/transition.open new file +0 -0
Signature · 1 line
2.31.1