aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/config/proposal.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2006-02-16 09:55:07 +0000
committerMartin Willi <martin@strongswan.org>2006-02-16 09:55:07 +0000
commit30b5b412da849251d6000c2dc52731af3e5409b8 (patch)
treefeb29be853a779cd1202a013ba0dc674e4c0f4fc /Source/charon/config/proposal.c
parentce461bbd13c5ea6a94ba0b34cbb4d1be8159b67e (diff)
downloadstrongswan-30b5b412da849251d6000c2dc52731af3e5409b8.tar.bz2
strongswan-30b5b412da849251d6000c2dc52731af3e5409b8.tar.xz
- installing of child sa works
- need correct IP adresses to actually use IPsec
Diffstat (limited to 'Source/charon/config/proposal.c')
-rw-r--r--Source/charon/config/proposal.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/Source/charon/config/proposal.c b/Source/charon/config/proposal.c
index 528cf9808..a547583d9 100644
--- a/Source/charon/config/proposal.c
+++ b/Source/charon/config/proposal.c
@@ -339,6 +339,7 @@ static proposal_t *select_proposal(private_proposal_t *this, private_proposal_t
protocol_proposal_t *this_prop, *other_prop;
protocol_id_t proto;
bool add;
+ u_int64_t spi;
/* empty proposal? no match */
if (this->protocol_proposals->get_count(this->protocol_proposals) == 0 ||
@@ -443,6 +444,19 @@ static proposal_t *select_proposal(private_proposal_t *this, private_proposal_t
}
}
iterator->destroy(iterator);
+
+ /* apply spis from "other" */
+ spi = other->public.get_spi(&(other->public), AH);
+ if (spi)
+ {
+ selected->set_spi(selected, AH, spi);
+ }
+ spi = other->public.get_spi(&(other->public), ESP);
+ if (spi)
+ {
+ selected->set_spi(selected, ESP, spi);
+ }
+
/* everything matched, return new proposal */
return selected;
}
@@ -487,7 +501,7 @@ static void set_spi(private_proposal_t *this, protocol_id_t proto, u_int64_t spi
protocol_proposal_t *proto_proposal = get_protocol_proposal(this, proto, FALSE);
if (proto_proposal)
{
- if (proto == IKE)
+ if (proto == AH || proto == ESP)
{
*((u_int32_t*)proto_proposal->spi.ptr) = (u_int32_t)spi;
}
@@ -495,7 +509,6 @@ static void set_spi(private_proposal_t *this, protocol_id_t proto, u_int64_t spi
{
*((u_int64_t*)proto_proposal->spi.ptr) = spi;
}
-
}
}
@@ -507,7 +520,7 @@ static u_int64_t get_spi(private_proposal_t *this, protocol_id_t proto)
protocol_proposal_t *proto_proposal = get_protocol_proposal(this, proto, FALSE);
if (proto_proposal)
{
- if (proto == IKE)
+ if (proto == AH || proto == ESP)
{
return (u_int64_t)*((u_int32_t*)proto_proposal->spi.ptr);
}