diff options
author | Thomas Egerer <thomas.egerer@secunet.com> | 2015-04-24 13:43:11 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2015-08-04 11:16:13 +0200 |
commit | edaba56ec7f9daf00052c9cfe4c824fb27ec25c4 (patch) | |
tree | 38dbe21b4cf399c3389d29157e16c7712b745cb7 /src/libcharon/sa/ike_sa.c | |
parent | 008a9ad12c6d577caf963057f8c065e0d246ca39 (diff) | |
download | strongswan-edaba56ec7f9daf00052c9cfe4c824fb27ec25c4.tar.bz2 strongswan-edaba56ec7f9daf00052c9cfe4c824fb27ec25c4.tar.xz |
ike: Disable NAT keepalives in state PASSIVE
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
Diffstat (limited to 'src/libcharon/sa/ike_sa.c')
-rw-r--r-- | src/libcharon/sa/ike_sa.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libcharon/sa/ike_sa.c b/src/libcharon/sa/ike_sa.c index 6ffbd55bd..3bfd149f2 100644 --- a/src/libcharon/sa/ike_sa.c +++ b/src/libcharon/sa/ike_sa.c @@ -487,8 +487,9 @@ METHOD(ike_sa_t, send_keepalive, void, send_keepalive_job_t *job; time_t last_out, now, diff; - if (!(this->conditions & COND_NAT_HERE) || this->keepalive_interval == 0) - { /* disable keep alives if we are not NATed anymore */ + if (!(this->conditions & COND_NAT_HERE) || this->keepalive_interval == 0 || + this->state == IKE_PASSIVE) + { /* disable keep alives if we are not NATed anymore, or we are passive */ return; } @@ -651,7 +652,7 @@ METHOD(ike_sa_t, get_state, ike_sa_state_t, METHOD(ike_sa_t, set_state, void, private_ike_sa_t *this, ike_sa_state_t state) { - bool trigger_dpd = FALSE; + bool trigger_dpd = FALSE, keepalives = FALSE; DBG2(DBG_IKE, "IKE_SA %s[%d] state change: %N => %N", get_name(this), this->unique_id, @@ -722,6 +723,10 @@ METHOD(ike_sa_t, set_state, void, * so yet, so prevent that. */ this->stats[STAT_INBOUND] = this->stats[STAT_ESTABLISHED]; } + if (this->state == IKE_PASSIVE) + { + keepalives = TRUE; + } } break; } @@ -742,6 +747,10 @@ METHOD(ike_sa_t, set_state, void, DBG1(DBG_IKE, "DPD not supported by peer, disabled"); } } + if (keepalives) + { + send_keepalive(this); + } } METHOD(ike_sa_t, reset, void, |