child-sa: Store and propagate optional acquire sequence number
This commit is contained in:
@@ -161,6 +161,11 @@ struct private_child_sa_t {
|
|||||||
*/
|
*/
|
||||||
uint32_t unique_id;
|
uint32_t unique_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional sequence number associated with triggering acquire
|
||||||
|
*/
|
||||||
|
uint32_t seq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether FWD policies in the outbound direction should be installed
|
* Whether FWD policies in the outbound direction should be installed
|
||||||
*/
|
*/
|
||||||
@@ -817,6 +822,18 @@ METHOD(child_sa_t, get_label, sec_label_t*,
|
|||||||
return this->label ?: this->config->get_label(this->config);
|
return this->label ?: this->config->get_label(this->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(child_sa_t, get_acquire_seq, uint32_t,
|
||||||
|
private_child_sa_t *this)
|
||||||
|
{
|
||||||
|
return this->seq;
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD(child_sa_t, set_acquire_seq, void,
|
||||||
|
private_child_sa_t *this, uint32_t seq)
|
||||||
|
{
|
||||||
|
this->seq = seq;
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(child_sa_t, get_lifetime, time_t,
|
METHOD(child_sa_t, get_lifetime, time_t,
|
||||||
private_child_sa_t *this, bool hard)
|
private_child_sa_t *this, bool hard)
|
||||||
{
|
{
|
||||||
@@ -1022,6 +1039,7 @@ static status_t install_internal(private_child_sa_t *this, chunk_t encr,
|
|||||||
};
|
};
|
||||||
sa = (kernel_ipsec_add_sa_t){
|
sa = (kernel_ipsec_add_sa_t){
|
||||||
.reqid = this->reqid,
|
.reqid = this->reqid,
|
||||||
|
.seq = this->seq,
|
||||||
.mode = this->mode,
|
.mode = this->mode,
|
||||||
.src_ts = src_ts,
|
.src_ts = src_ts,
|
||||||
.dst_ts = dst_ts,
|
.dst_ts = dst_ts,
|
||||||
@@ -2074,6 +2092,8 @@ child_sa_t *child_sa_create(host_t *me, host_t *other, child_cfg_t *config,
|
|||||||
.get_mark = _get_mark,
|
.get_mark = _get_mark,
|
||||||
.get_if_id = _get_if_id,
|
.get_if_id = _get_if_id,
|
||||||
.get_label = _get_label,
|
.get_label = _get_label,
|
||||||
|
.get_acquire_seq = _get_acquire_seq,
|
||||||
|
.set_acquire_seq = _set_acquire_seq,
|
||||||
.has_encap = _has_encap,
|
.has_encap = _has_encap,
|
||||||
.get_ipcomp = _get_ipcomp,
|
.get_ipcomp = _get_ipcomp,
|
||||||
.set_ipcomp = _set_ipcomp,
|
.set_ipcomp = _set_ipcomp,
|
||||||
@@ -2112,6 +2132,7 @@ child_sa_t *child_sa_create(host_t *me, host_t *other, child_cfg_t *config,
|
|||||||
.if_id_in = config->get_if_id(config, TRUE) ?: data->if_id_in_def,
|
.if_id_in = config->get_if_id(config, TRUE) ?: data->if_id_in_def,
|
||||||
.if_id_out = config->get_if_id(config, FALSE) ?: data->if_id_out_def,
|
.if_id_out = config->get_if_id(config, FALSE) ?: data->if_id_out_def,
|
||||||
.label = data->label ? data->label->clone(data->label) : NULL,
|
.label = data->label ? data->label->clone(data->label) : NULL,
|
||||||
|
.seq = data->seq,
|
||||||
.install_time = time_monotonic(NULL),
|
.install_time = time_monotonic(NULL),
|
||||||
.policies_fwd_out = config->has_option(config, OPT_FWD_OUT_POLICIES),
|
.policies_fwd_out = config->has_option(config, OPT_FWD_OUT_POLICIES),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -390,6 +390,22 @@ struct child_sa_t {
|
|||||||
*/
|
*/
|
||||||
sec_label_t *(*get_label)(child_sa_t *this);
|
sec_label_t *(*get_label)(child_sa_t *this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the optional sequence number associated with the acquire that
|
||||||
|
* triggered this CHILD_SA.
|
||||||
|
*
|
||||||
|
* @return sequence number associated with the acquire or 0
|
||||||
|
*/
|
||||||
|
uint32_t (*get_acquire_seq)(child_sa_t *this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the optional sequence number associated with the acquire that
|
||||||
|
* triggered this CHILD_SA.
|
||||||
|
*
|
||||||
|
* @param seq sequence number associated with the acquire
|
||||||
|
*/
|
||||||
|
void (*set_acquire_seq)(child_sa_t *this, uint32_t seq);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an enumerator over traffic selectors of one side.
|
* Create an enumerator over traffic selectors of one side.
|
||||||
*
|
*
|
||||||
@@ -559,6 +575,9 @@ struct child_sa_create_t {
|
|||||||
uint32_t if_id_out_def;
|
uint32_t if_id_out_def;
|
||||||
/** Optional security label to apply on SAs (cloned) */
|
/** Optional security label to apply on SAs (cloned) */
|
||||||
sec_label_t *label;
|
sec_label_t *label;
|
||||||
|
/** Optional sequence number associated with the acquire that triggered
|
||||||
|
* this SA */
|
||||||
|
uint32_t seq;
|
||||||
/** TRUE to enable UDP encapsulation (NAT traversal) */
|
/** TRUE to enable UDP encapsulation (NAT traversal) */
|
||||||
bool encap;
|
bool encap;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user