commit da0fa4e01292ef0ace2e361a572af49334a96cda
parent 7e9971661bcb6fac5f8bd6f2c013354c56d8b396
Author: Denis Kenzior <denkenz@gmail.com>
Date: Wed, 4 Aug 2021 15:53:43 -0500
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.
Diffstat:
3 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/network.c b/src/network.c
@@ -1608,14 +1608,6 @@ void network_blacklist_add(struct network *network, struct scan_bss *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,
struct l_dbus_message *message,
struct l_dbus_message_builder *builder,
diff --git a/src/network.h b/src/network.h
@@ -85,9 +85,6 @@ struct l_dbus_message *network_connect_new_hidden_network(
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);
const struct l_queue_entry *network_bss_list_get_entries(
diff --git a/src/station.c b/src/station.c
@@ -891,7 +891,10 @@ static struct handshake_state *station_handshake_setup(struct station *station,
struct scan_bss *bss)
{
struct wiphy *wiphy = station->wiphy;
+ const struct network_info *info = network_get_info(network);
struct handshake_state *hs;
+ const struct iovec *vendor_ies;
+ size_t iov_elems = 0;
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)
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;
not_supported:
@@ -1720,6 +1726,10 @@ static void station_transition_start(struct station *station,
/* Can we use Fast Transition? */
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 */
if (station_build_handshake_rsn(hs, station->wiphy,
station->connected_network, bss) < 0) {
@@ -1728,6 +1738,10 @@ static void station_transition_start(struct station *station,
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 */
if ((hs->mde[4] & 1) && station->signal_low) {
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,
struct scan_bss *bss)
{
- const struct iovec *extra_ies;
- size_t iov_elems = 0;
struct handshake_state *hs;
int r;
@@ -2557,10 +2569,8 @@ int __station_connect_network(struct station *station, struct network *network,
if (!hs)
return -ENOTSUP;
- extra_ies = network_get_extra_ies(network, &iov_elems);
-
- r = netdev_connect(station->netdev, bss, hs, extra_ies,
- iov_elems, station_netdev_event,
+ r = netdev_connect(station->netdev, bss, hs, NULL, 0,
+ station_netdev_event,
station_connect_cb, station);
if (r < 0) {
handshake_state_free(hs);