diff options
author | Tobias Brunner <tobias@strongswan.org> | 2017-02-28 15:03:45 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2017-05-23 18:46:06 +0200 |
commit | cad13450bed9c082f58c1acddd9c4f197aebd8e5 (patch) | |
tree | 3bf9d53a741f63ca8d39ef7f78b5ef77e11ae414 /src/libcharon | |
parent | 8a3a389e3dd2cbf4df916145df0e02b2fdbe4edb (diff) | |
download | strongswan-cad13450bed9c082f58c1acddd9c4f197aebd8e5.tar.bz2 strongswan-cad13450bed9c082f58c1acddd9c4f197aebd8e5.tar.xz |
child-sa: Add method to associate rekeyed CHILD_SAs with their replacement
Diffstat (limited to 'src/libcharon')
-rw-r--r-- | src/libcharon/sa/child_sa.c | 19 | ||||
-rw-r--r-- | src/libcharon/sa/child_sa.h | 16 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/libcharon/sa/child_sa.c b/src/libcharon/sa/child_sa.c index 93a2120e6..29d4680f2 100644 --- a/src/libcharon/sa/child_sa.c +++ b/src/libcharon/sa/child_sa.c @@ -113,6 +113,11 @@ struct private_child_sa_t { bool tfcv3; /** + * The outbound SPI of the CHILD_SA that replaced this one during a rekeying + */ + uint32_t rekey_spi; + + /** * Protocol used to protect this SA, ESP|AH */ protocol_id_t protocol; @@ -1303,6 +1308,18 @@ METHOD(child_sa_t, install_outbound, status_t, return status; } +METHOD(child_sa_t, set_rekey_spi, void, + private_child_sa_t *this, uint32_t spi) +{ + this->rekey_spi = spi; +} + +METHOD(child_sa_t, get_rekey_spi, uint32_t, + private_child_sa_t *this) +{ + return this->rekey_spi; +} + /** * Callback to reinstall a virtual IP */ @@ -1642,6 +1659,8 @@ child_sa_t * child_sa_create(host_t *me, host_t* other, .install = _install, .register_outbound = _register_outbound, .install_outbound = _install_outbound, + .set_rekey_spi = _set_rekey_spi, + .get_rekey_spi = _get_rekey_spi, .update = _update, .set_policies = _set_policies, .install_policies = _install_policies, diff --git a/src/libcharon/sa/child_sa.h b/src/libcharon/sa/child_sa.h index 98fa24701..4483346b1 100644 --- a/src/libcharon/sa/child_sa.h +++ b/src/libcharon/sa/child_sa.h @@ -419,6 +419,22 @@ struct child_sa_t { status_t (*install_policies)(child_sa_t *this); /** + * Set the outbound SPI of the CHILD_SA that replaced this CHILD_SA during + * a rekeying. + * + * @param spi outbound SPI of the CHILD_SA that replaced this CHILD_SA + */ + void (*set_rekey_spi)(child_sa_t *this, uint32_t spi); + + /** + * Get the outbound SPI of the CHILD_SA that replaced this CHILD_SA during + * a rekeying. + * + * @return outbound SPI of the CHILD_SA that replaced this CHILD_SA + */ + uint32_t (*get_rekey_spi)(child_sa_t *this); + + /** * Update hosts and ecapulation mode in the kernel SAs and policies. * * @param me the new local host |