kernel-interface: Raise mapping event with a proto/SPI/dst tuple
This commit is contained in:
@@ -27,15 +27,26 @@ typedef struct private_update_sa_job_t private_update_sa_job_t;
|
||||
* Private data of an update_sa_job_t Object
|
||||
*/
|
||||
struct private_update_sa_job_t {
|
||||
|
||||
/**
|
||||
* public update_sa_job_t interface
|
||||
*/
|
||||
update_sa_job_t public;
|
||||
|
||||
/**
|
||||
* reqid of the CHILD_SA
|
||||
* protocol of the CHILD_SA (ESP/AH)
|
||||
*/
|
||||
u_int32_t reqid;
|
||||
protocol_id_t protocol;
|
||||
|
||||
/**
|
||||
* SPI of the CHILD_SA
|
||||
*/
|
||||
u_int32_t spi;
|
||||
|
||||
/**
|
||||
* Old SA destination address
|
||||
*/
|
||||
host_t *dst;
|
||||
|
||||
/**
|
||||
* New SA address and port
|
||||
@@ -46,6 +57,7 @@ struct private_update_sa_job_t {
|
||||
METHOD(job_t, destroy, void,
|
||||
private_update_sa_job_t *this)
|
||||
{
|
||||
this->dst->destroy(this->dst);
|
||||
this->new->destroy(this->new);
|
||||
free(this);
|
||||
}
|
||||
@@ -55,11 +67,12 @@ METHOD(job_t, execute, job_requeue_t,
|
||||
{
|
||||
ike_sa_t *ike_sa;
|
||||
|
||||
ike_sa = charon->ike_sa_manager->checkout_by_id(charon->ike_sa_manager,
|
||||
this->reqid, TRUE);
|
||||
ike_sa = charon->child_sa_manager->checkout(charon->child_sa_manager,
|
||||
this->protocol, this->spi, this->dst, NULL);
|
||||
if (ike_sa == NULL)
|
||||
{
|
||||
DBG1(DBG_JOB, "CHILD_SA with reqid %d not found for update", this->reqid);
|
||||
DBG1(DBG_JOB, "CHILD_SA %N/0x%08x/%H not found for update",
|
||||
protocol_id_names, this->protocol, htonl(this->spi), this->dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -78,7 +91,8 @@ METHOD(job_t, get_priority, job_priority_t,
|
||||
/*
|
||||
* Described in header
|
||||
*/
|
||||
update_sa_job_t *update_sa_job_create(u_int32_t reqid, host_t *new)
|
||||
update_sa_job_t *update_sa_job_create(protocol_id_t protocol,
|
||||
u_int32_t spi, host_t *dst, host_t *new)
|
||||
{
|
||||
private_update_sa_job_t *this;
|
||||
|
||||
@@ -90,10 +104,11 @@ update_sa_job_t *update_sa_job_create(u_int32_t reqid, host_t *new)
|
||||
.destroy = _destroy,
|
||||
},
|
||||
},
|
||||
.reqid = reqid,
|
||||
.new = new,
|
||||
.protocol = protocol,
|
||||
.spi = spi,
|
||||
.dst = dst->clone(dst),
|
||||
.new = new->clone(new),
|
||||
);
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ typedef struct update_sa_job_t update_sa_job_t;
|
||||
#include <library.h>
|
||||
#include <networking/host.h>
|
||||
#include <processing/jobs/job.h>
|
||||
#include <config/proposal.h>
|
||||
|
||||
/**
|
||||
* Update the addresses of an IKE and its CHILD_SAs.
|
||||
@@ -41,10 +42,13 @@ struct update_sa_job_t {
|
||||
/**
|
||||
* Creates a job to update IKE and CHILD_SA addresses.
|
||||
*
|
||||
* @param reqid reqid of the CHILD_SA
|
||||
* @param protocol IPsec protocol of SA to update
|
||||
* @param spi SPI of SA to update
|
||||
* @param dst old destination host of SA to update
|
||||
* @param new new address and port
|
||||
* @return update_sa_job_t object
|
||||
*/
|
||||
update_sa_job_t *update_sa_job_create(u_int32_t reqid, host_t *new);
|
||||
update_sa_job_t *update_sa_job_create(protocol_id_t protocol,
|
||||
u_int32_t spi, host_t *dst, host_t *new);
|
||||
|
||||
#endif /** UPDATE_SA_JOB_H_ @}*/
|
||||
|
||||
Reference in New Issue
Block a user