diff options
author | Martin Willi <martin@revosec.ch> | 2013-05-08 10:31:06 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-06-11 15:58:48 +0200 |
commit | a8c9454423b986b610258af43e3b5f2311dd69ed (patch) | |
tree | e38e0f00b3a686bad5f26891e163253c8d420716 /src/libcharon/sa/ikev1 | |
parent | d024a4652c6a791318e3b17b27006678315a7449 (diff) | |
download | strongswan-a8c9454423b986b610258af43e3b5f2311dd69ed.tar.bz2 strongswan-a8c9454423b986b610258af43e3b5f2311dd69ed.tar.xz |
kernel-interface: add an exchange initiator parameter to add_sa()
This new flag gives the kernel-interface a hint how it should priorize the
use of newly installed SAs during rekeying.
Consider the following rekey procedure in IKEv2:
Initiator --- Responder
I1 -------CREATE-------> R1
I2 <------CREATE--------
-------DELETE-------> R2
I3 <------DELETE--------
SAs are always handled as pairs, the following happens at the SA level:
* Initiator starts the exchange at I1
* Responder installs new SA pair at R1
* Initiator installs new SA pair at I2
* Responder removes old SA pair at R2
* Initiator removes old SA pair at I3
This makes sure SAs get installed/removed overlapping during rekeying. However,
to avoid any packet loss, it is crucial that the new outbound SA gets
activated at the correct position:
* as exchange initiator, in I2
* as exchange responder, in R2
This should guarantee that we don't use the new outbound SA before the peer
could install its corresponding inbound SA.
The new parameter allows the kernel backend to install the new SA with
appropriate priorities, i.e. it should:
* as exchange inititator, have the new outbound SA installed with higher
priority than the old SA
* as exchange responder, have the new outbound SA installed with lower
priority than the old SA
While we could split up the SA installation at the responder, this approach
has another advantage: it allows the kernel backend to switch SAs based on
other criteria, for example when receiving traffic on the new inbound SA.
Diffstat (limited to 'src/libcharon/sa/ikev1')
-rw-r--r-- | src/libcharon/sa/ikev1/tasks/quick_mode.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/libcharon/sa/ikev1/tasks/quick_mode.c b/src/libcharon/sa/ikev1/tasks/quick_mode.c index 47c844e5f..52ea34b1a 100644 --- a/src/libcharon/sa/ikev1/tasks/quick_mode.c +++ b/src/libcharon/sa/ikev1/tasks/quick_mode.c @@ -306,17 +306,21 @@ static bool install(private_quick_mode_t *this) { if (this->initiator) { - status_i = this->child_sa->install(this->child_sa, encr_r, integ_r, - this->spi_i, this->cpi_i, TRUE, FALSE, tsi, tsr); - status_o = this->child_sa->install(this->child_sa, encr_i, integ_i, - this->spi_r, this->cpi_r, FALSE, FALSE, tsi, tsr); + status_i = this->child_sa->install(this->child_sa, + encr_r, integ_r, this->spi_i, this->cpi_i, + this->initiator, TRUE, FALSE, tsi, tsr); + status_o = this->child_sa->install(this->child_sa, + encr_i, integ_i, this->spi_r, this->cpi_r, + this->initiator, FALSE, FALSE, tsi, tsr); } else { - status_i = this->child_sa->install(this->child_sa, encr_i, integ_i, - this->spi_r, this->cpi_r, TRUE, FALSE, tsr, tsi); - status_o = this->child_sa->install(this->child_sa, encr_r, integ_r, - this->spi_i, this->cpi_i, FALSE, FALSE, tsr, tsi); + status_i = this->child_sa->install(this->child_sa, + encr_i, integ_i, this->spi_r, this->cpi_r, + this->initiator, TRUE, FALSE, tsr, tsi); + status_o = this->child_sa->install(this->child_sa, + encr_r, integ_r, this->spi_i, this->cpi_i, + this->initiator, FALSE, FALSE, tsr, tsi); } } chunk_clear(&integ_i); |