Fixed some typos; whitespace cleanup.

This commit is contained in:
Tobias Brunner
2009-09-02 17:30:46 +02:00
parent 5293b02945
commit 484a06bce7
18 changed files with 266 additions and 267 deletions
+4 -4
View File
@@ -130,10 +130,10 @@
* and virtual addresses. It further provides methods to enumerate interfaces * and virtual addresses. It further provides methods to enumerate interfaces
* and may notify the daemon about state changes at lower layers. * and may notify the daemon about state changes at lower layers.
* *
* The bus receives signals from the different threads and relais them to interested * The bus receives signals from the different threads and relays them to
* listeners. Debugging signals, but also important state changes or error * interested listeners. Debugging signals, but also important state changes or
* messages are sent over the bus. * error messages are sent over the bus.
* It's listeners are not only for logging, but also to track the state of an * Its listeners are not only for logging, but also to track the state of an
* IKE_SA. * IKE_SA.
* *
* The controller, credential_manager, bus and backend_manager (config) are * The controller, credential_manager, bus and backend_manager (config) are
@@ -27,7 +27,6 @@ typedef struct private_ike_header_t private_ike_header_t;
/** /**
* Private data of an ike_header_t object. * Private data of an ike_header_t object.
*
*/ */
struct private_ike_header_t { struct private_ike_header_t {
/** /**
@@ -66,7 +65,6 @@ struct private_ike_header_t {
/** /**
* Flags of the Message. * Flags of the Message.
*
*/ */
struct { struct {
/** /**
@@ -116,7 +114,6 @@ ENUM_END(exchange_type_names, INFORMATIONAL);
* *
* The defined offsets are the positions in a object of type * The defined offsets are the positions in a object of type
* ike_header_t. * ike_header_t.
*
*/ */
encoding_rule_t ike_header_encodings[] = { encoding_rule_t ike_header_encodings[] = {
/* 8 Byte SPI, stored in the field initiator_spi */ /* 8 Byte SPI, stored in the field initiator_spi */
@@ -160,7 +160,6 @@ struct ike_header_t {
* Set the response flag- * Set the response flag-
* *
* @param response response flag * @param response response flag
*
*/ */
void (*set_response_flag) (ike_header_t *this, bool response); void (*set_response_flag) (ike_header_t *this, bool response);
/** /**
+5 -6
View File
@@ -533,8 +533,8 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this,
#ifdef ME #ifdef ME
if (msg->add_conn.ikeme.mediation && msg->add_conn.ikeme.mediated_by) if (msg->add_conn.ikeme.mediation && msg->add_conn.ikeme.mediated_by)
{ {
DBG1(DBG_CFG, "a mediation connection cannot be a" DBG1(DBG_CFG, "a mediation connection cannot be a mediated connection "
" mediated connection at the same time, aborting"); "at the same time, aborting");
return NULL; return NULL;
} }
@@ -547,19 +547,18 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this,
if (msg->add_conn.ikeme.mediated_by) if (msg->add_conn.ikeme.mediated_by)
{ {
mediated_by = charon->backends->get_peer_cfg_by_name(charon->backends, mediated_by = charon->backends->get_peer_cfg_by_name(charon->backends,
msg->add_conn.ikeme.mediated_by); msg->add_conn.ikeme.mediated_by);
if (!mediated_by) if (!mediated_by)
{ {
DBG1(DBG_CFG, "mediation connection '%s' not found, aborting", DBG1(DBG_CFG, "mediation connection '%s' not found, aborting",
msg->add_conn.ikeme.mediated_by); msg->add_conn.ikeme.mediated_by);
return NULL; return NULL;
} }
if (!mediated_by->is_mediation(mediated_by)) if (!mediated_by->is_mediation(mediated_by))
{ {
DBG1(DBG_CFG, "connection '%s' as referred to by '%s' is" DBG1(DBG_CFG, "connection '%s' as referred to by '%s' is "
"no mediation connection, aborting", "no mediation connection, aborting",
msg->add_conn.ikeme.mediated_by, msg->add_conn.name); msg->add_conn.ikeme.mediated_by, msg->add_conn.name);
mediated_by->destroy(mediated_by); mediated_by->destroy(mediated_by);
return NULL; return NULL;
} }
+14 -12
View File
@@ -988,7 +988,7 @@ static chunk_t get_connect_id(private_ike_sa_t *this)
* Implementation of ike_sa_t.respond * Implementation of ike_sa_t.respond
*/ */
static status_t respond(private_ike_sa_t *this, identification_t *peer_id, static status_t respond(private_ike_sa_t *this, identification_t *peer_id,
chunk_t connect_id) chunk_t connect_id)
{ {
ike_me_t *task = ike_me_create(&this->public, TRUE); ike_me_t *task = ike_me_create(&this->public, TRUE);
task->respond(task, peer_id, connect_id); task->respond(task, peer_id, connect_id);
@@ -1011,7 +1011,8 @@ static status_t callback(private_ike_sa_t *this, identification_t *peer_id)
* Implementation of ike_sa_t.relay * Implementation of ike_sa_t.relay
*/ */
static status_t relay(private_ike_sa_t *this, identification_t *requester, static status_t relay(private_ike_sa_t *this, identification_t *requester,
chunk_t connect_id, chunk_t connect_key, linked_list_t *endpoints, bool response) chunk_t connect_id, chunk_t connect_key,
linked_list_t *endpoints, bool response)
{ {
ike_me_t *task = ike_me_create(&this->public, TRUE); ike_me_t *task = ike_me_create(&this->public, TRUE);
task->relay(task, requester, connect_id, connect_key, endpoints, response); task->relay(task, requester, connect_id, connect_key, endpoints, response);
@@ -1022,7 +1023,8 @@ static status_t relay(private_ike_sa_t *this, identification_t *requester,
/** /**
* Implementation of ike_sa_t.initiate_mediation * Implementation of ike_sa_t.initiate_mediation
*/ */
static status_t initiate_mediation(private_ike_sa_t *this, peer_cfg_t *mediated_cfg) static status_t initiate_mediation(private_ike_sa_t *this,
peer_cfg_t *mediated_cfg)
{ {
ike_me_t *task = ike_me_create(&this->public, TRUE); ike_me_t *task = ike_me_create(&this->public, TRUE);
task->connect(task, mediated_cfg->get_peer_id(mediated_cfg)); task->connect(task, mediated_cfg->get_peer_id(mediated_cfg));
@@ -1033,14 +1035,13 @@ static status_t initiate_mediation(private_ike_sa_t *this, peer_cfg_t *mediated_
/** /**
* Implementation of ike_sa_t.initiate_mediated * Implementation of ike_sa_t.initiate_mediated
*/ */
static status_t initiate_mediated(private_ike_sa_t *this, host_t *me, host_t *other, static status_t initiate_mediated(private_ike_sa_t *this, host_t *me,
chunk_t connect_id) host_t *other, chunk_t connect_id)
{ {
set_my_host(this, me->clone(me)); set_my_host(this, me->clone(me));
set_other_host(this, other->clone(other)); set_other_host(this, other->clone(other));
chunk_free(&this->connect_id); chunk_free(&this->connect_id);
this->connect_id = chunk_clone(connect_id); this->connect_id = chunk_clone(connect_id);
return this->task_manager->initiate(this->task_manager); return this->task_manager->initiate(this->task_manager);
} }
#endif /* ME */ #endif /* ME */
@@ -1158,8 +1159,8 @@ static status_t initiate(private_ike_sa_t *this,
{ {
if (this->state == IKE_ESTABLISHED) if (this->state == IKE_ESTABLISHED)
{ {
/* mediation connection is already established, retrigger state change /* mediation connection is already established, retrigger state
* to notify bus listeners */ * change to notify bus listeners */
DBG1(DBG_IKE, "mediation connection is already up"); DBG1(DBG_IKE, "mediation connection is already up");
set_state(this, IKE_ESTABLISHED); set_state(this, IKE_ESTABLISHED);
} }
@@ -1509,7 +1510,7 @@ static status_t reauth(private_ike_sa_t *this)
if (this->other_virtual_ip != NULL || if (this->other_virtual_ip != NULL ||
has_condition(this, COND_EAP_AUTHENTICATED) has_condition(this, COND_EAP_AUTHENTICATED)
#ifdef ME #ifdef ME
/* if we are mediation server we too cannot reauth the IKE_SA */ /* as mediation server we too cannot reauth the IKE_SA */
|| this->is_mediation_server || this->is_mediation_server
#endif /* ME */ #endif /* ME */
) )
@@ -1545,7 +1546,7 @@ static status_t reestablish(private_ike_sa_t *this)
bool required = FALSE; bool required = FALSE;
status_t status = FAILED; status_t status = FAILED;
/* check if we have children to keep up at all*/ /* check if we have children to keep up at all */
iterator = create_child_sa_iterator(this); iterator = create_child_sa_iterator(this);
while (iterator->iterate(iterator, (void**)&child_sa)) while (iterator->iterate(iterator, (void**)&child_sa))
{ {
@@ -1569,7 +1570,7 @@ static status_t reestablish(private_ike_sa_t *this)
} }
iterator->destroy(iterator); iterator->destroy(iterator);
#ifdef ME #ifdef ME
/* we initiate the new IKE_SA of the mediation connection without CHILD_SA */ /* mediation connections have no children, keep them up anyway */
if (this->peer_cfg->is_mediation(this->peer_cfg)) if (this->peer_cfg->is_mediation(this->peer_cfg))
{ {
required = TRUE; required = TRUE;
@@ -1992,7 +1993,8 @@ static void destroy(private_ike_sa_t *this)
#ifdef ME #ifdef ME
if (this->is_mediation_server) if (this->is_mediation_server)
{ {
charon->mediation_manager->remove(charon->mediation_manager, this->ike_sa_id); charon->mediation_manager->remove(charon->mediation_manager,
this->ike_sa_id);
} }
DESTROY_IF(this->server_reflexive_host); DESTROY_IF(this->server_reflexive_host);
chunk_free(&this->connect_id); chunk_free(&this->connect_id);
+31 -29
View File
@@ -536,55 +536,56 @@ struct ike_sa_t {
/** /**
* Initiate the mediation of a mediated connection (i.e. initiate a * Initiate the mediation of a mediated connection (i.e. initiate a
* ME_CONNECT exchange). * ME_CONNECT exchange to a mediation server).
* *
* @param mediated_cfg peer_cfg of the mediated connection * @param mediated_cfg peer_cfg of the mediated connection
* @return * @return
* - SUCCESS if initialization started * - SUCCESS if initialization started
* - DESTROY_ME if initialization failed * - DESTROY_ME if initialization failed
*/ */
status_t (*initiate_mediation) (ike_sa_t *this, peer_cfg_t *mediated_cfg); status_t (*initiate_mediation) (ike_sa_t *this, peer_cfg_t *mediated_cfg);
/** /**
* Initiate the mediated connection * Initiate the mediated connection
* *
* @param me local endpoint (gets cloned) * @param me local endpoint (gets cloned)
* @param other remote endpoint (gets cloned) * @param other remote endpoint (gets cloned)
* @param connect_id connect ID (gets cloned) * @param connect_id connect ID (gets cloned)
* @return * @return
* - SUCCESS if initialization started * - SUCCESS if initialization started
* - DESTROY_ME if initialization failed * - DESTROY_ME if initialization failed
*/ */
status_t (*initiate_mediated) (ike_sa_t *this, host_t *me, host_t *other, status_t (*initiate_mediated) (ike_sa_t *this, host_t *me, host_t *other,
chunk_t connect_id); chunk_t connect_id);
/** /**
* Relay data from one peer to another (i.e. initiate a * Relay data from one peer to another (i.e. initiate a ME_CONNECT exchange
* ME_CONNECT exchange). * to a peer).
* *
* Data is cloned. * Data is cloned.
* *
* @param requester ID of the requesting peer * @param requester ID of the requesting peer
* @param connect_id data of the ME_CONNECTID payload * @param connect_id data of the ME_CONNECTID payload
* @param connect_key data of the ME_CONNECTKEY payload * @param connect_key data of the ME_CONNECTKEY payload
* @param endpoints endpoints * @param endpoints endpoints
* @param response TRUE if this is a response * @param response TRUE if this is a response
* @return * @return
* - SUCCESS if relay started * - SUCCESS if relay started
* - DESTROY_ME if relay failed * - DESTROY_ME if relay failed
*/ */
status_t (*relay) (ike_sa_t *this, identification_t *requester, chunk_t connect_id, status_t (*relay) (ike_sa_t *this, identification_t *requester,
chunk_t connect_key, linked_list_t *endpoints, bool response); chunk_t connect_id, chunk_t connect_key,
linked_list_t *endpoints, bool response);
/** /**
* Send a callback to a peer. * Send a callback to a peer.
* *
* Data is cloned. * Data is cloned.
* *
* @param peer_id ID of the other peer * @param peer_id ID of the other peer
* @return * @return
* - SUCCESS if response started * - SUCCESS if response started
* - DESTROY_ME if response failed * - DESTROY_ME if response failed
*/ */
status_t (*callback) (ike_sa_t *this, identification_t *peer_id); status_t (*callback) (ike_sa_t *this, identification_t *peer_id);
@@ -593,13 +594,14 @@ struct ike_sa_t {
* *
* Data is cloned. * Data is cloned.
* *
* @param peer_id ID of the other peer * @param peer_id ID of the other peer
* @param connect_id the connect ID supplied by the initiator * @param connect_id the connect ID supplied by the initiator
* @return * @return
* - SUCCESS if response started * - SUCCESS if response started
* - DESTROY_ME if response failed * - DESTROY_ME if response failed
*/ */
status_t (*respond) (ike_sa_t *this, identification_t *peer_id, chunk_t connect_id); status_t (*respond) (ike_sa_t *this, identification_t *peer_id,
chunk_t connect_id);
#endif /* ME */ #endif /* ME */
/** /**
+1 -1
View File
@@ -278,7 +278,7 @@ static status_t process_i(private_ike_natd_t *this, message_t *message)
if (this->ike_sa->has_condition(this->ike_sa, COND_NAT_ANY) || if (this->ike_sa->has_condition(this->ike_sa, COND_NAT_ANY) ||
#ifdef ME #ifdef ME
/* if we are on a mediation connection we swith to port 4500 even /* if we are on a mediation connection we switch to port 4500 even
* if no NAT is detected. */ * if no NAT is detected. */
peer_cfg->is_mediation(peer_cfg) || peer_cfg->is_mediation(peer_cfg) ||
#endif /* ME */ #endif /* ME */
+1 -1
View File
@@ -70,7 +70,7 @@ static status_t process_i(private_ike_reauth_t *this, message_t *message)
iterator = this->ike_sa->create_child_sa_iterator(this->ike_sa); iterator = this->ike_sa->create_child_sa_iterator(this->ike_sa);
if (iterator->get_count(iterator) == 0 if (iterator->get_count(iterator) == 0
#ifdef ME #ifdef ME
/* we allow a peer to reauth a mediation connection (without CHILD_SA) */ /* we allow peers to reauth mediation connections (without children) */
&& !peer_cfg->is_mediation(peer_cfg) && !peer_cfg->is_mediation(peer_cfg)
#endif /* ME */ #endif /* ME */
) )