4040#include "src/offchannel.h"
4141#include "src/wiphy.h"
4242
43+ static const unsigned int FT_ONCHANNEL_TIME = 300u ; /* ms */
44+
4345static ft_tx_frame_func_t tx_frame = NULL ;
4446static ft_tx_associate_func_t tx_assoc = NULL ;
4547static struct l_queue * info_list = NULL ;
@@ -63,6 +65,7 @@ struct ft_info {
6365 struct ie_ft_info ft_info ;
6466
6567 bool parsed : 1 ;
68+ bool onchannel : 1 ;
6669};
6770
6871/*
@@ -1009,8 +1012,17 @@ void __ft_rx_authenticate(uint32_t ifindex, const uint8_t *frame,
10091012 info -> parsed = true;
10101013
10111014cancel :
1012- /* Verified to be expected target, offchannel can be canceled */
1013- offchannel_cancel (netdev_get_wdev_id (netdev ), info -> offchannel_id );
1015+ /*
1016+ * Verified to be expected target, offchannel or onchannel work can
1017+ * now be canceled
1018+ */
1019+ if (info -> onchannel ) {
1020+ l_timeout_remove (info -> timeout );
1021+ info -> timeout = NULL ;
1022+ wiphy_radio_work_done (netdev_get_wiphy (netdev ), info -> work .id );
1023+ } else
1024+ offchannel_cancel (netdev_get_wdev_id (netdev ),
1025+ info -> offchannel_id );
10141026}
10151027
10161028static void ft_send_authenticate (void * user_data )
@@ -1023,6 +1035,8 @@ static void ft_send_authenticate(void *user_data)
10231035 struct iovec iov [2 ];
10241036 struct mmpdu_authentication auth ;
10251037
1038+ l_debug ("" );
1039+
10261040 /* Authentication body */
10271041 auth .algorithm = L_CPU_TO_LE16 (MMPDU_AUTH_ALGO_FT );
10281042 auth .transaction_sequence = L_CPU_TO_LE16 (1 );
@@ -1079,6 +1093,45 @@ int ft_authenticate(uint32_t ifindex, const struct scan_bss *target)
10791093 return 0 ;
10801094}
10811095
1096+ static void ft_onchannel_timeout (struct l_timeout * timeout , void * user_data )
1097+ {
1098+ struct ft_info * info = user_data ;
1099+ struct netdev * netdev = netdev_find (info -> ifindex );
1100+
1101+ wiphy_radio_work_done (netdev_get_wiphy (netdev ), info -> work .id );
1102+ }
1103+
1104+ static bool ft_send_authenticate_onchannel (struct wiphy_radio_work_item * work )
1105+ {
1106+ struct ft_info * info = l_container_of (work , struct ft_info , work );
1107+
1108+ ft_send_authenticate (info );
1109+
1110+ info -> timeout = l_timeout_create_ms (FT_ONCHANNEL_TIME ,
1111+ ft_onchannel_timeout ,
1112+ info , NULL );
1113+ return false;
1114+ }
1115+
1116+ struct wiphy_radio_work_item_ops ft_onchannel_ops = {
1117+ .do_work = ft_send_authenticate_onchannel ,
1118+ };
1119+
1120+ int ft_authenticate_onchannel (uint32_t ifindex , const struct scan_bss * target )
1121+ {
1122+ struct netdev * netdev = netdev_find (ifindex );
1123+ struct handshake_state * hs = netdev_get_handshake (netdev );
1124+ struct ft_info * info = ft_info_new (hs , target );
1125+
1126+ info -> onchannel = true;
1127+
1128+ wiphy_radio_work_insert (netdev_get_wiphy (netdev ), & info -> work ,
1129+ WIPHY_WORK_PRIORITY_FT , & ft_onchannel_ops );
1130+ l_queue_push_tail (info_list , info );
1131+
1132+ return 0 ;
1133+ }
1134+
10821135int ft_associate (uint32_t ifindex , const uint8_t * addr )
10831136{
10841137 struct netdev * netdev = netdev_find (ifindex );
0 commit comments