summaryrefslogtreecommitdiff
path: root/src/charon/sa/child_sa.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2009-06-23 11:35:38 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2009-06-23 11:35:38 +0000
commit7c52c3f35cdbdff58443b994f2f33d13b4d81f57 (patch)
treee54a27979ea72ec41702bec2984c2eadac3b8862 /src/charon/sa/child_sa.c
parent4ef45ba0404dac3773e83af995a5ec584b23d633 (diff)
downloadvyos-strongswan-7c52c3f35cdbdff58443b994f2f33d13b4d81f57.tar.gz
vyos-strongswan-7c52c3f35cdbdff58443b994f2f33d13b4d81f57.zip
Updated to new upstream version.
Diffstat (limited to 'src/charon/sa/child_sa.c')
-rw-r--r--src/charon/sa/child_sa.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/src/charon/sa/child_sa.c b/src/charon/sa/child_sa.c
index 022b9149a..9202e972e 100644
--- a/src/charon/sa/child_sa.c
+++ b/src/charon/sa/child_sa.c
@@ -14,8 +14,6 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
- *
- * $Id: child_sa.c 4677 2008-11-19 15:31:27Z martin $
*/
#define _GNU_SOURCE
@@ -412,26 +410,11 @@ static u_int32_t get_lifetime(private_child_sa_t *this, bool hard)
*/
static u_int32_t alloc_spi(private_child_sa_t *this, protocol_id_t protocol)
{
- switch (protocol)
- {
- case PROTO_AH:
- if (charon->kernel_interface->get_spi(charon->kernel_interface,
- this->other_addr, this->my_addr, PROTO_AH,
- this->reqid, &this->my_spi) == SUCCESS)
- {
- return this->my_spi;
- }
- break;
- case PROTO_ESP:
- if (charon->kernel_interface->get_spi(charon->kernel_interface,
- this->other_addr, this->my_addr, PROTO_ESP,
+ if (charon->kernel_interface->get_spi(charon->kernel_interface,
+ this->other_addr, this->my_addr, protocol,
this->reqid, &this->my_spi) == SUCCESS)
- {
- return this->my_spi;
- }
- break;
- default:
- break;
+ {
+ return this->my_spi;
}
return 0;
}
@@ -504,8 +487,14 @@ static status_t install(private_child_sa_t *this, chunk_t encr, chunk_t integ,
this->mode, this->ipcomp, cpi, this->encap, update);
now = time(NULL);
- this->rekey_time = now + soft;
- this->expire_time = now + hard;
+ if (soft)
+ {
+ this->rekey_time = now + soft;
+ }
+ if (hard)
+ {
+ this->expire_time = now + hard;
+ }
return status;
}
@@ -724,14 +713,14 @@ static void destroy(private_child_sa_t *this)
if (this->my_spi)
{
charon->kernel_interface->del_sa(charon->kernel_interface,
- this->my_addr, this->my_spi, this->protocol,
- this->my_cpi);
+ this->other_addr, this->my_addr, this->my_spi,
+ this->protocol, this->my_cpi);
}
if (this->other_spi)
{
charon->kernel_interface->del_sa(charon->kernel_interface,
- this->other_addr, this->other_spi, this->protocol,
- this->other_cpi);
+ this->my_addr, this->other_addr, this->other_spi,
+ this->protocol, this->other_cpi);
}
if (this->config->install_policy(this->config))
@@ -816,6 +805,8 @@ child_sa_t * child_sa_create(host_t *me, host_t* other,
this->protocol = PROTO_NONE;
this->mode = MODE_TUNNEL;
this->proposal = NULL;
+ this->rekey_time = 0;
+ this->expire_time = 0;
this->config = config;
config->get_ref(config);