summaryrefslogtreecommitdiff
path: root/src/libcharon/config/child_cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/config/child_cfg.c')
-rw-r--r--src/libcharon/config/child_cfg.c231
1 files changed, 231 insertions, 0 deletions
diff --git a/src/libcharon/config/child_cfg.c b/src/libcharon/config/child_cfg.c
index 74949be3c..6edceffd6 100644
--- a/src/libcharon/config/child_cfg.c
+++ b/src/libcharon/config/child_cfg.c
@@ -80,11 +80,14 @@ struct private_child_cfg_t {
ipsec_mode_t mode;
/**
+<<<<<<< HEAD
+=======
* action to take to start CHILD_SA
*/
action_t start_action;
/**
+>>>>>>> upstream/4.5.1
* action to take on DPD
*/
action_t dpd_action;
@@ -123,12 +126,15 @@ struct private_child_cfg_t {
* Optional mark to install outbound CHILD_SA with
*/
mark_t mark_out;
+<<<<<<< HEAD
+=======
/**
* Traffic Flow Confidentiality padding, if enabled
*/
u_int32_t tfc;
+>>>>>>> upstream/4.5.1
/**
* set up IPsec transport SA in MIPv6 proxy mode
*/
@@ -140,20 +146,41 @@ struct private_child_cfg_t {
bool install_policy;
};
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_name.
+ */
+static char *get_name(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_name, char*,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->name;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.add_proposal.
+ */
+static void add_proposal(private_child_cfg_t *this, proposal_t *proposal)
+=======
METHOD(child_cfg_t, add_proposal, void,
private_child_cfg_t *this, proposal_t *proposal)
+>>>>>>> upstream/4.5.1
{
this->proposals->insert_last(this->proposals, proposal);
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_proposals.
+ */
+static linked_list_t* get_proposals(private_child_cfg_t *this, bool strip_dh)
+=======
METHOD(child_cfg_t, get_proposals, linked_list_t*,
private_child_cfg_t *this, bool strip_dh)
+>>>>>>> upstream/4.5.1
{
enumerator_t *enumerator;
proposal_t *current;
@@ -174,9 +201,18 @@ METHOD(child_cfg_t, get_proposals, linked_list_t*,
return proposals;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.select_proposal.
+ */
+static proposal_t* select_proposal(private_child_cfg_t*this,
+ linked_list_t *proposals, bool strip_dh,
+ bool private)
+=======
METHOD(child_cfg_t, select_proposal, proposal_t*,
private_child_cfg_t*this, linked_list_t *proposals, bool strip_dh,
bool private)
+>>>>>>> upstream/4.5.1
{
enumerator_t *stored_enum, *supplied_enum;
proposal_t *stored, *supplied, *selected = NULL;
@@ -221,8 +257,16 @@ METHOD(child_cfg_t, select_proposal, proposal_t*,
return selected;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.add_traffic_selector.
+ */
+static void add_traffic_selector(private_child_cfg_t *this, bool local,
+ traffic_selector_t *ts)
+=======
METHOD(child_cfg_t, add_traffic_selector, void,
private_child_cfg_t *this, bool local, traffic_selector_t *ts)
+>>>>>>> upstream/4.5.1
{
if (local)
{
@@ -234,8 +278,17 @@ METHOD(child_cfg_t, add_traffic_selector, void,
}
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_traffic_selectors.
+ */
+static linked_list_t* get_traffic_selectors(private_child_cfg_t *this, bool local,
+ linked_list_t *supplied,
+ host_t *host)
+=======
METHOD(child_cfg_t, get_traffic_selectors, linked_list_t*,
private_child_cfg_t *this, bool local, linked_list_t *supplied, host_t *host)
+>>>>>>> upstream/4.5.1
{
enumerator_t *e1, *e2;
traffic_selector_t *ts1, *ts2, *selected;
@@ -341,14 +394,28 @@ METHOD(child_cfg_t, get_traffic_selectors, linked_list_t*,
return result;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_updown.
+ */
+static char* get_updown(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_updown, char*,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->updown;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_hostaccess.
+ */
+static bool get_hostaccess(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_hostaccess, bool,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->hostaccess;
}
@@ -369,8 +436,15 @@ static u_int64_t apply_jitter(u_int64_t rekey, u_int64_t jitter)
}
#define APPLY_JITTER(l) l.rekey = apply_jitter(l.rekey, l.jitter)
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_lifetime.
+ */
+static lifetime_cfg_t *get_lifetime(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_lifetime, lifetime_cfg_t*,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
lifetime_cfg_t *lft = malloc_thing(lifetime_cfg_t);
memcpy(lft, &this->lifetime, sizeof(lifetime_cfg_t));
@@ -380,12 +454,25 @@ METHOD(child_cfg_t, get_lifetime, lifetime_cfg_t*,
return lft;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_mode.
+ */
+static ipsec_mode_t get_mode(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_mode, ipsec_mode_t,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->mode;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_dpd_action.
+ */
+static action_t get_dpd_action(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_start_action, action_t,
private_child_cfg_t *this)
{
@@ -394,18 +481,33 @@ METHOD(child_cfg_t, get_start_action, action_t,
METHOD(child_cfg_t, get_dpd_action, action_t,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->dpd_action;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_close_action.
+ */
+static action_t get_close_action(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_close_action, action_t,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->close_action;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_dh_group.
+ */
+static diffie_hellman_group_t get_dh_group(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_dh_group, diffie_hellman_group_t,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
enumerator_t *enumerator;
proposal_t *proposal;
@@ -423,30 +525,65 @@ METHOD(child_cfg_t, get_dh_group, diffie_hellman_group_t,
return dh_group;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.use_ipcomp.
+ */
+static bool use_ipcomp(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, use_ipcomp, bool,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->use_ipcomp;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_inactivity.
+ */
+static u_int32_t get_inactivity(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_inactivity, u_int32_t,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->inactivity;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_reqid.
+ */
+static u_int32_t get_reqid(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_reqid, u_int32_t,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->reqid;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_mark.
+ */
+static mark_t get_mark(private_child_cfg_t *this, bool inbound)
+=======
METHOD(child_cfg_t, get_mark, mark_t,
private_child_cfg_t *this, bool inbound)
+>>>>>>> upstream/4.5.1
{
return inbound ? this->mark_in : this->mark_out;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.set_mipv6_options.
+ */
+static void set_mipv6_options(private_child_cfg_t *this, bool proxy_mode,
+ bool install_policy)
+=======
METHOD(child_cfg_t, get_tfc, u_int32_t,
private_child_cfg_t *this)
{
@@ -455,32 +592,61 @@ METHOD(child_cfg_t, get_tfc, u_int32_t,
METHOD(child_cfg_t, set_mipv6_options, void,
private_child_cfg_t *this, bool proxy_mode, bool install_policy)
+>>>>>>> upstream/4.5.1
{
this->proxy_mode = proxy_mode;
this->install_policy = install_policy;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.use_proxy_mode.
+ */
+static bool use_proxy_mode(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, use_proxy_mode, bool,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->proxy_mode;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.install_policy.
+ */
+static bool install_policy(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, install_policy, bool,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
return this->install_policy;
}
+<<<<<<< HEAD
+/**
+ * Implementation of child_cfg_t.get_ref.
+ */
+static child_cfg_t* get_ref(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, get_ref, child_cfg_t*,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
ref_get(&this->refcount);
return &this->public;
}
+<<<<<<< HEAD
+/**
+ * Implements child_cfg_t.destroy.
+ */
+static void destroy(private_child_cfg_t *this)
+=======
METHOD(child_cfg_t, destroy, void,
private_child_cfg_t *this)
+>>>>>>> upstream/4.5.1
{
if (ref_put(&this->refcount))
{
@@ -501,6 +667,47 @@ METHOD(child_cfg_t, destroy, void,
*/
child_cfg_t *child_cfg_create(char *name, lifetime_cfg_t *lifetime,
char *updown, bool hostaccess,
+<<<<<<< HEAD
+ ipsec_mode_t mode, action_t dpd_action,
+ action_t close_action, bool ipcomp,
+ u_int32_t inactivity, u_int32_t reqid,
+ mark_t *mark_in, mark_t *mark_out)
+{
+ private_child_cfg_t *this = malloc_thing(private_child_cfg_t);
+
+ this->public.get_name = (char* (*) (child_cfg_t*))get_name;
+ this->public.add_traffic_selector = (void (*)(child_cfg_t*,bool,traffic_selector_t*))add_traffic_selector;
+ this->public.get_traffic_selectors = (linked_list_t*(*)(child_cfg_t*,bool,linked_list_t*,host_t*))get_traffic_selectors;
+ this->public.add_proposal = (void (*) (child_cfg_t*,proposal_t*))add_proposal;
+ this->public.get_proposals = (linked_list_t* (*) (child_cfg_t*,bool))get_proposals;
+ this->public.select_proposal = (proposal_t* (*) (child_cfg_t*,linked_list_t*,bool,bool))select_proposal;
+ this->public.get_updown = (char* (*) (child_cfg_t*))get_updown;
+ this->public.get_hostaccess = (bool (*) (child_cfg_t*))get_hostaccess;
+ this->public.get_mode = (ipsec_mode_t (*) (child_cfg_t *))get_mode;
+ this->public.get_dpd_action = (action_t (*) (child_cfg_t *))get_dpd_action;
+ this->public.get_close_action = (action_t (*) (child_cfg_t *))get_close_action;
+ this->public.get_lifetime = (lifetime_cfg_t* (*) (child_cfg_t *))get_lifetime;
+ this->public.get_dh_group = (diffie_hellman_group_t(*)(child_cfg_t*)) get_dh_group;
+ this->public.set_mipv6_options = (void (*) (child_cfg_t*,bool,bool))set_mipv6_options;
+ this->public.use_ipcomp = (bool (*) (child_cfg_t *))use_ipcomp;
+ this->public.get_inactivity = (u_int32_t (*) (child_cfg_t *))get_inactivity;
+ this->public.get_reqid = (u_int32_t (*) (child_cfg_t *))get_reqid;
+ this->public.get_mark = (mark_t (*) (child_cfg_t *,bool))get_mark;
+ this->public.use_proxy_mode = (bool (*) (child_cfg_t *))use_proxy_mode;
+ this->public.install_policy = (bool (*) (child_cfg_t *))install_policy;
+ this->public.get_ref = (child_cfg_t* (*) (child_cfg_t*))get_ref;
+ this->public.destroy = (void (*) (child_cfg_t*))destroy;
+
+ this->name = strdup(name);
+ this->updown = updown ? strdup(updown) : NULL;
+ this->hostaccess = hostaccess;
+ this->mode = mode;
+ this->dpd_action = dpd_action;
+ this->close_action = close_action;
+ this->use_ipcomp = ipcomp;
+ this->inactivity = inactivity;
+ this->reqid = reqid;
+=======
ipsec_mode_t mode, action_t start_action,
action_t dpd_action, action_t close_action,
bool ipcomp, u_int32_t inactivity, u_int32_t reqid,
@@ -553,15 +760,39 @@ child_cfg_t *child_cfg_create(char *name, lifetime_cfg_t *lifetime,
.other_ts = linked_list_create(),
.tfc = tfc,
);
+>>>>>>> upstream/4.5.1
if (mark_in)
{
this->mark_in = *mark_in;
}
+<<<<<<< HEAD
+ else
+ {
+ this->mark_in.value = 0;
+ this->mark_in.mask = 0;
+ }
+=======
+>>>>>>> upstream/4.5.1
if (mark_out)
{
this->mark_out = *mark_out;
}
+<<<<<<< HEAD
+ else
+ {
+ this->mark_out.value = 0;
+ this->mark_out.mask = 0;
+ }
+
+ this->proxy_mode = FALSE;
+ this->install_policy = TRUE;
+ this->refcount = 1;
+ this->proposals = linked_list_create();
+ this->my_ts = linked_list_create();
+ this->other_ts = linked_list_create();
+=======
+>>>>>>> upstream/4.5.1
memcpy(&this->lifetime, lifetime, sizeof(lifetime_cfg_t));
return &this->public;