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
+23 -21
View File
@@ -148,7 +148,7 @@ struct private_ike_sa_t {
*/
chunk_t connect_id;
#endif /* ME */
/**
* Identification used for us
*/
@@ -637,7 +637,7 @@ static void set_state(private_ike_sa_t *this, ike_sa_state_t state)
/* schedule rekeying if we have a time which is smaller than
* an already scheduled rekeying */
t = this->peer_cfg->get_rekey_time(this->peer_cfg);
if (t && (this->stats[STAT_REKEY] == 0 ||
if (t && (this->stats[STAT_REKEY] == 0 ||
(this->stats[STAT_REKEY] > t + this->stats[STAT_ESTABLISHED])))
{
this->stats[STAT_REKEY] = t + this->stats[STAT_ESTABLISHED];
@@ -646,7 +646,7 @@ static void set_state(private_ike_sa_t *this, ike_sa_state_t state)
DBG1(DBG_IKE, "scheduling rekeying in %ds", t);
}
t = this->peer_cfg->get_reauth_time(this->peer_cfg);
if (t && (this->stats[STAT_REAUTH] == 0 ||
if (t && (this->stats[STAT_REAUTH] == 0 ||
(this->stats[STAT_REAUTH] > t + this->stats[STAT_ESTABLISHED])))
{
this->stats[STAT_REAUTH] = t + this->stats[STAT_ESTABLISHED];
@@ -686,7 +686,7 @@ static void set_state(private_ike_sa_t *this, ike_sa_state_t state)
{
/* delete may fail if a packet gets lost, so set a timeout */
job_t *job = (job_t*)delete_ike_sa_job_create(this->ike_sa_id, TRUE);
charon->scheduler->schedule_job(charon->scheduler, job,
charon->scheduler->schedule_job(charon->scheduler, job,
HALF_OPEN_IKE_SA_TIMEOUT);
break;
}
@@ -988,7 +988,7 @@ static chunk_t get_connect_id(private_ike_sa_t *this)
* Implementation of ike_sa_t.respond
*/
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);
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
*/
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);
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
*/
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);
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
*/
static status_t initiate_mediated(private_ike_sa_t *this, host_t *me, host_t *other,
chunk_t connect_id)
static status_t initiate_mediated(private_ike_sa_t *this, host_t *me,
host_t *other, chunk_t connect_id)
{
set_my_host(this, me->clone(me));
set_other_host(this, other->clone(other));
chunk_free(&this->connect_id);
this->connect_id = chunk_clone(connect_id);
return this->task_manager->initiate(this->task_manager);
}
#endif /* ME */
@@ -1158,8 +1159,8 @@ static status_t initiate(private_ike_sa_t *this,
{
if (this->state == IKE_ESTABLISHED)
{
/* mediation connection is already established, retrigger state change
* to notify bus listeners */
/* mediation connection is already established, retrigger state
* change to notify bus listeners */
DBG1(DBG_IKE, "mediation connection is already up");
set_state(this, IKE_ESTABLISHED);
}
@@ -1509,7 +1510,7 @@ static status_t reauth(private_ike_sa_t *this)
if (this->other_virtual_ip != NULL ||
has_condition(this, COND_EAP_AUTHENTICATED)
#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
#endif /* ME */
)
@@ -1545,7 +1546,7 @@ static status_t reestablish(private_ike_sa_t *this)
bool required = FALSE;
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);
while (iterator->iterate(iterator, (void**)&child_sa))
{
@@ -1569,7 +1570,7 @@ static status_t reestablish(private_ike_sa_t *this)
}
iterator->destroy(iterator);
#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))
{
required = TRUE;
@@ -1720,7 +1721,7 @@ static void set_auth_lifetime(private_ike_sa_t *this, u_int32_t lifetime)
(job_t*)rekey_ike_sa_job_create(this->ike_sa_id, TRUE));
}
else if (this->stats[STAT_REAUTH] == 0 ||
this->stats[STAT_REAUTH] > reauth_time)
this->stats[STAT_REAUTH] > reauth_time)
{
this->stats[STAT_REAUTH] = reauth_time;
DBG1(DBG_IKE, "received AUTH_LIFETIME of %ds, scheduling reauthentication"
@@ -1886,7 +1887,7 @@ static status_t inherit(private_ike_sa_t *this, private_ike_sa_t *other)
}
/* ... and configuration attributes */
while (other->attributes->remove_last(other->attributes,
while (other->attributes->remove_last(other->attributes,
(void**)&entry) == SUCCESS)
{
this->attributes->insert_first(this->attributes, entry);
@@ -1932,9 +1933,9 @@ static status_t inherit(private_ike_sa_t *this, private_ike_sa_t *other)
this->stats[STAT_DELETE] = this->stats[STAT_REAUTH] + delete;
DBG1(DBG_IKE, "rescheduling reauthentication in %ds after rekeying, "
"lifetime reduced to %ds", reauth, delete);
charon->scheduler->schedule_job(charon->scheduler,
charon->scheduler->schedule_job(charon->scheduler,
(job_t*)rekey_ike_sa_job_create(this->ike_sa_id, TRUE), reauth);
charon->scheduler->schedule_job(charon->scheduler,
charon->scheduler->schedule_job(charon->scheduler,
(job_t*)delete_ike_sa_job_create(this->ike_sa_id, TRUE), delete);
}
/* we have to initate here, there may be new tasks to handle */
@@ -1953,7 +1954,7 @@ static void destroy(private_ike_sa_t *this)
set_state(this, IKE_DESTROYING);
/* remove attributes first, as we pass the IKE_SA to the handler */
while (this->attributes->remove_last(this->attributes,
while (this->attributes->remove_last(this->attributes,
(void**)&entry) == SUCCESS)
{
charon->attributes->release(charon->attributes, entry->handler,
@@ -1992,7 +1993,8 @@ static void destroy(private_ike_sa_t *this)
#ifdef ME
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);
chunk_free(&this->connect_id);
+78 -76
View File
@@ -164,7 +164,7 @@ enum statistic_t {
¦ SA_CREATED ¦
+----------------+
¦
on initiate()---> ¦ <----- on IKE_SA_INIT received
on initiate()---> ¦ <----- on IKE_SA_INIT received
V
+----------------+
¦ SA_CONNECTING ¦
@@ -246,7 +246,7 @@ struct ike_sa_t {
/**
* Get the id of the SA.
*
*
* Returned ike_sa_id_t object is not getting cloned!
*
* @return ike_sa's ike_sa_id_t
@@ -291,28 +291,28 @@ struct ike_sa_t {
/**
* Get the own host address.
*
*
* @return host address
*/
host_t* (*get_my_host) (ike_sa_t *this);
/**
* Set the own host address.
*
*
* @param me host address
*/
void (*set_my_host) (ike_sa_t *this, host_t *me);
/**
* Get the other peers host address.
*
*
* @return host address
*/
host_t* (*get_other_host) (ike_sa_t *this);
/**
* Set the others host address.
*
*
* @param other host address
*/
void (*set_other_host) (ike_sa_t *this, host_t *other);
@@ -329,28 +329,28 @@ struct ike_sa_t {
/**
* Get the own identification.
*
*
* @return identification
*/
identification_t* (*get_my_id) (ike_sa_t *this);
/**
* Set the own identification.
*
*
* @param me identification
*/
void (*set_my_id) (ike_sa_t *this, identification_t *me);
/**
* Get the other peer's identification.
*
*
* @return identification
*/
identification_t* (*get_other_id) (ike_sa_t *this);
/**
* Set the other peer's identification.
*
*
* @param other identification
*/
void (*set_other_id) (ike_sa_t *this, identification_t *other);
@@ -359,42 +359,42 @@ struct ike_sa_t {
* Get the peers EAP identity.
*
* The EAP identity is exchanged in a EAP-Identity exchange.
*
*
* @return identification, NULL if none set
*/
identification_t* (*get_eap_identity) (ike_sa_t *this);
/**
* Set the peer's EAP identity.
*
*
* @param id identification
*/
void (*set_eap_identity) (ike_sa_t *this, identification_t *id);
/**
* Get the config used to setup this IKE_SA.
*
*
* @return ike_config
*/
ike_cfg_t* (*get_ike_cfg) (ike_sa_t *this);
/**
* Set the config to setup this IKE_SA.
*
*
* @param config ike_config to use
*/
void (*set_ike_cfg) (ike_sa_t *this, ike_cfg_t* config);
/**
* Get the peer config used by this IKE_SA.
*
*
* @return peer_config
*/
peer_cfg_t* (*get_peer_cfg) (ike_sa_t *this);
/**
* Set the peer config to use with this IKE_SA.
*
*
* @param config peer_config to use
*/
void (*set_peer_cfg) (ike_sa_t *this, peer_cfg_t *config);
@@ -515,91 +515,93 @@ struct ike_sa_t {
/**
* Get the server reflexive host.
*
*
* @return server reflexive host
*/
host_t* (*get_server_reflexive_host) (ike_sa_t *this);
/**
* Set the server reflexive host.
*
*
* @param host server reflexive host
*/
void (*set_server_reflexive_host) (ike_sa_t *this, host_t *host);
/**
* Get the connect ID.
*
*
* @return connect ID
*/
chunk_t (*get_connect_id) (ike_sa_t *this);
/**
* Initiate the mediation of a mediated connection (i.e. initiate a
* ME_CONNECT exchange).
*
* @param mediated_cfg peer_cfg of the mediated connection
* @return
* - SUCCESS if initialization started
* - DESTROY_ME if initialization failed
* ME_CONNECT exchange to a mediation server).
*
* @param mediated_cfg peer_cfg of the mediated connection
* @return
* - SUCCESS if initialization started
* - DESTROY_ME if initialization failed
*/
status_t (*initiate_mediation) (ike_sa_t *this, peer_cfg_t *mediated_cfg);
/**
* Initiate the mediated connection
*
* @param me local endpoint (gets cloned)
* @param other remote endpoint (gets cloned)
* @param connect_id connect ID (gets cloned)
* @return
* - SUCCESS if initialization started
* - DESTROY_ME if initialization failed
*
* @param me local endpoint (gets cloned)
* @param other remote endpoint (gets cloned)
* @param connect_id connect ID (gets cloned)
* @return
* - SUCCESS if initialization started
* - DESTROY_ME if initialization failed
*/
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
* ME_CONNECT exchange).
* Relay data from one peer to another (i.e. initiate a ME_CONNECT exchange
* to a peer).
*
* Data is cloned.
*
* @param requester ID of the requesting peer
* @param connect_id data of the ME_CONNECTID payload
* @param connect_key data of the ME_CONNECTKEY payload
* @param endpoints endpoints
* @param response TRUE if this is a response
* @return
* - SUCCESS if relay started
* - DESTROY_ME if relay failed
*
* @param requester ID of the requesting peer
* @param connect_id data of the ME_CONNECTID payload
* @param connect_key data of the ME_CONNECTKEY payload
* @param endpoints endpoints
* @param response TRUE if this is a response
* @return
* - SUCCESS if relay started
* - DESTROY_ME if relay failed
*/
status_t (*relay) (ike_sa_t *this, identification_t *requester, chunk_t connect_id,
chunk_t connect_key, linked_list_t *endpoints, bool response);
status_t (*relay) (ike_sa_t *this, identification_t *requester,
chunk_t connect_id, chunk_t connect_key,
linked_list_t *endpoints, bool response);
/**
* Send a callback to a peer.
*
*
* Data is cloned.
*
* @param peer_id ID of the other peer
*
* @param peer_id ID of the other peer
* @return
* - SUCCESS if response started
* - DESTROY_ME if response failed
* - SUCCESS if response started
* - DESTROY_ME if response failed
*/
status_t (*callback) (ike_sa_t *this, identification_t *peer_id);
/**
* Respond to a ME_CONNECT request.
*
*
* Data is cloned.
*
* @param peer_id ID of the other peer
* @param connect_id the connect ID supplied by the initiator
*
* @param peer_id ID of the other peer
* @param connect_id the connect ID supplied by the initiator
* @return
* - SUCCESS if response started
* - DESTROY_ME if response failed
* - SUCCESS if response started
* - 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 */
/**
@@ -608,12 +610,12 @@ struct ike_sa_t {
* The configs are owned by the IKE_SA after the call. If the initiate
* is triggered by a packet, traffic selectors of the packet can be added
* to the CHILD_SA.
*
*
* @param child_cfg child config to create CHILD from
* @param reqid reqid to use for CHILD_SA, 0 assigne uniquely
* @param tsi source of triggering packet
* @param tsr destination of triggering packet.
* @return
* @return
* - SUCCESS if initialization started
* - DESTROY_ME if initialization failed
*/
@@ -623,14 +625,14 @@ struct ike_sa_t {
/**
* Initiates the deletion of an IKE_SA.
*
*
* Sends a delete message to the remote peer and waits for
* its response. If the response comes in, or a timeout occurs,
* the IKE SA gets deleted.
*
*
* @return
* - SUCCESS if deletion is initialized
* - DESTROY_ME, if the IKE_SA is not in
* - DESTROY_ME, if the IKE_SA is not in
* an established state and can not be
* deleted (but destroyed).
*/
@@ -653,12 +655,12 @@ struct ike_sa_t {
/**
* Processes a incoming IKEv2-Message.
*
* Message processing may fail. If a critical failure occurs,
* process_message() return DESTROY_ME. Then the caller must
* Message processing may fail. If a critical failure occurs,
* process_message() return DESTROY_ME. Then the caller must
* destroy the IKE_SA immediatly, as it is unusable.
*
*
* @param message message to process
* @return
* @return
* - SUCCESS
* - FAILED
* - DESTROY_ME if this IKE_SA MUST be deleted
@@ -667,13 +669,13 @@ struct ike_sa_t {
/**
* Generate a IKE message to send it to the peer.
*
*
* This method generates all payloads in the message and encrypts/signs
* the packet.
*
*
* @param message message to generate
* @param packet generated output packet
* @return
* @return
* - SUCCESS
* - FAILED
* - DESTROY_ME if this IKE_SA MUST be deleted
@@ -683,7 +685,7 @@ struct ike_sa_t {
/**
* Retransmits a request.
*
*
* @param message_id ID of the request to retransmit
* @return
* - SUCCESS
@@ -697,7 +699,7 @@ struct ike_sa_t {
* To check if a peer is still alive, periodic
* empty INFORMATIONAL messages are sent if no
* other traffic was received.
*
*
* @return
* - SUCCESS
* - DESTROY_ME, if peer did not respond
@@ -723,25 +725,25 @@ struct ike_sa_t {
/**
* Associates a child SA to this IKE SA
*
*
* @param child_sa child_sa to add
*/
void (*add_child_sa) (ike_sa_t *this, child_sa_t *child_sa);
/**
* Get a CHILD_SA identified by protocol and SPI.
*
*
* @param protocol protocol of the SA
* @param spi SPI of the CHILD_SA
* @param inbound TRUE if SPI is inbound, FALSE if outbound
* @return child_sa, or NULL if none found
*/
child_sa_t* (*get_child_sa) (ike_sa_t *this, protocol_id_t protocol,
child_sa_t* (*get_child_sa) (ike_sa_t *this, protocol_id_t protocol,
u_int32_t spi, bool inbound);
/**
* Create an iterator over all CHILD_SAs.
*
*
* @return iterator
*/
iterator_t* (*create_child_sa_iterator) (ike_sa_t *this);
+4 -4
View File
@@ -133,7 +133,7 @@ struct private_task_manager_t {
linked_list_t *passive_tasks;
/**
* the task manager has been reset
* the task manager has been reset
*/
bool reset;
};
@@ -143,7 +143,7 @@ struct private_task_manager_t {
*/
static void flush(private_task_manager_t *this)
{
this->queued_tasks->destroy_offset(this->queued_tasks,
this->queued_tasks->destroy_offset(this->queued_tasks,
offsetof(task_t, destroy));
this->passive_tasks->destroy_offset(this->passive_tasks,
offsetof(task_t, destroy));
@@ -521,7 +521,7 @@ static status_t process_response(private_task_manager_t *this,
this->reset = FALSE;
iterator->destroy(iterator);
return build_request(this);
}
}
}
iterator->destroy(iterator);
@@ -688,7 +688,7 @@ static status_t process_request(private_task_manager_t *this,
this->passive_tasks->insert_last(this->passive_tasks, task);
task = (task_t*)ike_cert_pre_create(this->ike_sa, FALSE);
this->passive_tasks->insert_last(this->passive_tasks, task);
#ifdef ME
#ifdef ME
task = (task_t*)ike_me_create(this->ike_sa, FALSE);
this->passive_tasks->insert_last(this->passive_tasks, task);
#endif /* ME */
+5 -5
View File
@@ -123,7 +123,7 @@ static void build_payloads(private_ike_init_t *this, message_t *message)
{
proposal_list = this->config->get_proposals(this->config);
if (this->old_sa)
{
{
/* include SPI of new IKE_SA when we are rekeying */
iterator = proposal_list->create_iterator(proposal_list, TRUE);
while (iterator->iterate(iterator, (void**)&proposal))
@@ -184,7 +184,7 @@ static void process_payloads(private_ike_init_t *this, message_t *message)
proposal_list = sa_payload->get_proposals(sa_payload);
this->proposal = this->config->select_proposal(this->config,
proposal_list);
proposal_list->destroy_offset(proposal_list,
proposal_list->destroy_offset(proposal_list,
offsetof(proposal_t, destroy));
break;
}
@@ -217,7 +217,7 @@ static void process_payloads(private_ike_init_t *this, message_t *message)
vendor_id_payload_t *vendor_id = (vendor_id_payload_t*)payload;
chunk_t vid = vendor_id->get_data(vendor_id);
DBG1(DBG_ENC, "received vendor id: %#B", &vid);
DBG1(DBG_ENC, "received vendor id: %#B", &vid);
}
default:
break;
@@ -296,7 +296,7 @@ static status_t build_i(private_ike_init_t *this, message_t *message)
* Implementation of task_t.process for responder
*/
static status_t process_r(private_ike_init_t *this, message_t *message)
{
{
rng_t *rng;
this->config = this->ike_sa->get_ike_cfg(this->ike_sa);
@@ -513,7 +513,7 @@ static status_t process_i(private_ike_init_t *this, message_t *message)
DBG1(DBG_IKE, "received %N notify error",
notify_type_names, type);
enumerator->destroy(enumerator);
return FAILED;
return FAILED;
}
DBG2(DBG_IKE, "received %N notify",
notify_type_names, type);
+5 -5
View File
@@ -137,7 +137,7 @@ static notify_payload_t *build_natd_payload(private_ike_natd_t *this,
notify_type_t type, host_t *host)
{
chunk_t hash;
notify_payload_t *notify;
notify_payload_t *notify;
ike_sa_id_t *ike_sa_id;
ike_cfg_t *config;
@@ -245,12 +245,12 @@ static void process_payloads(private_ike_natd_t *this, message_t *message)
this->ike_sa->set_condition(this->ike_sa, COND_NAT_HERE,
!this->dst_matched);
this->ike_sa->set_condition(this->ike_sa, COND_NAT_THERE,
!this->src_matched);
!this->src_matched);
config = this->ike_sa->get_ike_cfg(this->ike_sa);
if (this->dst_matched && this->src_matched &&
config->force_encap(config))
{
this->ike_sa->set_condition(this->ike_sa, COND_NAT_FAKE, TRUE);
this->ike_sa->set_condition(this->ike_sa, COND_NAT_FAKE, TRUE);
}
}
}
@@ -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) ||
#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. */
peer_cfg->is_mediation(peer_cfg) ||
#endif /* ME */
@@ -406,7 +406,7 @@ static status_t build_r(private_ike_natd_t *this, message_t *message)
* Implementation of task_t.process for responder
*/
static status_t process_r(private_ike_natd_t *this, message_t *message)
{
{
process_payloads(this, message);
return NEED_MORE;
+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);
if (iterator->get_count(iterator) == 0
#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)
#endif /* ME */
)
+3 -3
View File
@@ -79,7 +79,7 @@ extern enum_name_t *task_type_names;
*
* A task is an elemantary operation. It may be handled by a single or by
* multiple exchanges. An exchange may even complete multiple tasks.
* A task has a build() and an process() operation. The build() operation
* A task has a build() and an process() operation. The build() operation
* creates payloads and adds it to the message. The process() operation
* inspects a message and handles its payloads. An initiator of an exchange
* first calls build() to build the request, and processes the response message
@@ -97,7 +97,7 @@ struct task_t {
/**
* Build a request or response message for this task.
*
*
* @param message message to add payloads to
* @return
* - FAILED if a critical error occured
@@ -109,7 +109,7 @@ struct task_t {
/**
* Process a request or response message for this task.
*
*
* @param message message to read payloads from
* @return
* - FAILED if a critical error occured