aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2017-05-23 18:49:13 +0200
committerTobias Brunner <tobias@strongswan.org>2017-05-23 18:49:13 +0200
commitf8eb636e701cc66198bfab9e601842273b038219 (patch)
tree4e4d7b800c93c1c479f153784a996a434f192d7c /src/libcharon/plugins
parent4cc77142e0292d5d00f20e62849139f4401895c8 (diff)
parent10c7a668067b2657e8dffef70812d81b6408f12c (diff)
downloadstrongswan-f8eb636e701cc66198bfab9e601842273b038219.tar.bz2
strongswan-f8eb636e701cc66198bfab9e601842273b038219.tar.xz
Merge branch 'avoid-rekey-loss'
This changes the behavior during IKEv2 CHILD_SA rekeyings to avoid traffic loss. When responding to a CREATE_CHILD_SA request to rekey a CHILD_SA the responder already has everything available to install and use the new CHILD_SA. However, this could lead to lost traffic as the initiator won't be able to process inbound packets until it processed the CREATE_CHILD_SA response and updated the inbound SA. To avoid this the responder now only installs the new inbound SA and delays installing the outbound SA until it receives the DELETE for the replaced CHILD_SA. The messages transporting these DELETEs could reach the peer before packets sent with the deleted outbound SAs reach the respective peer. To reduce the chance of traffic loss due to this the inbound SA of the replaced CHILD_SA is not removed for a configurable amount of seconds after the DELETE has been processed. Fixes #1291.
Diffstat (limited to 'src/libcharon/plugins')
-rw-r--r--src/libcharon/plugins/ha/ha_dispatcher.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/libcharon/plugins/ha/ha_dispatcher.c b/src/libcharon/plugins/ha/ha_dispatcher.c
index ee66b8442..7d22257c6 100644
--- a/src/libcharon/plugins/ha/ha_dispatcher.c
+++ b/src/libcharon/plugins/ha/ha_dispatcher.c
@@ -818,14 +818,14 @@ static void process_child_add(private_ha_dispatcher_t *this,
}
enumerator->destroy(enumerator);
+ child_sa->set_policies(child_sa, local_ts, remote_ts);
+
if (initiator)
{
if (child_sa->install(child_sa, encr_r, integ_r, inbound_spi,
- inbound_cpi, initiator, TRUE, TRUE,
- local_ts, remote_ts) != SUCCESS ||
+ inbound_cpi, initiator, TRUE, TRUE) != SUCCESS ||
child_sa->install(child_sa, encr_i, integ_i, outbound_spi,
- outbound_cpi, initiator, FALSE, TRUE,
- local_ts, remote_ts) != SUCCESS)
+ outbound_cpi, initiator, FALSE, TRUE) != SUCCESS)
{
failed = TRUE;
}
@@ -833,11 +833,9 @@ static void process_child_add(private_ha_dispatcher_t *this,
else
{
if (child_sa->install(child_sa, encr_i, integ_i, inbound_spi,
- inbound_cpi, initiator, TRUE, TRUE,
- local_ts, remote_ts) != SUCCESS ||
+ inbound_cpi, initiator, TRUE, TRUE) != SUCCESS ||
child_sa->install(child_sa, encr_r, integ_r, outbound_spi,
- outbound_cpi, initiator, FALSE, TRUE,
- local_ts, remote_ts) != SUCCESS)
+ outbound_cpi, initiator, FALSE, TRUE) != SUCCESS)
{
failed = TRUE;
}
@@ -868,7 +866,7 @@ static void process_child_add(private_ha_dispatcher_t *this,
child_sa->get_unique_id(child_sa), local_ts, remote_ts,
seg_i, this->segments->is_active(this->segments, seg_i) ? "*" : "",
seg_o, this->segments->is_active(this->segments, seg_o) ? "*" : "");
- child_sa->add_policies(child_sa, local_ts, remote_ts);
+ child_sa->install_policies(child_sa);
local_ts->destroy_offset(local_ts, offsetof(traffic_selector_t, destroy));
remote_ts->destroy_offset(remote_ts, offsetof(traffic_selector_t, destroy));