summaryrefslogtreecommitdiff
path: root/src/libcharon/config/ike_cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/config/ike_cfg.c')
-rw-r--r--src/libcharon/config/ike_cfg.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/libcharon/config/ike_cfg.c b/src/libcharon/config/ike_cfg.c
index acf4b6141..5e5fbba42 100644
--- a/src/libcharon/config/ike_cfg.c
+++ b/src/libcharon/config/ike_cfg.c
@@ -21,6 +21,12 @@
#include <daemon.h>
+ENUM(ike_version_names, IKE_ANY, IKEV2,
+ "IKEv1/2",
+ "IKEv1",
+ "IKEv2",
+);
+
typedef struct private_ike_cfg_t private_ike_cfg_t;
/**
@@ -39,6 +45,11 @@ struct private_ike_cfg_t {
refcount_t refcount;
/**
+ * IKE version to use
+ */
+ ike_version_t version;
+
+ /**
* Address of local host
*/
char *me;
@@ -79,11 +90,22 @@ struct private_ike_cfg_t {
bool force_encap;
/**
+ * use IKEv1 fragmentation
+ */
+ fragmentation_t fragmentation;
+
+ /**
* List of proposals to use
*/
linked_list_t *proposals;
};
+METHOD(ike_cfg_t, get_version, ike_version_t,
+ private_ike_cfg_t *this)
+{
+ return this->version;
+}
+
METHOD(ike_cfg_t, send_certreq, bool,
private_ike_cfg_t *this)
{
@@ -96,6 +118,12 @@ METHOD(ike_cfg_t, force_encap_, bool,
return this->force_encap;
}
+METHOD(ike_cfg_t, fragmentation, fragmentation_t,
+ private_ike_cfg_t *this)
+{
+ return this->fragmentation;
+}
+
METHOD(ike_cfg_t, get_my_addr, char*,
private_ike_cfg_t *this, bool *allow_any)
{
@@ -248,8 +276,10 @@ METHOD(ike_cfg_t, equals, bool,
e2->destroy(e2);
return (eq &&
+ this->version == other->version &&
this->certreq == other->certreq &&
this->force_encap == other->force_encap &&
+ this->fragmentation == other->fragmentation &&
streq(this->me, other->me) &&
streq(this->other, other->other) &&
this->my_port == other->my_port &&
@@ -279,16 +309,19 @@ METHOD(ike_cfg_t, destroy, void,
/**
* Described in header.
*/
-ike_cfg_t *ike_cfg_create(bool certreq, bool force_encap,
+ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
char *me, bool my_allow_any, u_int16_t my_port,
- char *other, bool other_allow_any, u_int16_t other_port)
+ char *other, bool other_allow_any, u_int16_t other_port,
+ fragmentation_t fragmentation)
{
private_ike_cfg_t *this;
INIT(this,
.public = {
+ .get_version = _get_version,
.send_certreq = _send_certreq,
.force_encap = _force_encap_,
+ .fragmentation = _fragmentation,
.get_my_addr = _get_my_addr,
.get_other_addr = _get_other_addr,
.get_my_port = _get_my_port,
@@ -302,8 +335,10 @@ ike_cfg_t *ike_cfg_create(bool certreq, bool force_encap,
.destroy = _destroy,
},
.refcount = 1,
+ .version = version,
.certreq = certreq,
.force_encap = force_encap,
+ .fragmentation = fragmentation,
.me = strdup(me),
.other = strdup(other),
.my_allow_any = my_allow_any,