fixed some rekey collision issues
added retry with jitter when rekeying fails
This commit is contained in:
@@ -72,6 +72,16 @@
|
||||
*/
|
||||
#define KEEPALIVE_INTERVAL 20
|
||||
|
||||
/**
|
||||
* retry interval in seconds.
|
||||
*/
|
||||
#define RETRY_INTERVAL 15
|
||||
|
||||
/**
|
||||
* jitter to user for retrying
|
||||
*/
|
||||
#define RETRY_JITTER 5
|
||||
|
||||
|
||||
typedef struct private_configuration_t private_configuration_t;
|
||||
|
||||
@@ -118,6 +128,14 @@ static u_int32_t get_keepalive_interval (private_configuration_t *this)
|
||||
return KEEPALIVE_INTERVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of configuration_t.get_retry_interval.
|
||||
*/
|
||||
static u_int32_t get_retry_interval (private_configuration_t *this)
|
||||
{
|
||||
return RETRY_INTERVAL - (random() % RETRY_JITTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of configuration_t.destroy.
|
||||
*/
|
||||
@@ -138,6 +156,7 @@ configuration_t *configuration_create()
|
||||
this->public.get_retransmit_timeout = (u_int32_t (*) (configuration_t*,u_int32_t))get_retransmit_timeout;
|
||||
this->public.get_half_open_ike_sa_timeout = (u_int32_t (*) (configuration_t*)) get_half_open_ike_sa_timeout;
|
||||
this->public.get_keepalive_interval = (u_int32_t (*) (configuration_t*)) get_keepalive_interval;
|
||||
this->public.get_retry_interval = (u_int32_t (*) (configuration_t*)) get_retry_interval;
|
||||
|
||||
return (&this->public);
|
||||
}
|
||||
|
||||
@@ -61,16 +61,27 @@ struct configuration_t {
|
||||
u_int32_t (*get_half_open_ike_sa_timeout) (configuration_t *this);
|
||||
|
||||
/**
|
||||
* @brief Returns the keepalive interval in ms.
|
||||
* @brief Returns the keepalive interval in s.
|
||||
*
|
||||
* The keepalive interval defines the idle time after which a
|
||||
* NAT keepalive packet should be sent.
|
||||
*
|
||||
* @param this calling object
|
||||
* @return interval in seconds
|
||||
* @return interval in s
|
||||
*/
|
||||
u_int32_t (*get_keepalive_interval) (configuration_t *this);
|
||||
|
||||
/**
|
||||
* @brief Returns the interval to retry a failed action again.
|
||||
*
|
||||
* In some situations, the protocol may be in a state where processing
|
||||
* is not possible and an action must be retried (e.g. rekeying).
|
||||
*
|
||||
* @param this calling object
|
||||
* @return interval in s
|
||||
*/
|
||||
u_int32_t (*get_retry_interval) (configuration_t *this);
|
||||
|
||||
/**
|
||||
* @brief Destroys a configuration_t object.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user