3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 22:42:37 +01:00

station: Set network's vendor IEs into handshake

This guarantees that the vendor IEs will be used on ReAssociate and
Fast-Transition paths, as well as on all non-CMD_CONNECT based
connections.
This commit is contained in:
Denis Kenzior 2021-08-04 15:53:43 -05:00
parent 7e9971661b
commit da0fa4e012
3 changed files with 16 additions and 17 deletions

View File

@ -1608,14 +1608,6 @@ void network_blacklist_add(struct network *network, struct scan_bss *bss)
l_queue_push_head(network->blacklist, bss); l_queue_push_head(network->blacklist, bss);
} }
const struct iovec *network_get_extra_ies(struct network *network,
size_t *num_elems)
{
struct scan_bss *bss = network_bss_select(network, false);
return network_info_get_extra_ies(network->info, bss, num_elems);
}
static bool network_property_get_name(struct l_dbus *dbus, static bool network_property_get_name(struct l_dbus *dbus,
struct l_dbus_message *message, struct l_dbus_message *message,
struct l_dbus_message_builder *builder, struct l_dbus_message_builder *builder,

View File

@ -85,9 +85,6 @@ struct l_dbus_message *network_connect_new_hidden_network(
void network_blacklist_add(struct network *network, struct scan_bss *bss); void network_blacklist_add(struct network *network, struct scan_bss *bss);
const struct iovec *network_get_extra_ies(struct network *network,
size_t *num_elems);
struct erp_cache_entry *network_get_erp_cache(struct network *network); struct erp_cache_entry *network_get_erp_cache(struct network *network);
const struct l_queue_entry *network_bss_list_get_entries( const struct l_queue_entry *network_bss_list_get_entries(

View File

@ -891,7 +891,10 @@ static struct handshake_state *station_handshake_setup(struct station *station,
struct scan_bss *bss) struct scan_bss *bss)
{ {
struct wiphy *wiphy = station->wiphy; struct wiphy *wiphy = station->wiphy;
const struct network_info *info = network_get_info(network);
struct handshake_state *hs; struct handshake_state *hs;
const struct iovec *vendor_ies;
size_t iov_elems = 0;
hs = netdev_handshake_state_new(station->netdev); hs = netdev_handshake_state_new(station->netdev);
@ -905,6 +908,9 @@ static struct handshake_state *station_handshake_setup(struct station *station,
if (network_handshake_setup(network, hs) < 0) if (network_handshake_setup(network, hs) < 0)
goto not_supported; goto not_supported;
vendor_ies = network_info_get_extra_ies(info, bss, &iov_elems);
handshake_state_set_vendor_ies(hs, vendor_ies, iov_elems);
return hs; return hs;
not_supported: not_supported:
@ -1720,6 +1726,10 @@ static void station_transition_start(struct station *station,
/* Can we use Fast Transition? */ /* Can we use Fast Transition? */
if (station_can_fast_transition(hs, bss)) { if (station_can_fast_transition(hs, bss)) {
const struct network_info *info = network_get_info(connected);
const struct iovec *vendor_ies;
size_t iov_elems = 0;
/* Rebuild handshake RSN for target AP */ /* Rebuild handshake RSN for target AP */
if (station_build_handshake_rsn(hs, station->wiphy, if (station_build_handshake_rsn(hs, station->wiphy,
station->connected_network, bss) < 0) { station->connected_network, bss) < 0) {
@ -1728,6 +1738,10 @@ static void station_transition_start(struct station *station,
return; return;
} }
/* Reset the vendor_ies in case they're different */
vendor_ies = network_info_get_extra_ies(info, bss, &iov_elems);
handshake_state_set_vendor_ies(hs, vendor_ies, iov_elems);
/* FT-over-DS can be better suited for these situations */ /* FT-over-DS can be better suited for these situations */
if ((hs->mde[4] & 1) && station->signal_low) { if ((hs->mde[4] & 1) && station->signal_low) {
ret = netdev_fast_transition_over_ds(station->netdev, ret = netdev_fast_transition_over_ds(station->netdev,
@ -2548,8 +2562,6 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event,
int __station_connect_network(struct station *station, struct network *network, int __station_connect_network(struct station *station, struct network *network,
struct scan_bss *bss) struct scan_bss *bss)
{ {
const struct iovec *extra_ies;
size_t iov_elems = 0;
struct handshake_state *hs; struct handshake_state *hs;
int r; int r;
@ -2557,10 +2569,8 @@ int __station_connect_network(struct station *station, struct network *network,
if (!hs) if (!hs)
return -ENOTSUP; return -ENOTSUP;
extra_ies = network_get_extra_ies(network, &iov_elems); r = netdev_connect(station->netdev, bss, hs, NULL, 0,
station_netdev_event,
r = netdev_connect(station->netdev, bss, hs, extra_ies,
iov_elems, station_netdev_event,
station_connect_cb, station); station_connect_cb, station);
if (r < 0) { if (r < 0) {
handshake_state_free(hs); handshake_state_free(hs);