summaryrefslogtreecommitdiff
path: root/src/charon/config/ike_cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/charon/config/ike_cfg.c')
-rw-r--r--src/charon/config/ike_cfg.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/charon/config/ike_cfg.c b/src/charon/config/ike_cfg.c
index e80ab577e..2e748f511 100644
--- a/src/charon/config/ike_cfg.c
+++ b/src/charon/config/ike_cfg.c
@@ -32,7 +32,7 @@ struct private_ike_cfg_t {
* Public part
*/
ike_cfg_t public;
-
+
/**
* Number of references hold by others to this ike_cfg
*/
@@ -45,19 +45,19 @@ struct private_ike_cfg_t {
/**
* Address of remote host
- */
+ */
char *other;
-
+
/**
* should we send a certificate request?
*/
bool certreq;
-
+
/**
* enforce UDP encapsulation
*/
bool force_encap;
-
+
/**
* List of proposals to use
*/
@@ -71,7 +71,7 @@ static bool send_certreq(private_ike_cfg_t *this)
{
return this->certreq;
}
-
+
/**
* Implementation of ike_cfg_t.force_encap.
*/
@@ -112,7 +112,7 @@ static linked_list_t* get_proposals(private_ike_cfg_t *this)
iterator_t *iterator;
proposal_t *current;
linked_list_t *proposals = linked_list_create();
-
+
iterator = this->proposals->create_iterator(this->proposals, TRUE);
while (iterator->iterate(iterator, (void**)&current))
{
@@ -120,31 +120,31 @@ static linked_list_t* get_proposals(private_ike_cfg_t *this)
proposals->insert_last(proposals, (void*)current);
}
iterator->destroy(iterator);
-
+
return proposals;
}
-
+
/**
* Implementation of ike_cfg_t.select_proposal.
*/
static proposal_t *select_proposal(private_ike_cfg_t *this,
- linked_list_t *proposals)
+ linked_list_t *proposals, bool private)
{
iterator_t *stored_iter, *supplied_iter;
proposal_t *stored, *supplied, *selected;
-
+
stored_iter = this->proposals->create_iterator(this->proposals, TRUE);
supplied_iter = proposals->create_iterator(proposals, TRUE);
-
-
+
+
/* compare all stored proposals with all supplied. Stored ones are preferred.*/
while (stored_iter->iterate(stored_iter, (void**)&stored))
{
supplied_iter->reset(supplied_iter);
-
+
while (supplied_iter->iterate(supplied_iter, (void**)&supplied))
{
- selected = stored->select(stored, supplied);
+ selected = stored->select(stored, supplied, private);
if (selected)
{
/* they match, return */
@@ -162,7 +162,7 @@ static proposal_t *select_proposal(private_ike_cfg_t *this,
supplied_iter->destroy(supplied_iter);
DBG1(DBG_CFG, "received proposals: %#P", proposals);
DBG1(DBG_CFG, "configured proposals: %#P", this->proposals);
-
+
return NULL;
}
@@ -174,7 +174,7 @@ static diffie_hellman_group_t get_dh_group(private_ike_cfg_t *this)
enumerator_t *enumerator;
proposal_t *proposal;
u_int16_t dh_group = MODP_NONE;
-
+
enumerator = this->proposals->create_enumerator(this->proposals);
while (enumerator->enumerate(enumerator, &proposal))
{
@@ -195,7 +195,7 @@ static bool equals(private_ike_cfg_t *this, private_ike_cfg_t *other)
enumerator_t *e1, *e2;
proposal_t *p1, *p2;
bool eq = TRUE;
-
+
if (this == other)
{
return TRUE;
@@ -260,7 +260,7 @@ ike_cfg_t *ike_cfg_create(bool certreq, bool force_encap,
char *me, char *other)
{
private_ike_cfg_t *this = malloc_thing(private_ike_cfg_t);
-
+
/* public functions */
this->public.send_certreq = (bool(*)(ike_cfg_t*))send_certreq;
this->public.force_encap = (bool (*) (ike_cfg_t *))force_encap_meth;
@@ -268,12 +268,12 @@ ike_cfg_t *ike_cfg_create(bool certreq, bool force_encap,
this->public.get_other_addr = (char*(*)(ike_cfg_t*))get_other_addr;
this->public.add_proposal = (void(*)(ike_cfg_t*, proposal_t*)) add_proposal;
this->public.get_proposals = (linked_list_t*(*)(ike_cfg_t*))get_proposals;
- this->public.select_proposal = (proposal_t*(*)(ike_cfg_t*,linked_list_t*))select_proposal;
+ this->public.select_proposal = (proposal_t*(*)(ike_cfg_t*,linked_list_t*,bool))select_proposal;
this->public.get_dh_group = (diffie_hellman_group_t(*)(ike_cfg_t*)) get_dh_group;
this->public.equals = (bool(*)(ike_cfg_t*,ike_cfg_t*)) equals;
this->public.get_ref = (ike_cfg_t*(*)(ike_cfg_t*))get_ref;
this->public.destroy = (void(*)(ike_cfg_t*))destroy;
-
+
/* private variables */
this->refcount = 1;
this->certreq = certreq;
@@ -281,6 +281,6 @@ ike_cfg_t *ike_cfg_create(bool certreq, bool force_encap,
this->me = strdup(me);
this->other = strdup(other);
this->proposals = linked_list_create();
-
+
return &this->public;
}