Handling of new lifetime limits added to stroke.
This commit is contained in:
@@ -92,6 +92,16 @@ struct lifetime_cfg_t {
|
||||
u_int64_t jitter_packets;
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper macro to easily set all three values of a specified limit (time,
|
||||
* bytes, packets).
|
||||
*/
|
||||
#define LIFETIME_CFG_SET(l, limit, life, rekey, jitter) do { \
|
||||
(l)->life_##limit = (life); \
|
||||
(l)->rekey_##limit = (rekey); \
|
||||
(l)->jitter_##limit = (jitter); \
|
||||
} while(0)
|
||||
|
||||
/**
|
||||
* Create a new lifetime_cfg_t object.
|
||||
*/
|
||||
@@ -108,9 +118,7 @@ static inline lifetime_cfg_t* lifetime_cfg_create_time(u_int64_t life,
|
||||
u_int64_t rekey, u_int64_t jitter)
|
||||
{
|
||||
lifetime_cfg_t *this = lifetime_cfg_create();
|
||||
this->life_time = life;
|
||||
this->rekey_time = rekey;
|
||||
this->jitter_time = jitter;
|
||||
LIFETIME_CFG_SET(this, time, life, rekey, jitter);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -772,6 +772,14 @@ static child_cfg_t *build_child_cfg(private_stroke_config_t *this,
|
||||
msg->add_conn.rekey.ipsec_lifetime,
|
||||
msg->add_conn.rekey.ipsec_lifetime - msg->add_conn.rekey.margin,
|
||||
msg->add_conn.rekey.margin * msg->add_conn.rekey.fuzz / 100);
|
||||
LIFETIME_CFG_SET(lifetime, bytes,
|
||||
msg->add_conn.rekey.life_bytes,
|
||||
msg->add_conn.rekey.life_bytes - msg->add_conn.rekey.margin_bytes,
|
||||
msg->add_conn.rekey.margin_bytes * msg->add_conn.rekey.fuzz / 100);
|
||||
LIFETIME_CFG_SET(lifetime, packets,
|
||||
msg->add_conn.rekey.life_packets,
|
||||
msg->add_conn.rekey.life_packets - msg->add_conn.rekey.margin_packets,
|
||||
msg->add_conn.rekey.margin_packets * msg->add_conn.rekey.fuzz / 100);
|
||||
|
||||
child_cfg = child_cfg_create(
|
||||
msg->add_conn.name, lifetime,
|
||||
|
||||
Reference in New Issue
Block a user