peer-cfg: Store mediated_by as name and not peer-cfg reference
This way updates to the mediation config are respected and the order in which configs are configured/loaded does not matter. The SQL plugin currently maintains the strong relationship between mediated and mediation connection (we could theoretically change that to a string too).
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2016 Tobias Brunner
|
||||
* Copyright (C) 2007-2017 Tobias Brunner
|
||||
* Copyright (C) 2005-2009 Martin Willi
|
||||
* Copyright (C) 2005 Jan Hutter
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
@@ -164,7 +164,7 @@ struct private_peer_cfg_t {
|
||||
/**
|
||||
* Name of the mediation connection to mediate through
|
||||
*/
|
||||
peer_cfg_t *mediated_by;
|
||||
char *mediated_by;
|
||||
|
||||
/**
|
||||
* ID of our peer at the mediation server (= leftid of the peer's conn with
|
||||
@@ -580,7 +580,7 @@ METHOD(peer_cfg_t, is_mediation, bool,
|
||||
return this->mediation;
|
||||
}
|
||||
|
||||
METHOD(peer_cfg_t, get_mediated_by, peer_cfg_t*,
|
||||
METHOD(peer_cfg_t, get_mediated_by, char*,
|
||||
private_peer_cfg_t *this)
|
||||
{
|
||||
return this->mediated_by;
|
||||
@@ -683,7 +683,7 @@ METHOD(peer_cfg_t, equals, bool,
|
||||
auth_cfg_equal(this, other)
|
||||
#ifdef ME
|
||||
&& this->mediation == other->mediation &&
|
||||
this->mediated_by == other->mediated_by &&
|
||||
streq(this->mediated_by, other->mediated_by) &&
|
||||
(this->peer_id == other->peer_id ||
|
||||
(this->peer_id && other->peer_id &&
|
||||
this->peer_id->equals(this->peer_id, other->peer_id)))
|
||||
@@ -713,8 +713,8 @@ METHOD(peer_cfg_t, destroy, void,
|
||||
this->vips->destroy_offset(this->vips, offsetof(host_t, destroy));
|
||||
this->pools->destroy_function(this->pools, free);
|
||||
#ifdef ME
|
||||
DESTROY_IF(this->mediated_by);
|
||||
DESTROY_IF(this->peer_id);
|
||||
free(this->mediated_by);
|
||||
#endif /* ME */
|
||||
this->mutex->destroy(this->mutex);
|
||||
free(this->name);
|
||||
@@ -802,7 +802,7 @@ peer_cfg_t *peer_cfg_create(char *name, ike_cfg_t *ike_cfg,
|
||||
.refcount = 1,
|
||||
#ifdef ME
|
||||
.mediation = data->mediation,
|
||||
.mediated_by = data->mediated_by,
|
||||
.mediated_by = strdupnull(data->mediated_by),
|
||||
.peer_id = data->peer_id,
|
||||
#endif /* ME */
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2016 Tobias Brunner
|
||||
* Copyright (C) 2007-2017 Tobias Brunner
|
||||
* Copyright (C) 2005-2009 Martin Willi
|
||||
* Copyright (C) 2005 Jan Hutter
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
@@ -319,14 +319,14 @@ struct peer_cfg_t {
|
||||
*
|
||||
* @return TRUE, if this is a mediation connection
|
||||
*/
|
||||
bool (*is_mediation) (peer_cfg_t *this);
|
||||
bool (*is_mediation)(peer_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Get peer_cfg of the connection this one is mediated through.
|
||||
* Get name of the connection this one is mediated through.
|
||||
*
|
||||
* @return the peer_cfg of the mediation connection
|
||||
* @return the name of the mediation connection
|
||||
*/
|
||||
peer_cfg_t* (*get_mediated_by) (peer_cfg_t *this);
|
||||
char* (*get_mediated_by)(peer_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Get the id of the other peer at the mediation server.
|
||||
@@ -338,7 +338,7 @@ struct peer_cfg_t {
|
||||
*
|
||||
* @return the id of the other peer
|
||||
*/
|
||||
identification_t* (*get_peer_id) (peer_cfg_t *this);
|
||||
identification_t* (*get_peer_id)(peer_cfg_t *this);
|
||||
#endif /* ME */
|
||||
|
||||
/**
|
||||
@@ -398,8 +398,8 @@ struct peer_cfg_create_t {
|
||||
#ifdef ME
|
||||
/** TRUE if this is a mediation connection */
|
||||
bool mediation;
|
||||
/** peer_cfg_t of the mediation connection to mediate through (adopted) */
|
||||
peer_cfg_t *mediated_by;
|
||||
/** peer_cfg_t of the mediation connection to mediate through (cloned) */
|
||||
char *mediated_by;
|
||||
/** ID that identifies our peer at the mediation server (adopted) */
|
||||
identification_t *peer_id;
|
||||
#endif /* ME */
|
||||
|
||||
Reference in New Issue
Block a user