From: Tobias Brunner Date: Fri, 22 Mar 2019 15:23:59 +0000 (+0100) Subject: peer-cfg: Add property for interface ID X-Git-Tag: 5.8.0rc1~41^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c56b8c1a26bf7c376255eacf3652de453cc32d97;p=thirdparty%2Fstrongswan.git peer-cfg: Add property for interface ID --- diff --git a/src/libcharon/config/peer_cfg.c b/src/libcharon/config/peer_cfg.c index e7dfb5f622..58e791f34b 100644 --- a/src/libcharon/config/peer_cfg.c +++ b/src/libcharon/config/peer_cfg.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2018 Tobias Brunner + * Copyright (C) 2007-2019 Tobias Brunner * Copyright (C) 2005-2009 Martin Willi * Copyright (C) 2005 Jan Hutter * HSR Hochschule fuer Technik Rapperswil @@ -155,6 +155,16 @@ struct private_peer_cfg_t { */ linked_list_t *remote_auth; + /** + * 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; + /** * PPK ID */ @@ -587,6 +597,12 @@ METHOD(peer_cfg_t, create_auth_cfg_enumerator, enumerator_t*, return this->remote_auth->create_enumerator(this->remote_auth); } +METHOD(peer_cfg_t, get_if_id, uint32_t, + private_peer_cfg_t *this, bool inbound) +{ + return inbound ? this->if_id_in : this->if_id_out; +} + METHOD(peer_cfg_t, get_ppk_id, identification_t*, private_peer_cfg_t *this) { @@ -715,6 +731,8 @@ METHOD(peer_cfg_t, equals, bool, this->aggressive == other->aggressive && this->pull_mode == other->pull_mode && auth_cfg_equal(this, other) && + this->if_id_in == other->if_id_in && + this->if_id_out == other->if_id_out && this->ppk_required == other->ppk_required && id_equal(this->ppk_id, other->ppk_id) #ifdef ME @@ -805,6 +823,7 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg, .create_pool_enumerator = _create_pool_enumerator, .add_auth_cfg = _add_auth_cfg, .create_auth_cfg_enumerator = _create_auth_cfg_enumerator, + .get_if_id = _get_if_id, .get_ppk_id = _get_ppk_id, .ppk_required = _ppk_required, .equals = (void*)_equals, @@ -832,6 +851,8 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg, .pull_mode = !data->push_mode, .dpd = data->dpd, .dpd_timeout = data->dpd_timeout, + .if_id_in = data->if_id_in, + .if_id_out = data->if_id_out, .ppk_id = data->ppk_id, .ppk_required = data->ppk_required, .vips = linked_list_create(), diff --git a/src/libcharon/config/peer_cfg.h b/src/libcharon/config/peer_cfg.h index 49c4d1492c..f4431266e7 100644 --- a/src/libcharon/config/peer_cfg.h +++ b/src/libcharon/config/peer_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2018 Tobias Brunner + * Copyright (C) 2007-2019 Tobias Brunner * Copyright (C) 2005-2009 Martin Willi * Copyright (C) 2005 Jan Hutter * HSR Hochschule fuer Technik Rapperswil @@ -311,6 +311,14 @@ struct peer_cfg_t { */ enumerator_t* (*create_pool_enumerator)(peer_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)(peer_cfg_t *this, bool inbound); + /** * Get the PPK ID to use with this peer. * @@ -407,6 +415,10 @@ struct peer_cfg_create_t { uint32_t dpd; /** DPD timeout interval (IKEv1 only), if 0 default applies */ uint32_t dpd_timeout; + /** Optional inbound interface ID */ + uint32_t if_id_in; + /** Optional outbound interface ID */ + uint32_t if_id_out; /** Postquantum Preshared Key ID (adopted) */ identification_t *ppk_id; /** TRUE if a PPK is required, FALSE if it's optional */