network: add __network_path_append_bss
PATCH 1/6 network: add __network_path_append_bss
To reduce code duplication and prepare for moving the BSS interface to station, add a new API so station can create a BSS path without a network object directly.
--- src/network.c | 12 +++++++++--- src/network.h | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-)
src/network.c +9 -3
@@ -1130,17 +1130,23 @@ bool network_update_known_frequencies(struct network *network)return true; } -const char *network_bss_get_path (const struct network *network, -const struct scan_bss *bss) +const char *__network_path_append_bss (const char *network_path, +const struct scan_bss *bss) {static char path[256 ];snprintf (path,sizeof (path),"%s/%02x%02x%02x%02x%02x%02x" , - network->object_path,MAC_STR (bss->addr)); + network_path,MAC_STR (bss->addr));return path; } +const char *network_bss_get_path (const struct network *network, +const struct scan_bss *bss) +{ +return __network_path_append_bss (network->object_path, bss); +} +static bool network_unregister_bss (void *a,void *user_data) {struct scan_bss *bss = a;
src/network.h +3 -0
@@ -77,6 +77,9 @@ const char *network_bss_get_path(const struct network *network, const struct scan_bss *bss);bool network_bss_list_isempty (struct network *network); +const char *__network_path_append_bss (const char *network_path, +const struct scan_bss *bss); +struct scan_bss *network_bss_list_pop (struct network *network);struct scan_bss *network_bss_find_by_addr (struct network *network,const uint8_t *addr);
Signature · 1 line
2.34.1
PATCH 2/6 station: move BasicServiceSet DBus management into station
Due to an unnoticed bug after adding the BasicServiceSet object into network, it became clear that since station already owns the scan_bss objects it makes sense for it to manage the associated DBus objects as well. This way network doesn't have to jump through hoops to determine if the scan_bss object was remove, added, or updated. It can just manage its list as it did prior.
From the station side this makes things very easy. When scan results come in we either update or add a new DBus object. And any time a scan_bss is freed we remove the DBus object.
--- src/station.c | 89 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 72 insertions(+), 17 deletions(-)
src/station.c +72 -17
@@ -350,8 +350,6 @@ static bool process_network(const void *key, void *data, void *user_data)struct process_network_data *process_data = user_data;struct station *station = process_data->station; -network_bss_stop_update (network, process_data->freqs); -if (!network_bss_list_isempty (network)) {bool connected = network == station->connected_network;
@@ -431,6 +429,65 @@ static void station_print_scan_bss(const struct scan_bss *bss) optional); } +static const char *station_get_bss_path (struct station *station, +struct scan_bss *bss) +{ +enum security security; +char ssid[33 ]; +const char *network_path; + +memcpy (ssid, bss->ssid, bss->ssid_len); + ssid[bss->ssid_len] ='\0' ; + +if (scan_bss_get_security (bss, &security) <0 ) +return NULL ; + + network_path =iwd_network_get_path (station, ssid, security); +if (!network_path) +return NULL ; + +return __network_path_append_bss (network_path, bss); +} + +static bool station_unregister_bss (struct station *station, +struct scan_bss *bss) +{ +const char *path =station_get_bss_path (station, bss); + +if (L_WARN_ON (!path)) +return false; + +return l_dbus_unregister_object (dbus_get_bus (), path); +} + +static bool station_register_bss (struct station *station,struct scan_bss *bss) +{ +struct scan_bss *old; +const char *path =station_get_bss_path (station, bss); + +if (L_WARN_ON (!path)) +return false; + +/* +* If we find this path in the object tree update the data to the new +* scan_bss pointer, as this one will be freed soon. +*/ + old =l_dbus_object_get_data (dbus_get_bus (), path,IWD_BSS_INTERFACE ); +if (old) +return l_dbus_object_set_data (dbus_get_bus (), path, +IWD_BSS_INTERFACE , bss); + +if (!l_dbus_object_add_interface (dbus_get_bus (), path, +IWD_BSS_INTERFACE , bss)) +return false; + +if (!l_dbus_object_add_interface (dbus_get_bus (), path, +L_DBUS_INTERFACE_PROPERTIES , bss)) +return false; + +return true; +} +/* * Returns the network object the BSS was added to or NULL if ignored. */
@@ -518,6 +575,7 @@ static struct network *station_add_seen_bss(struct station *station, }network_bss_add (network, bss); +station_register_bss (station, bss);return network; }
@@ -540,7 +598,7 @@ struct bss_expiration_data {struct scan_bss *connected_bss;uint64_t now;const struct scan_freq_set *freqs; -struct l_queue *free_list; +struct station *station; };#define SCAN_RESULT_BSS_RETENTION_TIME (30 * 1000000)
@@ -562,20 +620,21 @@ static bool bss_free_if_expired(void *data, void *user_data) bss->time_stamp + SCAN_RESULT_BSS_RETENTION_TIME))return false; -l_queue_push_head (expiration_data->free_list, bss); +station_unregister_bss (expiration_data->station, bss); + +scan_bss_free (bss);return true; }static void station_bss_list_remove_expired_bsses (struct station *station, -const struct scan_freq_set *freqs, -struct l_queue *free_list) +const struct scan_freq_set *freqs) {struct bss_expiration_data data = { .now =l_time_now (), .connected_bss = station->connected_bss, .freqs = freqs, - .free_list = free_list, + .station = station, };l_queue_foreach_remove (station->bss_list, bss_free_if_expired, &data);
@@ -823,6 +882,7 @@ static bool station_owe_transition_results(int err, struct l_queue *bss_list,l_queue_push_tail (station->bss_list, bss);network_bss_add (network, bss); +station_register_bss (station, bss);continue ;
@@ -951,7 +1011,6 @@ void station_set_scan_results(struct station *station,const struct l_queue_entry *bss_entry;struct network *network;struct process_network_data data; -struct l_queue *free_list =l_queue_new ();l_queue_foreach_remove (new_bss_list, bss_free_if_ssid_not_utf8,NULL );
@@ -963,7 +1022,7 @@ void station_set_scan_results(struct station *station,l_queue_destroy (station->autoconnect_list,NULL ); station->autoconnect_list =NULL ; -station_bss_list_remove_expired_bsses (station, freqs, free_list); +station_bss_list_remove_expired_bsses (station, freqs);for (bss_entry =l_queue_get_entries (station->bss_list); bss_entry; bss_entry = bss_entry->next) {
@@ -975,12 +1034,8 @@ void station_set_scan_results(struct station *station,if (old_bss == station->connected_bss) station->connected_bss = new_bss; -/* -* The network object is still holding a reference to -* the BSS. Until we tell network to replace the BSS -* with a new object, don't free it. -*/ -l_queue_push_head (free_list, old_bss); +station_register_bss (station, new_bss); +scan_bss_free (old_bss);continue ; }
@@ -1017,8 +1072,6 @@ void station_set_scan_results(struct station *station,l_hashmap_foreach_remove (station->networks, process_network, &data); -l_queue_destroy (free_list, bss_free); - station->autoconnect_can_start = trigger_autoconnect;station_autoconnect_start (station); }
@@ -2652,6 +2705,7 @@ static void station_update_roam_bss(struct station *station,l_queue_remove_if (station->bss_list, bss_match, bss);network_bss_update (network, bss); +station_register_bss (station, bss);l_queue_push_tail (station->bss_list, bss);if (old)
@@ -3160,6 +3214,7 @@ static void station_event_roamed(struct station *station, struct scan_bss *new)struct scan_bss *stale;network_bss_update (station->connected_network, new); +station_register_bss (station, new);/* Remove new BSS if it exists in past scan results */ stale =l_queue_remove_if (station->bss_list, bss_match, new);
Signature · 1 line
2.34.1
Re: [PATCH 2/6] station: move BasicServiceSet DBus management into station
Hi James,
Quoted 14 lines · James Prestwood
Due to an unnoticed bug after adding the BasicServiceSet object into network, it became clear that since station already owns the
scan_bssobjects it makes sense for it to manage the associated DBus objects as well. This way network doesn't have to jump through hoops to determine if thescan_bssobject was remove, added, or updated. It can just manage its list as it did prior.From the station side this makes things very easy. When scan results
come in we either update or add a new DBus object. And any time ascan_bssis freed we remove the DBus object.--- src/station.c | 89 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 72 insertions(+), 17 deletions(-)
<snip>
Quoted 67 lines
src/station.c +59
-0@@ -431,6 +429,65 @@ static void station_print_scan_bss(const struct scan_bss *bss) optional); } +static const char *station_get_bss_path (struct station *station, +struct scan_bss *bss) +{ +enum security security; +char ssid[33 ]; +const char *network_path; + +memcpy (ssid, bss->ssid, bss->ssid_len); + ssid[bss->ssid_len] ='\0' ; + +if (scan_bss_get_security (bss, &security) <0 ) +return NULL ; + + network_path =iwd_network_get_path (station, ssid, security); +if (!network_path) +return NULL ; + +return __network_path_append_bss (network_path, bss); +} + +static bool station_unregister_bss (struct station *station, +struct scan_bss *bss) +{ +const char *path =station_get_bss_path (station, bss); + +if (L_WARN_ON (!path)) +return false; + +return l_dbus_unregister_object (dbus_get_bus (), path); +} + +static bool station_register_bss (struct station *station,struct scan_bss *bss) +{ +struct scan_bss *old; +const char *path =station_get_bss_path (station, bss); + +if (L_WARN_ON (!path)) +return false; + +/* +* If we find this path in the object tree update the data to the new +* scan_bss pointer, as this one will be freed soon. +*/ + old =l_dbus_object_get_data (dbus_get_bus (), path,IWD_BSS_INTERFACE ); +if (old) +return l_dbus_object_set_data (dbus_get_bus (), path, +IWD_BSS_INTERFACE , bss); + +if (!l_dbus_object_add_interface (dbus_get_bus (), path, +IWD_BSS_INTERFACE , bss)) +return false; + +if (!l_dbus_object_add_interface (dbus_get_bus (), path, +L_DBUS_INTERFACE_PROPERTIES , bss)) +return false; + +return true; +} +/* * Returns the network object the BSS was added to or NULL if ignored. */
src/station.c static struct network *station_add_seen_bss(struct station *station, · line 578
Quoted 4 lines
src/station.c +1
-0@@ -518,6 +575,7 @@ static struct network *station_add_seen_bss(struct station *station, }network_bss_add (network, bss); +station_register_bss (station, bss);
Hmm, you have the network object right above? Can you utilize that somehow?
Quoted 39 lines
src/station.c +6
-5return network; }@@ -540,7 +598,7 @@ struct bss_expiration_data {struct scan_bss *connected_bss;uint64_t now;const struct scan_freq_set *freqs; -struct l_queue *free_list; +struct station *station; };#define SCAN_RESULT_BSS_RETENTION_TIME (30 * 1000000)@@ -562,20 +620,21 @@ static bool bss_free_if_expired(void *data, void *user_data) bss->time_stamp + SCAN_RESULT_BSS_RETENTION_TIME))return false; -l_queue_push_head (expiration_data->free_list, bss); +station_unregister_bss (expiration_data->station, bss); + +scan_bss_free (bss);return true; }static void station_bss_list_remove_expired_bsses (struct station *station, -const struct scan_freq_set *freqs, -struct l_queue *free_list) +const struct scan_freq_set *freqs) {struct bss_expiration_data data = { .now =l_time_now (), .connected_bss = station->connected_bss, .freqs = freqs, - .free_list = free_list, + .station = station, };l_queue_foreach_remove (station->bss_list, bss_free_if_expired, &data);
src/station.c static bool station_owe_transition_results(int err, struct l_queue *bss_list, · line 885
Quoted 4 lines
src/station.c +1
-0@@ -823,6 +882,7 @@ static bool station_owe_transition_results(int err, struct l_queue *bss_list,l_queue_push_tail (station->bss_list, bss);network_bss_add (network, bss); +station_register_bss (station, bss);
Same comment as above.
Quoted 21 lines
src/station.c +1
-2continue ;@@ -951,7 +1011,6 @@ void station_set_scan_results(struct station *station,const struct l_queue_entry *bss_entry;struct network *network;struct process_network_data data; -struct l_queue *free_list =l_queue_new ();l_queue_foreach_remove (new_bss_list, bss_free_if_ssid_not_utf8,NULL );@@ -963,7 +1022,7 @@ void station_set_scan_results(struct station *station,l_queue_destroy (station->autoconnect_list,NULL ); station->autoconnect_list =NULL ; -station_bss_list_remove_expired_bsses (station, freqs, free_list); +station_bss_list_remove_expired_bsses (station, freqs);for (bss_entry =l_queue_get_entries (station->bss_list); bss_entry; bss_entry = bss_entry->next) {
src/station.c void station_set_scan_results(struct station *station, · line 1037
Quoted 10 lines
src/station.c +1
-6@@ -975,12 +1034,8 @@ void station_set_scan_results(struct station *station,if (old_bss == station->connected_bss) station->connected_bss = new_bss; -/* -* The network object is still holding a reference to -* the BSS. Until we tell network to replace the BSS -* with a new object, don't free it. -*/ -l_queue_push_head (free_list, old_bss); +station_register_bss (station, new_bss);
Why do this here? Can't you do this step in the loop below where we figure out the network object?
Quoted 14 lines
src/station.c +1
-2+scan_bss_free (old_bss);continue ; }@@ -1017,8 +1072,6 @@ void station_set_scan_results(struct station *station,l_hashmap_foreach_remove (station->networks, process_network, &data); -l_queue_destroy (free_list, bss_free); - station->autoconnect_can_start = trigger_autoconnect;station_autoconnect_start (station); }
src/station.c static void station_update_roam_bss(struct station *station, · line 2708
Quoted 4 lines
src/station.c +1
-0@@ -2652,6 +2705,7 @@ static void station_update_roam_bss(struct station *station,l_queue_remove_if (station->bss_list, bss_match, bss);network_bss_update (network, bss); +station_register_bss (station, bss);
Same here, can we use the network object somehow?
src/station.c static void station_event_roamed(struct station *station, struct scan_bss *new) · line 3217
Quoted 8 lines
src/station.c +1
-0l_queue_push_tail (station->bss_list, bss);if (old)@@ -3160,6 +3214,7 @@ static void station_event_roamed(struct station *station, struct scan_bss *new)struct scan_bss *stale;network_bss_update (station->connected_network, new); +station_register_bss (station, new);
And here
src/station.c static void station_event_roamed(struct station *station, struct scan_bss *new) · line 3220
Quoted 3 lines
src/station.c +0
-0/* Remove new BSS if it exists in past scan results */ stale =l_queue_remove_if (station->bss_list, bss_match, new);
Regards,
-Denis
PATCH 3/6 network: remove BasicServiceSet DBus registration code
In reply to James PrestwoodThis was moved into station.
--- src/network.c | 100 ++------------------------------------------------ src/network.h | 2 - 2 files changed, 4 insertions(+), 98 deletions(-)
src/network.c +4 -96
@@ -75,7 +75,6 @@ struct network {struct l_ecc_point *sae_pt_20;/* SAE PT for Group 20 */ unsigned int agent_request;struct l_queue *bss_list; -struct l_queue *old_bss_list;struct l_settings *settings;struct l_queue *secrets;struct l_queue *blacklist;/* temporary blacklist for BSS's */
@@ -1147,101 +1146,20 @@ const char *network_bss_get_path(const struct network *network,return __network_path_append_bss (network->object_path, bss); } -static bool network_unregister_bss (void *a,void *user_data) -{ -struct scan_bss *bss = a; -struct network *network = user_data; - -l_dbus_unregister_object (dbus_get_bus (), -network_bss_get_path (network, bss)); - -l_dbus_property_changed (dbus_get_bus (), network->object_path, -IWD_NETWORK_INTERFACE ,"ExtendedServiceSet" ); - -return true; -} - -static bool network_register_bss (struct network *network,struct scan_bss *bss) -{ -const char *path =network_bss_get_path (network, bss); -struct scan_bss *old; - -/* -* If we find this path in the object tree update the data to the new -* scan_bss pointer, as this one will be freed soon. -*/ - old =l_dbus_object_get_data (dbus_get_bus (), path,IWD_BSS_INTERFACE ); -if (old) -return l_dbus_object_set_data (dbus_get_bus (), path, -IWD_BSS_INTERFACE , bss); - -if (!l_dbus_object_add_interface (dbus_get_bus (), path, -IWD_BSS_INTERFACE , bss)) -return false; - -if (!l_dbus_object_add_interface (dbus_get_bus (), path, -L_DBUS_INTERFACE_PROPERTIES , bss)) -return false; - -l_dbus_property_changed (dbus_get_bus (), network->object_path, -IWD_NETWORK_INTERFACE ,"ExtendedServiceSet" ); - -return true; -} -void network_bss_start_update (struct network *network) { - network->old_bss_list = network->bss_list; +l_queue_destroy (network->bss_list,NULL ); network->bss_list =l_queue_new (); } -void network_bss_stop_update (struct network *network, -const struct scan_freq_set *limit_freqs) -{ -const struct l_queue_entry *e; - -/* -* Update has finished, clean up any BSS's from the old list that have -* been registered on DBus. -*/ -for (e =l_queue_get_entries (network->old_bss_list); e; e = e->next) { -const struct scan_bss *old = e->data; -const struct scan_bss *bss; -const char *path =network_bss_get_path (network, old); - - bss =l_dbus_object_get_data (dbus_get_bus (), path, -IWD_BSS_INTERFACE ); - -/* -* Don't remove BSS's who's frequencies were not in the set. -* This happens due to scan subsets (i.e. from station) so some -* BSS's won't be seen since the frequency is not being scanned. -* These BSS's will get cleared out eventually if they have -* actually disappeared. -*/ -if (!scan_freq_set_contains (limit_freqs, bss->frequency)) -continue ; - -/* -* The lookup matched the user data of an old BSS. This should -* be unregistered from DBus -*/ -if (bss && bss == old) -l_dbus_object_remove_interface (dbus_get_bus (), path, -IWD_BSS_INTERFACE ); - } - -l_queue_destroy (network->old_bss_list,NULL ); - network->old_bss_list =NULL ; -} -bool network_bss_add (struct network *network,struct scan_bss *bss) {if (!l_queue_insert (network->bss_list, bss, scan_bss_rank_compare,NULL ))return false; -network_register_bss (network, bss); +l_dbus_property_changed (dbus_get_bus (), network->object_path, +IWD_NETWORK_INTERFACE ,"ExtendedServiceSet" );/* Done if BSS is not HS20 or we already have network_info set */ if (!bss->hs20_capable)
@@ -1276,8 +1194,6 @@ bool network_bss_update(struct network *network, struct scan_bss *bss)l_queue_insert (network->bss_list, bss, scan_bss_rank_compare,NULL ); -network_register_bss (network, bss); -/* Sync frequency for already known networks */ if (network->info) {known_network_add_frequency (network->info, bss->frequency);
@@ -1294,12 +1210,7 @@ bool network_bss_list_isempty(struct network *network)struct scan_bss *network_bss_list_pop (struct network *network) { -struct scan_bss *bss =l_queue_pop_head (network->bss_list); - -if (bss) -network_unregister_bss (bss, network); - -return bss; +return l_queue_pop_head (network->bss_list); } struct scan_bss *network_bss_find_by_addr(struct network *network,
@@ -2030,9 +1941,6 @@ static void network_unregister(struct network *network, int reason)void network_remove (struct network *network,int reason) { -l_queue_foreach_remove (network->bss_list, - network_unregister_bss, network); -if (network->object_path)network_unregister (network, reason);
src/network.h +0 -2
@@ -69,8 +69,6 @@ int network_can_connect_bss(struct network *network,int network_autoconnect (struct network *network,struct scan_bss *bss);void network_connect_failed (struct network *network,bool in_handshake);void network_bss_start_update (struct network *network); -void network_bss_stop_update (struct network *network, -const struct scan_freq_set *freqs);bool network_bss_add (struct network *network,struct scan_bss *bss);bool network_bss_update (struct network *network,struct scan_bss *bss); const char *network_bss_get_path(const struct network *network,
Signature · 1 line
2.34.1
PATCH 4/6 network: add back network_bss_list_clear
In reply to James PrestwoodRename network_bss_update_start back to network_bss_list_clear, since this is what its now doing again.
--- src/network.c | 2 +- src/network.h | 2 +- src/station.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
src/network.c +1 -1
@@ -1146,7 +1146,7 @@ const char *network_bss_get_path(const struct network *network,return __network_path_append_bss (network->object_path, bss); } -void network_bss_start_update (struct network *network) +void network_bss_list_clear (struct network *network) {l_queue_destroy (network->bss_list,NULL ); network->bss_list =l_queue_new ();
src/network.h +1 -1
@@ -68,7 +68,7 @@ int network_can_connect_bss(struct network *network, const struct scan_bss *bss);int network_autoconnect (struct network *network,struct scan_bss *bss);void network_connect_failed (struct network *network,bool in_handshake); -void network_bss_start_update (struct network *network); +void network_bss_list_clear (struct network *network);bool network_bss_add (struct network *network,struct scan_bss *bss);bool network_bss_update (struct network *network,struct scan_bss *bss); const char *network_bss_get_path(const struct network *network,
src/station.c +1 -1
@@ -1015,7 +1015,7 @@ void station_set_scan_results(struct station *station,l_queue_foreach_remove (new_bss_list, bss_free_if_ssid_not_utf8,NULL );while ((network =l_queue_pop_head (station->networks_sorted))) -network_bss_start_update (network); +network_bss_list_clear (network);l_queue_clear (station->hidden_bss_list_sorted,NULL );
Signature · 1 line
2.34.1
PATCH 5/6 auto-t: Add ExtendedServiceSet property
In reply to James Prestwood--- autotests/util/iwd.py | 4 ++++ 1 file changed, 4 insertions(+)
autotests/util/iwd.py +4 -0
@@ -975,6 +975,10 @@ class Network(IWDDBusAbstract): ''' return bool(self._properties['Connected']) + @property + def extended_service_set(self): + return self._properties['ExtendedServiceSet'] + def connect(self, wait=True): ''' Connect to the network. Request the device implied by the object
Signature · 1 line
2.34.1
PATCH 6/6 auto-t: Add test for BasicServiceSets
In reply to James Prestwood--- .../basic_service_set_test.py | 100 ++++++++++++++++++ autotests/testBasicServiceSet/hw.conf | 7 ++ autotests/testBasicServiceSet/ssidTKIP-1.conf | 7 ++ autotests/testBasicServiceSet/ssidTKIP-2.conf | 7 ++ autotests/testBasicServiceSet/ssidTKIP.psk | 5 + 5 files changed, 126 insertions(+) create mode 100644 autotests/testBasicServiceSet/basic_service_set_test.py create mode 100644 autotests/testBasicServiceSet/hw.conf create mode 100644 autotests/testBasicServiceSet/ssidTKIP-1.conf create mode 100644 autotests/testBasicServiceSet/ssidTKIP-2.conf create mode 100644 autotests/testBasicServiceSet/ssidTKIP.psk
autotests/testBasicServiceSet/basic_service_set_test.py new file +100 -0
@@ -0,0 +1,100 @@ +#! /usr/bin/python3 + +import unittest +import sys, os + +sys.path.append('../util') +import iwd +from iwd import IWD +from iwd import PSKAgent +from iwd import NetworkType +from hwsim import Hwsim +from hostapd import HostapdCLI +import testutil + +class Test(unittest.TestCase): + def test_bss_unregister(self): + device = self.wd.list_devices(1)[0] + + ordered_network = device.get_ordered_network('ssidTKIP', full_scan=True) + network = ordered_network.network_object + + self.assertEqual(len(network.extended_service_set), 2) + + ends = [parts.split('/')[-1] for parts in network.extended_service_set] + + self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends) + self.assertIn(self.bss_hostapd[1].bssid.replace(':', ''), ends) + + self.rule_bss1.enabled = True + + # Even with flushing, the kernel still seems to return the scan + # results + self.wd.wait(40) + ordered_network = device.get_ordered_network('ssidTKIP', full_scan=True) + network = ordered_network.network_object + + ends = [parts.split('/')[-1] for parts in network.extended_service_set] + + self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends) + self.assertNotIn(self.bss_hostapd[1].bssid.replace(':', ''), ends) + + self.rule_bss0.enabled = True + + self.wd.wait(40) + ordered_networks = device.get_ordered_networks('ssidTKIP', full_scan=True) + self.assertIsNone(ordered_networks) + + self.rule_bss0.enabled = False + + ordered_networks = device.get_ordered_networks('ssidTKIP', full_scan=True) + ends = [parts.split('/')[-1] for parts in network.extended_service_set] + + self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends) + self.assertNotIn(self.bss_hostapd[1].bssid.replace(':', ''), ends) + + def tearDown(self): + self.rule_bss0.enabled = False + self.rule_bss1.enabled = False + + self.wd.stop() + self.wd.wait(10) + self.wd = None + + def setUp(self): + self.wd = IWD(True) + + @classmethod + def setUpClass(cls): + hwsim = Hwsim() + + IWD.copy_to_storage('ssidTKIP.psk') + + cls.bss_hostapd = [ HostapdCLI(config='ssidTKIP-1.conf'), + HostapdCLI(config='ssidTKIP-2.conf') ] + + + rad0 = hwsim.get_radio('rad0') + rad1 = hwsim.get_radio('rad1') + + cls.rule_bss0 = hwsim.rules.create() + cls.rule_bss0.source = rad0.addresses[0] + cls.rule_bss0.bidirectional = True + cls.rule_bss0.drop = True + + cls.rule_bss1 = hwsim.rules.create() + cls.rule_bss1.source = rad1.addresses[0] + cls.rule_bss1.bidirectional = True + cls.rule_bss1.drop = True + + + + @classmethod + def tearDownClass(cls): + IWD.clear_storage() + cls.bss_hostapd = None + cls.rule_bss0.remove() + cls.rule_bss1.remove() + +if __name__ == '__main__': + unittest.main(exit=True)
autotests/testBasicServiceSet/hw.conf new file +7 -0
@@ -0,0 +1,7 @@ +[SETUP] +num_radios=3 +hwsim_medium=yes + +[HOSTAPD] +rad0=ssidTKIP-1.conf +rad1=ssidTKIP-2.conf
autotests/testBasicServiceSet/ssidTKIP-1.conf new file +7 -0
@@ -0,0 +1,7 @@ +hw_mode=g +channel=1 +ssid=ssidTKIP + +wpa=1 +wpa_pairwise=TKIP +wpa_passphrase=secret123
autotests/testBasicServiceSet/ssidTKIP-2.conf new file +7 -0
@@ -0,0 +1,7 @@ +hw_mode=g +channel=2 +ssid=ssidTKIP + +wpa=1 +wpa_pairwise=TKIP +wpa_passphrase=secret123
autotests/testBasicServiceSet/ssidTKIP.psk new file +5 -0
@@ -0,0 +1,5 @@ +[Security] +Passphrase=secret123 + +[Settings] +AutoConnect=False
Signature · 1 line
2.34.1