frame-xchg: add type to frame_xchg_prefix
PATCH 1/9 frame-xchg: add type to frame_xchg_prefix
All uses of frame-xchg were for action frames, and the frame type was hard coded. Soon other frame types will be needed so the type must now be specified in the frame_xchg_prefix structure.
--- src/anqp.c | 1 + src/frame-xchg.c | 2 +- src/frame-xchg.h | 1 + src/p2p.c | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-)
src/anqp.c +1 -0
@@ -156,6 +156,7 @@ static bool anqp_response_frame_event(const struct mmpdu_header *hdr, }static const struct frame_xchg_prefix anqp_frame_prefix = { + .frame_type =0x00d0 , .data = (uint8_t []) {0x04 ,0x0b , },
src/frame-xchg.c +1 -1
@@ -1193,7 +1193,7 @@ uint32_t frame_xchg_startv(uint64_t wdev_id, struct iovec *frame, uint32_t freq, watch = l_new(struct frame_xchg_watch_data, 1); watch->prefix = prefix; watch->cb = va_arg(resp_args, void *); -frame_watch_add (wdev_id, group_id,0x00d0 , +frame_watch_add (wdev_id, group_id, prefix->frame_type, prefix->data, prefix->len, frame_xchg_resp_cb, fx,NULL );
src/frame-xchg.h +1 -0
@@ -32,6 +32,7 @@ typedef void (*frame_xchg_cb_t)(int err, void *user_data);typedef void (*frame_xchg_destroy_func_t )(void *user_data);struct frame_xchg_prefix { +uint16_t frame_type;const uint8_t *data;size_t len; };
src/p2p.c +4 -0
@@ -820,6 +820,7 @@ static void p2p_peer_frame_xchg(struct p2p_peer *peer, struct iovec *tx_body,static const struct frame_xchg_prefix p2p_frame_go_neg_req = {/* Management -> Public Action -> P2P -> GO Negotiation Request */ + .frame_type =0x00d0 , .data = (uint8_t []) {0x04 ,0x09 ,0x50 ,0x6f ,0x9a ,0x09 ,P2P_ACTION_GO_NEGOTIATION_REQ
@@ -829,6 +830,7 @@ static const struct frame_xchg_prefix p2p_frame_go_neg_req = {static const struct frame_xchg_prefix p2p_frame_go_neg_resp = {/* Management -> Public Action -> P2P -> GO Negotiation Response */ + .frame_type =0x00d0 , .data = (uint8_t []) {0x04 ,0x09 ,0x50 ,0x6f ,0x9a ,0x09 ,P2P_ACTION_GO_NEGOTIATION_RESP
@@ -838,6 +840,7 @@ static const struct frame_xchg_prefix p2p_frame_go_neg_resp = {static const struct frame_xchg_prefix p2p_frame_go_neg_confirm = {/* Management -> Public Action -> P2P -> GO Negotiation Confirm */ + .frame_type =0x00d0 , .data = (uint8_t []) {0x04 ,0x09 ,0x50 ,0x6f ,0x9a ,0x09 ,P2P_ACTION_GO_NEGOTIATION_CONFIRM
@@ -847,6 +850,7 @@ static const struct frame_xchg_prefix p2p_frame_go_neg_confirm = {static const struct frame_xchg_prefix p2p_frame_pd_resp = {/* Management -> Public Action -> P2P -> Provision Discovery Response */ + .frame_type =0x00d0 , .data = (uint8_t []) {0x04 ,0x09 ,0x50 ,0x6f ,0x9a ,0x09 ,P2P_ACTION_PROVISION_DISCOVERY_RESP
Signature · 1 line
2.34.3
PATCH 2/9 ft: netdev: rename structs/APIs to prepare for refactor
Much of the over-DS processing can be combined with over-air once the authenticate stage is performed via CMD_FRAME. To prepare for this rename all the 'over_ds' structs/APIs so the name makes sense once used with the over-air code path.
--- src/ft.c | 17 +++++------ src/ft.h | 17 ++++------- src/netdev.c | 81 ++++++++++++++++++++++++++-------------------------- 3 files changed, 53 insertions(+), 62 deletions(-)
src/ft.c +7 -10
@@ -348,7 +348,7 @@ static bool ft_verify_rsne(const uint8_t *rsne, const uint8_t *pmk_r0_name,return true; } -static int ft_parse_ies(struct handshake_state *hs, +static int parse_ies(struct handshake_state *hs, const uint8_t *authenticator_ie, const uint8_t *ies, size_t ies_len, const uint8_t **mde_out,
@@ -471,16 +471,14 @@ static bool mde_equal(const uint8_t *mde1, const uint8_t *mde2)return memcmp (mde1, mde1, mde1[1 ] +2 ) ==0 ; } -bool ft_over_ds_parse_action_ies (struct ft_ds_info *info, -struct handshake_state *hs, -const uint8_t *ies, -size_t ies_len) +bool ft_parse_ies (struct ft_info *info,struct handshake_state *hs, +const uint8_t *ies,size_t ies_len) {const uint8_t *mde =NULL ;const uint8_t *fte =NULL ;bool is_rsn = hs->supplicant_ie !=NULL ; -if (ft_parse_ies (hs, info->authenticator_ie, ies, ies_len, +if (parse_ies (hs, info->authenticator_ie, ies, ies_len, &mde, &fte) <0 )return false;
@@ -512,7 +510,7 @@ static int ft_process_ies(struct handshake_state *hs, const uint8_t *ies,if (!ies) goto ft_error; -if (ft_parse_ies (hs, hs->authenticator_ie, ies, ies_len, +if (parse_ies (hs, hs->authenticator_ie, ies, ies_len, &mde, &fte) <0 ) goto ft_error;
@@ -585,8 +583,7 @@ int ft_over_ds_parse_action_response(const uint8_t *frame, size_t frame_len,return 0 ; } -bool ft_over_ds_prepare_handshake (struct ft_ds_info *info, -struct handshake_state *hs) +bool ft_prepare_handshake (struct ft_info *info,struct handshake_state *hs) {if (!hs->supplicant_ie)return true;
@@ -606,7 +603,7 @@ bool ft_over_ds_prepare_handshake(struct ft_ds_info *info,return true; } -void ft_ds_info_free (struct ft_ds_info *info) +void ft_info_free (struct ft_info *info) { __typeof__(info->free) destroy = info->free;
src/ft.h +6 -11
@@ -28,9 +28,7 @@ typedef int (*ft_tx_associate_func_t)(struct iovec *ie_iov, size_t iov_len, void *user_data);typedef int (*ft_get_oci )(void *user_data); -typedef void (*ft_ds_free_func_t )(void *user_data); - -struct ft_ds_info { +struct ft_info {uint8_t spa[6 ];uint8_t aa[6 ];uint8_t snonce[32 ];
@@ -40,10 +38,10 @@ struct ft_ds_info {struct ie_ft_info ft_info; -void (*free)(struct ft_ds_info *s); +void (*free)(struct ft_info *s); }; -void ft_ds_info_free (struct ft_ds_info *info); +void ft_info_free (struct ft_info *info); bool ft_build_authenticate_ies(struct handshake_state *hs, bool ocvc, const uint8_t *new_snonce, uint8_t *buf,
@@ -54,10 +52,8 @@ int ft_over_ds_parse_action_response(const uint8_t *frame, size_t frame_len,const uint8_t **aa_out, const uint8_t **ies_out, size_t *ies_len); -bool ft_over_ds_parse_action_ies (struct ft_ds_info *info, -struct handshake_state *hs, -const uint8_t *ies, -size_t ies_len); +bool ft_parse_ies (struct ft_info *info,struct handshake_state *hs, +const uint8_t *ies,size_t ies_len); struct auth_proto *ft_over_air_sm_new(struct handshake_state *hs, ft_tx_authenticate_func_t tx_auth,
@@ -69,5 +65,4 @@ struct auth_proto *ft_over_ds_sm_new(struct handshake_state *hs,ft_tx_associate_func_t tx_assoc, void *user_data); -bool ft_over_ds_prepare_handshake (struct ft_ds_info *info, -struct handshake_state *hs); +bool ft_prepare_handshake (struct ft_info *info,struct handshake_state *hs);
src/netdev.c +40 -41
214 lines not on this page · raw message
Signature · 1 line
2.34.3
PATCH 3/9 station: have station_transition_start take a list of BSS's
In reply to James PrestwoodThis prepares for the FT-over-Air refactor, which will allow a candidate list to be provided to netdev_fast_transition. For now generate this candidate list but use the first (best) entry for the roam.
This does slightly change the logic and all roam candidates are added to stations->bss_list (where before only the best candidate was), but this shouldn't effect how IWD behaves externally.
--- src/station.c | 99 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 31 deletions(-)
src/station.c +68 -31
@@ -2181,13 +2181,14 @@ static void station_preauthenticate_cb(struct netdev *netdev, }static void station_transition_start (struct station *station, -struct scan_bss *bss) +struct l_queue *candidates) {struct handshake_state *hs =netdev_get_handshake (station->netdev);struct network *connected = station->connected_network;enum security security =network_get_security (connected);struct handshake_state *new_hs;struct ie_rsn_info cur_rsne, target_rsne; +struct scan_bss *bss =l_queue_peek_head (candidates);int ret; l_debug("%u, target %s", netdev_get_ifindex(station->netdev),
@@ -2311,14 +2312,15 @@ static bool station_roam_scan_notify(int err, struct l_queue *bss_list,struct station *station = userdata;struct network *network = station->connected_network;struct handshake_state *hs =netdev_get_handshake (station->netdev); -struct scan_bss *current_bss = station->connected_bss; +struct scan_bss *current_bss;struct scan_bss *bss; -struct scan_bss *best_bss =NULL ; -double best_bss_rank =0.0 ; +struct scan_bss *old_bss =NULL ; +double cur_bss_rank =0.0 ;static const double RANK_FT_FACTOR =1.3 ;uint16_t mdid;enum security orig_security, security;bool seen = false; +struct l_queue *candidates =NULL ;if (err) {station_roam_failed (station);
@@ -2337,6 +2339,27 @@ static bool station_roam_scan_notify(int err, struct l_queue *bss_list,ie_parse_mobility_domain_from_data (hs->mde, hs->mde[1 ] +2 , &mdid,NULL ,NULL ); +/* Ranks better than the current BSS will go into the candidates list */ + current_bss =l_queue_find (bss_list, bss_match_bssid, + station->connected_bss->addr); +if (!current_bss) { + cur_bss_rank =0 ; + current_bss = station->connected_bss; + }else + cur_bss_rank = current_bss->rank; + +if (hs->mde) + cur_bss_rank *=RANK_FT_FACTOR ; + +/* +* TODO: Best to base this check off the actual transition request by +* looking at disassociation imminent and bss termination bits. +* For now keep existing behavior by always roaming if there are +* any candidates. +*/ +if (station->ap_directed_roaming) + cur_bss_rank =0 ; +/* * BSSes in the bss_list come already ranked with their initial * association preference rank value. We only need to add preference
@@ -2387,51 +2410,59 @@ static bool station_roam_scan_notify(int err, struct l_queue *bss_list,if (hs->mde && bss->mde_present &&l_get_le16 (bss->mde) == mdid) rank *=RANK_FT_FACTOR ; -if (rank > best_bss_rank) { -if (best_bss) -scan_bss_free (best_bss); +if (rank <= cur_bss_rank) + goto next; + +if (!candidates) + candidates =l_queue_new (); - best_bss = bss; - best_bss_rank = rank; +l_queue_insert (candidates, bss, scan_bss_rank_compare,NULL ); -continue ; +l_debug ("Adding BSS " MAC " as roam candidate" , +MAC_STR (bss->addr)); +/* +* Should only get here if the rank is better than our current +* BSS. Any BSS's here need to be added to the bss_list in case +* they are chosen to roam to. This also avoids the need to +* free candidates entries separately. +*/ + old_bss =network_bss_find_by_addr (network, bss->addr); +if (old_bss) { +network_bss_update (network, bss); +l_queue_remove (station->bss_list, old_bss); +scan_bss_free (old_bss); + +l_queue_insert (station->bss_list, bss, + scan_bss_rank_compare,NULL ); + }else { +network_bss_add (network, bss); +l_queue_push_tail (station->bss_list, bss); } +continue ; next:scan_bss_free (bss); }l_queue_destroy (bss_list,NULL ); -if (!seen) - goto fail_free_bss; + bss =l_queue_peek_head (candidates);/* See if we have anywhere to roam to */ -if (!best_bss ||scan_bss_addr_eq (best_bss, station->connected_bss)) { -station_debug_event (station,"no-roam-candidates" ); +if (!seen || !bss ||scan_bss_addr_eq (bss, station->connected_bss)) goto fail_free_bss; - } - bss =network_bss_find_by_addr (network, best_bss->addr); -if (bss) { -network_bss_update (network, best_bss); -l_queue_remove (station->bss_list, bss); -scan_bss_free (bss); +station_transition_start (station, candidates); -l_queue_insert (station->bss_list, best_bss, - scan_bss_rank_compare,NULL ); - }else { -network_bss_add (network, best_bss); -l_queue_push_tail (station->bss_list, best_bss); - } - -station_transition_start (station, best_bss); +l_queue_destroy (candidates,NULL );return true; fail_free_bss: -if (best_bss) -scan_bss_free (best_bss); +station_debug_event (station,"no-roam-candidates" ); + +if (candidates) +l_queue_destroy (candidates,NULL );station_roam_failed (station);
@@ -4356,6 +4387,7 @@ static struct l_dbus_message *station_force_roam(struct l_dbus *dbus,struct l_dbus_message_iter iter;uint8_t *mac;uint32_t mac_len; +struct l_queue *candidate;if (!l_dbus_message_get_arguments (message,"ay" , &iter)) goto invalid_args;
@@ -4385,7 +4417,12 @@ static struct l_dbus_message *station_force_roam(struct l_dbus *dbus,/* The various roam routines expect this to be set from scanning */ station->preparing_roam = true; -station_transition_start (station, target); + candidate =l_queue_new (); +l_queue_push_head (candidate, target); + +station_transition_start (station, candidate); + +l_queue_destroy (candidate,NULL );return l_dbus_message_new_method_return (message);
Signature · 1 line
2.34.3
PATCH 4/9 station: don't set OCVC for FT AKMs
In reply to James PrestwoodUsing OCV in FT is now disabled, so if the AKM is FT don't set the capability or AP's may reject FT attempts.
--- src/station.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
src/station.c +7 -1
@@ -1110,9 +1110,15 @@ build_ie:* seen that they do not include the OCI in the 4-way handshake yet * still advertise the capability. Because of this OCV is disabled if * any offload features are detected (since IWD prefers to use offload). +* +* TODO: For now OCV is disabled if the network is FT capable. This is +* being done until support in the kernel is added to +* automatically include the OCI element for the association +* request. */ info.ocvc = !disable_ocv && bss_info.ocvc && info.mfpc && - !wiphy_can_offload (wiphy); + !wiphy_can_offload (wiphy) && + !IE_AKM_IS_FT (info.akm_suites);/* * IEEE 802.11-2020 9.4.2.24.4 states extended key IDs can only be used
Signature · 1 line
2.34.3
PATCH 5/9 ft: expose ft_parse_authentication_resp_frame
In reply to James PrestwoodThis will be needed by netdev when doing authentication off-channel.
--- src/ft.c | 2 +- src/ft.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
src/ft.c +1 -1
@@ -116,7 +116,7 @@ static bool ft_calculate_fte_mic(struct handshake_state *hs, uint8_t seq_num,* the start of the IE array (RSN, MD, FT, TI and RIC). * See 8.3.3.1 for the header and 8.3.3.11 for the body format. */ -static bool ft_parse_authentication_resp_frame(const uint8_t *data, size_t len, +bool ft_parse_authentication_resp_frame(const uint8_t *data, size_t len, const uint8_t *addr1, const uint8_t *addr2, const uint8_t *addr3, uint16_t auth_seq, uint16_t *out_status, const uint8_t **out_ies,
src/ft.h +5 -0
@@ -52,6 +52,11 @@ int ft_over_ds_parse_action_response(const uint8_t *frame, size_t frame_len,const uint8_t **aa_out, const uint8_t **ies_out, size_t *ies_len); +bool ft_parse_authentication_resp_frame (const uint8_t *data,size_t len, +const uint8_t *addr1,const uint8_t *addr2, +const uint8_t *addr3,uint16_t auth_seq, +uint16_t *out_status,const uint8_t **out_ies, +size_t *out_ies_len);bool ft_parse_ies (struct ft_info *info,struct handshake_state *hs,const uint8_t *ies,size_t ies_len);
Signature · 1 line
2.34.3
PATCH 6/9 ft: remove OCI element from auth/assoc
In reply to James PrestwoodFT is moving to authentication via CMD_FRAME which breaks the ability to get the OCI from the kernel (since its now an offchannel operation). Using OCI during FT isn't that useful anyways, so its being removed.
--- src/ft.c | 26 ++------------------------ src/ft.h | 2 +- src/netdev.c | 3 +-- 3 files changed, 4 insertions(+), 27 deletions(-)
src/ft.c +2 -24
@@ -233,10 +233,6 @@ static int ft_tx_reassociate(struct ft_sm *ft) rsn_info.num_pmkids =1 ; rsn_info.pmkids = hs->pmk_r1_name; -/* Always set OCVC false for FT-over-DS */ -if (ft->over_ds) - rsn_info.ocvc = false; - rsne =alloca (256 );ie_build_rsne (&rsn_info, rsne);
@@ -276,22 +272,6 @@ static int ft_tx_reassociate(struct ft_sm *ft)memcpy (ft_info.anonce, hs->anonce,32 );memcpy (ft_info.snonce, hs->snonce,32 ); -/* -* IEEE 802.11-2020 Section 13.7.1 FT reassociation in an RSN -* -* "If dot11RSNAOperatingChannelValidationActivated is true and -* the FTO indicates OCVC capability, the target AP shall -* ensure that OCI subelement of the FTE matches by ensuring -* that all of the following are true: -* - OCI subelement is present -* - Channel information in the OCI matches current -* operating channel parameters (see 12.2.9)" -*/ -if (hs->supplicant_ocvc && hs->chandef) { -oci_from_chandef (hs->chandef, ft_info.oci); - ft_info.oci_present = true; - } - fte =alloca (256 );ie_build_fast_bss_transition (&ft_info, kck_len, fte);
@@ -809,7 +789,7 @@ static bool ft_over_ds_start(struct auth_proto *ap)return ft_tx_reassociate (ft) ==0 ; } -bool ft_build_authenticate_ies (struct handshake_state *hs,bool ocvc, +bool ft_build_authenticate_ies (struct handshake_state *hs,const uint8_t *new_snonce,uint8_t *buf,size_t *len) {
@@ -838,7 +818,6 @@ bool ft_build_authenticate_ies(struct handshake_state *hs, bool ocvc, rsn_info.num_pmkids =1 ; rsn_info.pmkids = hs->pmk_r0_name; - rsn_info.ocvc = ocvc;ie_build_rsne (&rsn_info, ptr); ptr += ptr[1 ] +2 ;
@@ -889,8 +868,7 @@ static bool ft_start(struct auth_proto *ap)uint8_t buf[512 ];size_t len; -if (!ft_build_authenticate_ies (hs, hs->supplicant_ocvc, hs->snonce, - buf, &len)) +if (!ft_build_authenticate_ies (hs, hs->snonce, buf, &len))return false; iov.iov_base = buf;
src/ft.h +1 -1
@@ -43,7 +43,7 @@ struct ft_info {void ft_info_free (struct ft_info *info); -bool ft_build_authenticate_ies (struct handshake_state *hs,bool ocvc, +bool ft_build_authenticate_ies (struct handshake_state *hs,const uint8_t *new_snonce,uint8_t *buf,size_t *len);
src/netdev.c +1 -2
@@ -4757,8 +4757,7 @@ int netdev_fast_transition_over_ds_action(struct netdev *netdev, iovs[0 ].iov_base = ft_req; iovs[0 ].iov_len =sizeof (ft_req); -if (!ft_build_authenticate_ies (hs, false, info->super.snonce, - buf, &len)) +if (!ft_build_authenticate_ies (hs, info->super.snonce, buf, &len)) goto failed; iovs[1 ].iov_base = buf;
Signature · 1 line
2.34.3
PATCH 7/9 netdev: ft: do FT authentication offchannel
In reply to James PrestwoodThis removes the use of CMD_AUTHENTICATE from FT. The reason being that a station should be able to authenticate to multiple BSS's, then proceed to association with a single BSS. The kernel does not allow this since CMD_AUTHENTICATE actually transitions to the new BSS's channel and changes state making any failures fatal.
Instead userspace can do authentication using CMD_FRAME which allows any failures to be recoverable (during authentication). This is nearly identical to how FT-over-DS works where any auth failures (during the action state) just means you can avoid that BSS but can still transition to another without being disconnected.
--- src/ft.c | 103 +--------------------- src/ft.h | 2 - src/netdev.c | 243 +++++++++++++++++++++++++++++++++------------------ 3 files changed, 161 insertions(+), 187 deletions(-)
src/ft.c +1 -102
@@ -479,48 +479,6 @@ ft_error:return false; } -static int ft_process_ies (struct handshake_state *hs,const uint8_t *ies, -size_t ies_len) -{ -const uint8_t *mde =NULL ; -const uint8_t *fte =NULL ; -bool is_rsn = hs->supplicant_ie !=NULL ; - -/* Check 802.11r IEs */ -if (!ies) - goto ft_error; - -if (parse_ies (hs, hs->authenticator_ie, ies, ies_len, - &mde, &fte) <0 ) - goto ft_error; - -if (!mde_equal (hs->mde, mde)) - goto ft_error; - -if (is_rsn) { -struct ie_ft_info ft_info; - -if (!ft_parse_fte (hs, hs->snonce, fte, &ft_info)) - goto ft_error; - -handshake_state_set_fte (hs, fte); - -handshake_state_set_anonce (hs, ft_info.anonce); - -handshake_state_set_kh_ids (hs, ft_info.r0khid, - ft_info.r0khid_len, - ft_info.r1khid); - -handshake_state_derive_ptk (hs); - }else if (fte) - goto ft_error; - -return 0 ; - -ft_error: -return -EBADMSG ; -} - int ft_over_ds_parse_action_response(const uint8_t *frame, size_t frame_len, const uint8_t **spa_out, const uint8_t **aa_out,
@@ -597,40 +555,6 @@ void ft_info_free(struct ft_info *info)destroy (info); } -static int ft_rx_authenticate (struct auth_proto *ap,const uint8_t *frame, -size_t frame_len) -{ - struct ft_sm *ft = l_container_of(ap, struct ft_sm, ap); -uint16_t status_code =MMPDU_STATUS_CODE_UNSPECIFIED ; -const uint8_t *ies =NULL ; -size_t ies_len; -int ret; - -/* -* Parse the Authentication Response and validate the contents -* according to 12.5.2 / 12.5.4: RSN or non-RSN Over-the-air -* FT Protocol. -*/ -if (!ft_parse_authentication_resp_frame (frame, frame_len, ft->hs->spa, - ft->hs->aa, ft->hs->aa, -2 , &status_code, - &ies, &ies_len)) - goto auth_error; - -/* AP Rejected the authenticate / associate */ -if (status_code !=0 ) - goto auth_error; - - ret =ft_process_ies (ft->hs, ies, ies_len); -if (ret <0 ) - goto auth_error; - -return ft->get_oci (ft->user_data); - -auth_error: -return (int )status_code; -} -static int ft_rx_associate (struct auth_proto *ap,const uint8_t *frame,size_t frame_len) {
@@ -768,13 +692,6 @@ static int ft_rx_associate(struct auth_proto *ap, const uint8_t *frame,return 0 ; } -static int ft_rx_oci (struct auth_proto *ap) -{ - struct ft_sm *ft = l_container_of(ap, struct ft_sm, ap); - -return ft_tx_reassociate (ft); -} -static void ft_sm_free (struct auth_proto *ap) { struct ft_sm *ft = l_container_of(ap, struct ft_sm, ap);
@@ -863,41 +780,23 @@ bool ft_build_authenticate_ies(struct handshake_state *hs,static bool ft_start (struct auth_proto *ap) { struct ft_sm *ft = l_container_of(ap, struct ft_sm, ap); -struct handshake_state *hs = ft->hs; -struct iovec iov; -uint8_t buf[512 ]; -size_t len; -if (!ft_build_authenticate_ies (hs, hs->snonce, buf, &len)) -return false; - - iov.iov_base = buf; - iov.iov_len = len; - - ft->tx_auth (&iov,1 , ft->user_data); - -return true; +return ft_tx_reassociate (ft) ==0 ; }struct auth_proto *ft_over_air_sm_new (struct handshake_state *hs, -ft_tx_authenticate_func_t tx_auth,ft_tx_associate_func_t tx_assoc, -ft_get_oci get_oci,void *user_data) { struct ft_sm *ft = l_new(struct ft_sm, 1); - ft->tx_auth = tx_auth; ft->tx_assoc = tx_assoc; - ft->get_oci = get_oci; ft->hs = hs; ft->user_data = user_data; - ft->ap.rx_authenticate = ft_rx_authenticate; ft->ap.rx_associate = ft_rx_associate; ft->ap.start = ft_start; ft->ap.free = ft_sm_free; - ft->ap.rx_oci = ft_rx_oci;return &ft->ap; }
src/ft.h +0 -2
@@ -61,9 +61,7 @@ bool ft_parse_ies(struct ft_info *info, struct handshake_state *hs, const uint8_t *ies, size_t ies_len);struct auth_proto *ft_over_air_sm_new (struct handshake_state *hs, -ft_tx_authenticate_func_t tx_auth,ft_tx_associate_func_t tx_assoc, -ft_get_oci get_oci,void *user_data); struct auth_proto *ft_over_ds_sm_new(struct handshake_state *hs,
src/netdev.c +160 -83
327 lines not on this page · raw message
Signature · 1 line
2.34.3
PATCH 8/9 netdev: pass candidate list for netdev_fast_transition
In reply to James PrestwoodSince FT-over-air authentication is done offchannel any failures during this stage are non-fatal. This means if a BSS target fails to authenticate for whatever reason IWD can move onto another.
netdev_fast_transition now takes a list of scan_bss candidates, puts each into the ft_list (just like FT-over-DS) and tries each in order, proceeding to association on the first successful authentication. This assumes the candidate list is sorted with the head of the queue being the best ranked.
--- src/netdev.c | 84 +++++++++++++++++++++++++++++++++++++++++---------- src/netdev.h | 2 +- src/station.c | 2 +- 3 files changed, 70 insertions(+), 18 deletions(-)
src/netdev.c +68 -16
@@ -4591,6 +4591,25 @@ static const struct wiphy_radio_work_item_ops ft_work_ops = { .do_work = netdev_ft_work_ready, }; +static bool netdev_send_ft_authenticate (struct netdev *netdev, +struct netdev_ft_info *info); + +static bool netdev_ft_try_next_bss (struct netdev *netdev) +{ +struct netdev_ft_info *info; + + info =l_queue_pop_head (netdev->ft_list); +netdev_ft_entry_free (info); + +/* No more candidates */ +if (l_queue_isempty (netdev->ft_list)) +return false; + + info =l_queue_peek_head (netdev->ft_list); + +return netdev_send_ft_authenticate (netdev, info); +} + static void netdev_authenticate_response_ft_cb(const struct mmpdu_header *hdr, const void *body, size_t body_len, int rssi,
@@ -4607,13 +4626,13 @@ static void netdev_authenticate_response_ft_cb(const struct mmpdu_header *hdr, info->super.spa, info->super.aa, info->super.aa,2 , &status, &ies, &ies_len)) - goto failed; + goto next;if (status !=0 ) - goto failed; + goto next;if (!ft_parse_ies (&info->super, netdev->handshake, ies, ies_len)) - goto failed; + goto next;/* If we got here authentication was successful, continue with FT */ netdev->ap = ft_over_air_sm_new(netdev->handshake,
@@ -4627,11 +4646,17 @@ static void netdev_authenticate_response_ft_cb(const struct mmpdu_header *hdr,wiphy_radio_work_insert (netdev->wiphy, &netdev->work,WIPHY_WORK_PRIORITY_CONNECT , &ft_work_ops); +l_queue_destroy (netdev->ft_list, netdev_ft_entry_free); + netdev->ft_list =NULL ; +return ; -failed: -netdev_connect_failed (netdev,NETDEV_RESULT_ABORTED , -MMPDU_STATUS_CODE_UNSPECIFIED ); +next: +if (netdev_ft_try_next_bss (netdev)) +return ; + +netdev_connect_failed (netdev,NETDEV_RESULT_AUTHENTICATION_FAILED , +MMPDU_STATUS_CODE_UNSPECIFIED ); }static const struct frame_xchg_prefix ft_prefix = {
@@ -4644,9 +4669,14 @@ static void netdev_cmd_authenticate_ft_cb(int err, void *user_data) {struct netdev_ft_info *info = user_data; -if (err <0 ) - netdev_connect_failed(info->netdev, - NETDEV_RESULT_AUTHENTICATION_FAILED, +if (err ==0 ) +return ; + +if (netdev_ft_try_next_bss (info->netdev)) +return ; + +netdev_connect_failed (info->netdev,NETDEV_RESULT_AUTHENTICATION_FAILED , +MMPDU_STATUS_CODE_UNSPECIFIED ); } static bool netdev_send_ft_authenticate(struct netdev *netdev,
@@ -4728,26 +4758,48 @@ static struct netdev_ft_info *netdev_ft_info_new(struct netdev *netdev, }int netdev_fast_transition (struct netdev *netdev, -const struct scan_bss *target_bss, +struct l_queue *candidates,const struct scan_bss *orig_bss,netdev_connect_cb_t cb) {struct netdev_ft_info *info; +const struct l_queue_entry *entry;if (!netdev->operational)return -ENOTCONN ; -if (!netdev->handshake->mde || !target_bss->mde_present || -l_get_le16 (netdev->handshake->mde +2 ) != -l_get_le16 (target_bss->mde)) +if (!netdev->handshake->mde)return -EINVAL ; - netdev->connect_cb = cb; +/* Initialize info for all candidates */ +for (entry =l_queue_get_entries (candidates); entry; + entry = entry->next) { +struct scan_bss *bss = entry->data; - info =netdev_ft_info_new (netdev, target_bss); +if (!bss->mde_present || +l_get_le16 (netdev->handshake->mde +2 ) != +l_get_le16 (bss->mde)) +continue ; + + info =netdev_ft_info_new (netdev, bss); + +if (!netdev->ft_list) + netdev->ft_list =l_queue_new (); + +l_queue_push_tail (netdev->ft_list, info); + } + +if (l_queue_isempty (netdev->ft_list)) +return -EINVAL ; + +/* Begin with first candidate */ + info =l_queue_peek_head (netdev->ft_list); + + netdev->connect_cb = cb;if (!netdev_send_ft_authenticate (netdev, info)) { -netdev_ft_entry_free (info); +l_queue_destroy (netdev->ft_list, netdev_ft_entry_free); + netdev->ft_list =NULL ;return -EBADMSG ; }
src/netdev.h +1 -1
@@ -164,7 +164,7 @@ int netdev_reassociate(struct netdev *netdev, struct scan_bss *target_bss,netdev_event_func_t event_filter, netdev_connect_cb_t cb, void *user_data);int netdev_fast_transition (struct netdev *netdev, -const struct scan_bss *target_bss, +struct l_queue *candidates,const struct scan_bss *orig_bss,netdev_connect_cb_t cb); int netdev_fast_transition_over_ds_action(struct netdev *netdev,
src/station.c +1 -1
@@ -2238,7 +2238,7 @@ static void station_transition_start(struct station *station, } }else { try_over_air: -if (netdev_fast_transition (station->netdev, bss, +if (netdev_fast_transition (station->netdev, candidates, station->connected_bss, station_fast_transition_cb) <0 ) {station_roam_failed (station);
Signature · 1 line
2.34.3
PATCH 9/9 auto-t: add auth retry test to testPSK-roam
In reply to James PrestwoodThis tests the new behavior where IWD will try to FT-authenticate with another BSS if it fails.
--- autotests/testPSK-roam/connection_test.py | 2 +- autotests/testPSK-roam/ft-psk-ccmp-1.conf | 2 + autotests/testPSK-roam/ft-psk-ccmp-2.conf | 2 + autotests/testPSK-roam/ft-psk-ccmp-3.conf | 44 ++++++ autotests/testPSK-roam/hw.conf | 3 +- .../testPSK-roam/try_multiple_ft_test.py | 134 ++++++++++++++++++ 6 files changed, 185 insertions(+), 2 deletions(-) create mode 100644 autotests/testPSK-roam/ft-psk-ccmp-3.conf create mode 100644 autotests/testPSK-roam/try_multiple_ft_test.py
autotests/testPSK-roam/connection_test.py +1 -1
@@ -181,7 +181,7 @@ class Test(unittest.TestCase): cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'), HostapdCLI(config='ft-psk-ccmp-2.conf') ] rad0 = hwsim.get_radio('rad0') - rad2 = hwsim.get_radio('rad2') + rad2 = hwsim.get_radio('rad3') cls.rule0 = hwsim.rules.create() cls.rule0.source = rad2.addresses[0]
autotests/testPSK-roam/ft-psk-ccmp-1.conf +2 -0
@@ -26,8 +26,10 @@ mobility_domain=1234 reassociation_deadline=60000 r0kh=12:00:00:00:00:01 dummy1 000102030405060708090a0b0c0d0e0f r0kh=12:00:00:00:00:02 dummy2 000102030405060708090a0b0c0d0e0f +r0kh=12:00:00:00:00:03 dummy3 000102030405060708090a0b0c0d0e0f r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f +r1kh=12:00:00:00:00:03 00:00:00:00:00:03 000102030405060708090a0b0c0d0e0f # Push mode only needed for 8021x, not PSK mode since msk already known pmk_r1_push=0 # Allow locally generated FT response so we don't have to configure push/pull
autotests/testPSK-roam/ft-psk-ccmp-2.conf +2 -0
@@ -26,8 +26,10 @@ mobility_domain=1234 reassociation_deadline=60000 r0kh=12:00:00:00:00:01 dummy1 000102030405060708090a0b0c0d0e0f r0kh=12:00:00:00:00:02 dummy2 000102030405060708090a0b0c0d0e0f +r0kh=12:00:00:00:00:03 dummy3 000102030405060708090a0b0c0d0e0f r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f +r1kh=12:00:00:00:00:03 00:00:00:00:00:03 000102030405060708090a0b0c0d0e0f # Push mode only needed for 8021x, not PSK mode since msk already known pmk_r1_push=0 # Allow locally generated FT response so we don't have to configure push/pull
autotests/testPSK-roam/ft-psk-ccmp-3.conf new file +44 -0
44 lines not on this page · raw message
autotests/testPSK-roam/hw.conf +2 -1
@@ -1,8 +1,9 @@ [SETUP] -num_radios=3 +num_radios=4 start_iwd=0 hwsim_medium=yes [HOSTAPD] rad0=ft-psk-ccmp-1.conf rad1=ft-psk-ccmp-2.conf +rad2=ft-psk-ccmp-3.conf
autotests/testPSK-roam/try_multiple_ft_test.py new file +134 -0
134 lines not on this page · raw message
Signature · 1 line
2.34.3