From: Tobias Brunner Date: Tue, 12 Feb 2019 09:19:36 +0000 (+0100) Subject: child-cfg: Add property for interface ID X-Git-Tag: 5.8.0rc1~41^2~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=72c96dbf9f1e93e841e799af70bbe903c10d66e1;p=thirdparty%2Fstrongswan.git child-cfg: Add property for interface ID --- diff --git a/src/libcharon/config/child_cfg.c b/src/libcharon/config/child_cfg.c index 14148ed037..73cb02bd9a 100644 --- a/src/libcharon/config/child_cfg.c +++ b/src/libcharon/config/child_cfg.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2018 Tobias Brunner + * Copyright (C) 2008-2019 Tobias Brunner * Copyright (C) 2016 Andreas Steffen * Copyright (C) 2005-2007 Martin Willi * Copyright (C) 2005 Jan Hutter @@ -113,6 +113,16 @@ struct private_child_cfg_t { */ uint32_t reqid; + /** + * Optionl interface ID to use for inbound CHILD_SA + */ + uint32_t if_id_in; + + /** + * Optionl interface ID to use for outbound CHILD_SA + */ + uint32_t if_id_out; + /** * Optional mark to install inbound CHILD_SA with */ @@ -551,6 +561,12 @@ METHOD(child_cfg_t, get_reqid, uint32_t, return this->reqid; } +METHOD(child_cfg_t, get_if_id, uint32_t, + private_child_cfg_t *this, bool inbound) +{ + return inbound ? this->if_id_in : this->if_id_out; +} + METHOD(child_cfg_t, get_mark, mark_t, private_child_cfg_t *this, bool inbound) { @@ -632,6 +648,8 @@ METHOD(child_cfg_t, equals, bool, LIFETIME_EQUALS(this->lifetime, other->lifetime) && this->inactivity == other->inactivity && this->reqid == other->reqid && + this->if_id_in == other->if_id_in && + this->if_id_out == other->if_id_out && this->mark_in.value == other->mark_in.value && this->mark_in.mask == other->mark_in.mask && this->mark_out.value == other->mark_out.value && @@ -695,6 +713,7 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data) .get_dh_group = _get_dh_group, .get_inactivity = _get_inactivity, .get_reqid = _get_reqid, + .get_if_id = _get_if_id, .get_mark = _get_mark, .get_set_mark = _get_set_mark, .get_tfc = _get_tfc, @@ -713,6 +732,8 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data) .options = data->options, .updown = strdupnull(data->updown), .reqid = data->reqid, + .if_id_in = data->if_id_in, + .if_id_out = data->if_id_out, .mode = data->mode, .start_action = data->start_action, .dpd_action = data->dpd_action, diff --git a/src/libcharon/config/child_cfg.h b/src/libcharon/config/child_cfg.h index e3b59e656a..b80268513c 100644 --- a/src/libcharon/config/child_cfg.h +++ b/src/libcharon/config/child_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2018 Tobias Brunner + * Copyright (C) 2008-2019 Tobias Brunner * Copyright (C) 2016 Andreas Steffen * Copyright (C) 2005-2007 Martin Willi * Copyright (C) 2005 Jan Hutter @@ -226,6 +226,14 @@ struct child_cfg_t { */ uint32_t (*get_reqid)(child_cfg_t *this); + /** + * Optional interface ID to set on policies/SAs. + * + * @param inbound TRUE for inbound, FALSE for outbound + * @return interface ID + */ + uint32_t (*get_if_id)(child_cfg_t *this, bool inbound); + /** * Optional mark to set on policies/SAs. * @@ -350,6 +358,10 @@ struct child_cfg_create_t { child_cfg_option_t options; /** Specific reqid to use for CHILD_SA, 0 for auto assignment */ uint32_t reqid; + /** Optional inbound interface ID */ + uint32_t if_id_in; + /** Optional outbound interface ID */ + uint32_t if_id_out; /** Optional inbound mark */ mark_t mark_in; /** Optional outbound mark */