@ -19,12 +19,6 @@
# include "mesh_mpm.h"
# include "mesh_rsn.h"
/* TODO make configurable */
# define dot11MeshMaxRetries 10
# define dot11MeshRetryTimeout 1
# define dot11MeshConfirmTimeout 1
# define dot11MeshHoldingTimeout 1
struct mesh_peer_mgmt_ie {
const u8 * proto_id ;
const u8 * llid ;
@ -395,14 +389,17 @@ static void plink_timer(void *eloop_ctx, void *user_data)
struct wpa_supplicant * wpa_s = eloop_ctx ;
struct sta_info * sta = user_data ;
u16 reason = 0 ;
struct mesh_conf * conf = wpa_s - > ifmsh - > mconf ;
switch ( sta - > plink_state ) {
case PLINK_OPEN_RCVD :
case PLINK_OPEN_SENT :
/* retry timer */
if ( sta - > mpm_retries < dot11MeshMaxRetries ) {
eloop_register_timeout ( dot11MeshRetryTimeout , 0 ,
plink_timer , wpa_s , sta ) ;
if ( sta - > mpm_retries < conf - > dot11MeshMaxRetries ) {
eloop_register_timeout (
conf - > dot11MeshRetryTimeout / 1000 ,
( conf - > dot11MeshRetryTimeout % 1000 ) * 1000 ,
plink_timer , wpa_s , sta ) ;
mesh_mpm_send_plink_action ( wpa_s , sta , PLINK_OPEN , 0 ) ;
sta - > mpm_retries + + ;
break ;
@ -415,8 +412,9 @@ static void plink_timer(void *eloop_ctx, void *user_data)
if ( ! reason )
reason = WLAN_REASON_MESH_CONFIRM_TIMEOUT ;
sta - > plink_state = PLINK_HOLDING ;
eloop_register_timeout ( dot11MeshHoldingTimeout , 0 ,
plink_timer , wpa_s , sta ) ;
eloop_register_timeout ( conf - > dot11MeshHoldingTimeout / 1000 ,
( conf - > dot11MeshHoldingTimeout % 1000 ) * 1000 ,
plink_timer , wpa_s , sta ) ;
mesh_mpm_send_plink_action ( wpa_s , sta , PLINK_CLOSE , reason ) ;
break ;
case PLINK_HOLDING :
@ -434,9 +432,12 @@ static void
mesh_mpm_plink_open ( struct wpa_supplicant * wpa_s , struct sta_info * sta ,
enum mesh_plink_state next_state )
{
struct mesh_conf * conf = wpa_s - > ifmsh - > mconf ;
eloop_cancel_timeout ( plink_timer , wpa_s , sta ) ;
eloop_register_timeout ( dot11MeshRetryTimeout , 0 , plink_timer ,
wpa_s , sta ) ;
eloop_register_timeout ( conf - > dot11MeshRetryTimeout / 1000 ,
( conf - > dot11MeshRetryTimeout % 1000 ) * 1000 ,
plink_timer , wpa_s , sta ) ;
mesh_mpm_send_plink_action ( wpa_s , sta , PLINK_OPEN , 0 ) ;
wpa_mesh_set_plink_state ( wpa_s , sta , next_state ) ;
}
@ -670,8 +671,10 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state ( wpa_s , sta , PLINK_HOLDING ) ;
if ( ! reason )
reason = WLAN_REASON_MESH_CLOSE_RCVD ;
eloop_register_timeout ( dot11MeshHoldingTimeout , 0 ,
plink_timer , wpa_s , sta ) ;
eloop_register_timeout (
conf - > dot11MeshHoldingTimeout / 1000 ,
( conf - > dot11MeshHoldingTimeout % 1000 ) * 1000 ,
plink_timer , wpa_s , sta ) ;
mesh_mpm_send_plink_action ( wpa_s , sta ,
PLINK_CLOSE , reason ) ;
break ;
@ -683,8 +686,10 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
break ;
case CNF_ACPT :
wpa_mesh_set_plink_state ( wpa_s , sta , PLINK_CNF_RCVD ) ;
eloop_register_timeout ( dot11MeshConfirmTimeout , 0 ,
plink_timer , wpa_s , sta ) ;
eloop_register_timeout (
conf - > dot11MeshConfirmTimeout / 1000 ,
( conf - > dot11MeshConfirmTimeout % 1000 ) * 1000 ,
plink_timer , wpa_s , sta ) ;
break ;
default :
break ;
@ -700,8 +705,10 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state ( wpa_s , sta , PLINK_HOLDING ) ;
if ( ! reason )
reason = WLAN_REASON_MESH_CLOSE_RCVD ;
eloop_register_timeout ( dot11MeshHoldingTimeout , 0 ,
plink_timer , wpa_s , sta ) ;
eloop_register_timeout (
conf - > dot11MeshHoldingTimeout / 1000 ,
( conf - > dot11MeshHoldingTimeout % 1000 ) * 1000 ,
plink_timer , wpa_s , sta ) ;
sta - > mpm_close_reason = reason ;
mesh_mpm_send_plink_action ( wpa_s , sta ,
PLINK_CLOSE , reason ) ;
@ -729,8 +736,10 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state ( wpa_s , sta , PLINK_HOLDING ) ;
if ( ! reason )
reason = WLAN_REASON_MESH_CLOSE_RCVD ;
eloop_register_timeout ( dot11MeshHoldingTimeout , 0 ,
plink_timer , wpa_s , sta ) ;
eloop_register_timeout (
conf - > dot11MeshHoldingTimeout / 1000 ,
( conf - > dot11MeshHoldingTimeout % 1000 ) * 1000 ,
plink_timer , wpa_s , sta ) ;
sta - > mpm_close_reason = reason ;
mesh_mpm_send_plink_action ( wpa_s , sta ,
PLINK_CLOSE , reason ) ;
@ -750,8 +759,10 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state ( wpa_s , sta , PLINK_HOLDING ) ;
reason = WLAN_REASON_MESH_CLOSE_RCVD ;
eloop_register_timeout ( dot11MeshHoldingTimeout , 0 ,
plink_timer , wpa_s , sta ) ;
eloop_register_timeout (
conf - > dot11MeshHoldingTimeout / 1000 ,
( conf - > dot11MeshHoldingTimeout % 1000 ) * 1000 ,
plink_timer , wpa_s , sta ) ;
sta - > mpm_close_reason = reason ;
wpa_msg ( wpa_s , MSG_INFO , " mesh plink with " MACSTR