From 08c6ed9f14d358603a4bb84534080de8684be8b6 Mon Sep 17 00:00:00 2001 From: Andreas Steffen Date: Mon, 17 Nov 2008 00:01:34 +0000 Subject: [PATCH] fixed virtual IP re-installation failure in MOBIKE scenarios introduced with changeset 4662 --- src/charon/sa/child_sa.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/charon/sa/child_sa.c b/src/charon/sa/child_sa.c index 82670b057..e7ab356c9 100644 --- a/src/charon/sa/child_sa.c +++ b/src/charon/sa/child_sa.c @@ -662,6 +662,7 @@ static status_t update_hosts(private_child_sa_t *this, host_t *me, host_t *other, host_t *vip, bool encap) { child_sa_state_t old; + bool transport_proxy_mode; /* anything changed at all? */ if (me->equals(me, this->my_addr) && @@ -672,8 +673,10 @@ static status_t update_hosts(private_child_sa_t *this, old = this->state; set_state(this, CHILD_UPDATING); + transport_proxy_mode = this->config->use_proxy_mode(this->config) && + this->mode == MODE_TRANSPORT; - if (!this->config->use_proxy_mode(this->config) || this->mode != MODE_TRANSPORT) + if (!transport_proxy_mode) { /* update our (initator) SA */ if (this->my_spi) @@ -700,18 +703,6 @@ static status_t update_hosts(private_child_sa_t *this, return NOT_SUPPORTED; } } - - /* apply hosts */ - if (!me->equals(me, this->my_addr)) - { - this->my_addr->destroy(this->my_addr); - this->my_addr = me->clone(me); - } - if (!other->equals(other, this->other_addr)) - { - this->other_addr->destroy(this->other_addr); - this->other_addr = other->clone(other); - } } if (this->config->install_policy(this->config)) @@ -779,6 +770,21 @@ static status_t update_hosts(private_child_sa_t *this, } } + if (!transport_proxy_mode) + { + /* apply hosts */ + if (!me->equals(me, this->my_addr)) + { + this->my_addr->destroy(this->my_addr); + this->my_addr = me->clone(me); + } + if (!other->equals(other, this->other_addr)) + { + this->other_addr->destroy(this->other_addr); + this->other_addr = other->clone(other); + } + } + this->encap = encap; set_state(this, old);