diff options
Diffstat (limited to 'Source/charon/sa')
-rw-r--r-- | Source/charon/sa/authenticator.c | 4 | ||||
-rw-r--r-- | Source/charon/sa/ike_sa.c | 90 | ||||
-rw-r--r-- | Source/charon/sa/ike_sa_manager.c | 42 | ||||
-rw-r--r-- | Source/charon/sa/states/ike_auth_requested.c | 14 | ||||
-rw-r--r-- | Source/charon/sa/states/ike_sa_init_requested.c | 74 | ||||
-rw-r--r-- | Source/charon/sa/states/ike_sa_init_responded.c | 48 | ||||
-rw-r--r-- | Source/charon/sa/states/initiator_init.c | 42 | ||||
-rw-r--r-- | Source/charon/sa/states/responder_init.c | 94 |
8 files changed, 205 insertions, 203 deletions
diff --git a/Source/charon/sa/authenticator.c b/Source/charon/sa/authenticator.c index 66ed73619..b86cac38e 100644 --- a/Source/charon/sa/authenticator.c +++ b/Source/charon/sa/authenticator.c @@ -141,7 +141,7 @@ static chunk_t allocate_octets(private_authenticator_t *this,chunk_t last_messag current_pos += other_nonce.len; this->prf->get_bytes(this->prf,id_with_header_chunk,current_pos); - this->logger->log_chunk(this->logger,RAW | MOST, "Octets (Mesage + Nonce + prf(Sk_px,Idx)",&octets); + this->logger->log_chunk(this->logger,RAW | LEVEL2, "Octets (Mesage + Nonce + prf(Sk_px,Idx)",&octets); return octets; } @@ -166,7 +166,7 @@ static chunk_t allocate_auth_data_with_preshared_secret (private_authenticator_t this->prf->set_key(this->prf,key); this->prf->allocate_bytes(this->prf,octets,&auth_data); allocator_free_chunk(&octets); - this->logger->log_chunk(this->logger,RAW | MOST, "Authenticated data",&auth_data); + this->logger->log_chunk(this->logger,RAW | LEVEL2, "Authenticated data",&auth_data); return auth_data; } diff --git a/Source/charon/sa/ike_sa.c b/Source/charon/sa/ike_sa.c index 12ae0cc24..3a4f831cb 100644 --- a/Source/charon/sa/ike_sa.c +++ b/Source/charon/sa/ike_sa.c @@ -295,7 +295,7 @@ static status_t process_message (private_ike_sa_t *this, message_t *message) if (is_request && (message_id == (this->message_id_in - 1))) { /* Message can be resent ! */ - this->logger->log(this->logger, CONTROL|MORE, "Resent request detected. Send stored reply."); + this->logger->log(this->logger, CONTROL|LEVEL1, "Resent request detected. Send stored reply."); return (this->resend_last_reply(this)); } @@ -305,7 +305,7 @@ static status_t process_message (private_ike_sa_t *this, message_t *message) /* In a request, the message has to be this->message_id_in (other case is already handled) */ if (message_id != this->message_id_in) { - this->logger->log(this->logger, ERROR | MORE, "Message request with message id %d received, but %d expected",message_id,this->message_id_in); + this->logger->log(this->logger, ERROR | LEVEL1, "Message request with message id %d received, but %d expected",message_id,this->message_id_in); return FAILED; } } @@ -314,7 +314,7 @@ static status_t process_message (private_ike_sa_t *this, message_t *message) /* In a reply, the message has to be this->message_id_out -1 cause it is the reply to the last sent message*/ if (message_id != (this->message_id_out - 1)) { - this->logger->log(this->logger, ERROR | MORE, "Message reply with message id %d received, but %d expected",message_id,this->message_id_in); + this->logger->log(this->logger, ERROR | LEVEL1, "Message reply with message id %d received, but %d expected",message_id,this->message_id_in); return FAILED; } } @@ -334,7 +334,7 @@ static void build_message(private_ike_sa_t *this, exchange_type_t type, bool req { message_t *new_message; - this->logger->log(this->logger, CONTROL|MOST, "Build empty message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Build empty message"); new_message = message_create(); new_message->set_source(new_message, this->me.host->clone(this->me.host)); new_message->set_destination(new_message, this->other.host->clone(this->other.host)); @@ -403,7 +403,7 @@ static void compute_secrets(private_ike_sa_t *this,chunk_t dh_shared_secret,chun /* second is responder */ memcpy(concatenated_nonces.ptr + initiator_nonce.len,responder_nonce.ptr,responder_nonce.len); - this->logger->log_chunk(this->logger, RAW | MOST, "Nonce data", &concatenated_nonces); + this->logger->log_chunk(this->logger, RAW | LEVEL2, "Nonce data", &concatenated_nonces); /* Status of set_key is not checked */ this->prf->set_key(this->prf,concatenated_nonces); @@ -424,13 +424,13 @@ static void compute_secrets(private_ike_sa_t *this,chunk_t dh_shared_secret,chun responder_spi = this->ike_sa_id->get_responder_spi(this->ike_sa_id); memcpy(prf_plus_seed.ptr + initiator_nonce.len + responder_nonce.len + 8,&responder_spi,8); - this->logger->log_chunk(this->logger, PRIVATE | MORE, "Keyseed", &skeyseed); - this->logger->log_chunk(this->logger, PRIVATE | MORE, "PRF+ Seed", &prf_plus_seed); + this->logger->log_chunk(this->logger, PRIVATE | LEVEL1, "Keyseed", &skeyseed); + this->logger->log_chunk(this->logger, PRIVATE | LEVEL1, "PRF+ Seed", &prf_plus_seed); - this->logger->log(this->logger, CONTROL | MOST, "Set new key of prf object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Set new key of prf object"); this->prf->set_key(this->prf,skeyseed); - this->logger->log(this->logger, CONTROL | MOST, "Create new prf+ object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Create new prf+ object"); prf_plus = prf_plus_create(this->prf, prf_plus_seed); allocator_free_chunk(&prf_plus_seed); @@ -470,7 +470,7 @@ static status_t resend_last_reply(private_ike_sa_t *this) { packet_t *packet; - this->logger->log(this->logger, CONTROL | MORE, "Going to retransmit last reply"); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to retransmit last reply"); packet = this->last_responded_message->get_packet(this->last_responded_message); charon->send_queue->add(charon->send_queue, packet); @@ -499,7 +499,7 @@ status_t retransmit_request (private_ike_sa_t *this, u_int32_t message_id) return NOT_FOUND; } - this->logger->log(this->logger, CONTROL | MORE, "Going to retransmit message with id %d",message_id); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to retransmit message with id %d",message_id); packet = this->last_requested_message->get_packet(this->last_requested_message); charon->send_queue->add(charon->send_queue, packet); @@ -619,11 +619,11 @@ static chunk_t get_key_pi (private_ike_sa_t *this) */ static status_t create_transforms_from_proposal (private_ike_sa_t *this,ike_proposal_t *proposal) { - this->logger->log(this->logger, CONTROL|MORE, "Going to create transform objects for proposal"); + this->logger->log(this->logger, CONTROL|LEVEL1, "Going to create transform objects for proposal"); - this->logger->log(this->logger, CONTROL|MORE, "Encryption algorithm: %s with keylength %d",mapping_find(encryption_algorithm_m,proposal->encryption_algorithm),proposal->encryption_algorithm_key_length); - this->logger->log(this->logger, CONTROL|MORE, "integrity algorithm: %s with keylength %d",mapping_find(integrity_algorithm_m,proposal->integrity_algorithm),proposal->integrity_algorithm_key_length); - this->logger->log(this->logger, CONTROL|MORE, "prf: %s with keylength %d",mapping_find(pseudo_random_function_m,proposal->pseudo_random_function),proposal->pseudo_random_function_key_length); + this->logger->log(this->logger, CONTROL|LEVEL1, "Encryption algorithm: %s with keylength %d",mapping_find(encryption_algorithm_m,proposal->encryption_algorithm),proposal->encryption_algorithm_key_length); + this->logger->log(this->logger, CONTROL|LEVEL1, "integrity algorithm: %s with keylength %d",mapping_find(integrity_algorithm_m,proposal->integrity_algorithm),proposal->integrity_algorithm_key_length); + this->logger->log(this->logger, CONTROL|LEVEL1, "prf: %s with keylength %d",mapping_find(pseudo_random_function_m,proposal->pseudo_random_function),proposal->pseudo_random_function_key_length); if (this->prf != NULL) { @@ -632,7 +632,7 @@ static status_t create_transforms_from_proposal (private_ike_sa_t *this,ike_prop this->prf = prf_create(proposal->pseudo_random_function); if (this->prf == NULL) { - this->logger->log(this->logger, ERROR|MORE, "prf not supported!"); + this->logger->log(this->logger, ERROR|LEVEL1, "prf not supported!"); return FAILED; } @@ -643,7 +643,7 @@ static status_t create_transforms_from_proposal (private_ike_sa_t *this,ike_prop this->crypter_initiator = crypter_create(proposal->encryption_algorithm,proposal->encryption_algorithm_key_length); if (this->crypter_initiator == NULL) { - this->logger->log(this->logger, ERROR|MORE, "encryption algorithm %s not supported!", + this->logger->log(this->logger, ERROR|LEVEL1, "encryption algorithm %s not supported!", mapping_find(encryption_algorithm_m,proposal->encryption_algorithm)); return FAILED; } @@ -662,7 +662,7 @@ static status_t create_transforms_from_proposal (private_ike_sa_t *this,ike_prop this->signer_initiator = signer_create(proposal->integrity_algorithm); if (this->signer_initiator == NULL) { - this->logger->log(this->logger, ERROR|MORE, "integrity algorithm not supported!"); + this->logger->log(this->logger, ERROR|LEVEL1, "integrity algorithm not supported!"); return FAILED; } @@ -733,7 +733,7 @@ static status_t send_request (private_ike_sa_t *this,message_t * message) } /* generate packet */ - this->logger->log(this->logger, CONTROL|MOST, "Generate packet from message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Generate packet from message"); status = message->generate(message, this->crypter_initiator,this->signer_initiator, &packet); if (status != SUCCESS) @@ -742,7 +742,7 @@ static status_t send_request (private_ike_sa_t *this,message_t * message) return FAILED; } - this->logger->log(this->logger, CONTROL|MOST, "Add packet to global send queue"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add packet to global send queue"); charon->send_queue->add(charon->send_queue, packet); if (this->last_requested_message != NULL) @@ -751,7 +751,7 @@ static status_t send_request (private_ike_sa_t *this,message_t * message) this->last_requested_message->destroy(this->last_requested_message); } - this->logger->log(this->logger, CONTROL|MOST, "replace last requested message with new one"); + this->logger->log(this->logger, CONTROL|LEVEL2, "replace last requested message with new one"); this->last_requested_message = message; retransmit_job = retransmit_request_job_create(this->message_id_out,this->ike_sa_id); @@ -760,17 +760,17 @@ static status_t send_request (private_ike_sa_t *this,message_t * message) if (status != SUCCESS) { - this->logger->log(this->logger, CONTROL|MOST, "No retransmit job for message created!"); + this->logger->log(this->logger, CONTROL|LEVEL2, "No retransmit job for message created!"); retransmit_job->destroy(retransmit_job); } else { - this->logger->log(this->logger, CONTROL|MOST, "Request will be retransmitted in %d ms.",timeout); + this->logger->log(this->logger, CONTROL|LEVEL2, "Request will be retransmitted in %d ms.",timeout); charon->event_queue->add_relative(charon->event_queue,(job_t *) retransmit_job,timeout); } /* message counter can now be increased */ - this->logger->log(this->logger, CONTROL|MOST, "Increase message counter for outgoing messages from %d",this->message_id_out); + this->logger->log(this->logger, CONTROL|LEVEL2, "Increase message counter for outgoing messages from %d",this->message_id_out); this->message_id_out++; return SUCCESS; } @@ -785,7 +785,7 @@ static status_t send_response (private_ike_sa_t *this,message_t * message) if (message->get_message_id(message) != this->message_id_in) { - this->logger->log(this->logger, CONTROL|MOST, "Message could not be sent cause id was not as expected"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Message could not be sent cause id was not as expected"); return FAILED; } @@ -796,7 +796,7 @@ static status_t send_response (private_ike_sa_t *this,message_t * message) return FAILED; } - this->logger->log(this->logger, CONTROL|MOST, "Add packet to global send queue"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add packet to global send queue"); charon->send_queue->add(charon->send_queue, packet); if (this->last_responded_message != NULL) @@ -805,11 +805,11 @@ static status_t send_response (private_ike_sa_t *this,message_t * message) this->last_responded_message->destroy(this->last_responded_message); } - this->logger->log(this->logger, CONTROL|MOST, "replace last responded message with new one"); + this->logger->log(this->logger, CONTROL|LEVEL2, "replace last responded message with new one"); this->last_responded_message = message; /* message counter can now be increased */ - this->logger->log(this->logger, CONTROL|MOST, "Increase message counter for incoming messages"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Increase message counter for incoming messages"); this->message_id_in++; return SUCCESS; @@ -849,7 +849,7 @@ static ike_sa_state_t get_state (private_ike_sa_t *this) */ static void reset_message_buffers (private_ike_sa_t *this) { - this->logger->log(this->logger, CONTROL|MOST, "Reset message counters and destroy stored messages"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Reset message counters and destroy stored messages"); /* destroy stored requested message */ if (this->last_requested_message != NULL) { @@ -873,7 +873,7 @@ static void create_delete_established_ike_sa_job (private_ike_sa_t *this,u_int32 { job_t *delete_job; - this->logger->log(this->logger, CONTROL | MORE, "Going to create job to delete established IKE_SA in %d ms", timeout); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to create job to delete established IKE_SA in %d ms", timeout); delete_job = (job_t *) delete_established_ike_sa_job_create(this->ike_sa_id); charon->event_queue->add_relative(charon->event_queue,delete_job, timeout); @@ -884,13 +884,13 @@ static void create_delete_established_ike_sa_job (private_ike_sa_t *this,u_int32 */ static void destroy (private_ike_sa_t *this) { - this->logger->log(this->logger, CONTROL|MOST, "Going to destroy IKE SA %llu:%llu, role %s", + this->logger->log(this->logger, CONTROL|LEVEL2, "Going to destroy IKE SA %llu:%llu, role %s", this->ike_sa_id->get_initiator_spi(this->ike_sa_id), this->ike_sa_id->get_responder_spi(this->ike_sa_id), this->ike_sa_id->is_initiator(this->ike_sa_id) ? "initiator" : "responder"); /* destroy child sa's */ - this->logger->log(this->logger, CONTROL | MOST, "Destroy all child_sa's"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy all child_sa's"); while (this->child_sas->get_count(this->child_sas) > 0) { void *child_sa; @@ -902,79 +902,79 @@ static void destroy (private_ike_sa_t *this) } this->child_sas->destroy(this->child_sas); - this->logger->log(this->logger, CONTROL | MOST, "Destroy secrets"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy secrets"); allocator_free(this->secrets.d_key.ptr); allocator_free(this->secrets.pi_key.ptr); allocator_free(this->secrets.pr_key.ptr); if (this->crypter_initiator != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy initiator crypter_t object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy initiator crypter_t object"); this->crypter_initiator->destroy(this->crypter_initiator); } if (this->crypter_responder != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy responder crypter_t object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy responder crypter_t object"); this->crypter_responder->destroy(this->crypter_responder); } if (this->signer_initiator != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy initiator signer_t object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy initiator signer_t object"); this->signer_initiator->destroy(this->signer_initiator); } if (this->signer_responder != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy responder signer_t object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy responder signer_t object"); this->signer_responder->destroy(this->signer_responder); } if (this->prf != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy prf_t object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy prf_t object"); this->prf->destroy(this->prf); } /* destroy ike_sa_id */ - this->logger->log(this->logger, CONTROL | MOST, "Destroy ike_sa_id object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy ike_sa_id object"); this->ike_sa_id->destroy(this->ike_sa_id); /* destroy stored requested message */ if (this->last_requested_message != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy last requested message"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy last requested message"); this->last_requested_message->destroy(this->last_requested_message); } /* destroy stored responded messages */ if (this->last_responded_message != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy last responded message"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy last responded message"); this->last_responded_message->destroy(this->last_responded_message); } /* destroy stored host_t objects */ if (this->me.host != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy my host_t object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy my host_t object"); this->me.host->destroy(this->me.host); } /* destroy stored host_t objects */ if (this->other.host != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy other host_t object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy other host_t object"); this->other.host->destroy(this->other.host); } this->randomizer->destroy(this->randomizer); - this->logger->log(this->logger, CONTROL | MOST, "Destroy current state object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy current state object"); this->current_state->destroy(this->current_state); - this->logger->log(this->logger, CONTROL | MOST, "Destroy logger of IKE_SA"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy logger of IKE_SA"); charon->logger_manager->destroy_logger(charon->logger_manager, this->logger); allocator_free(this); diff --git a/Source/charon/sa/ike_sa_manager.c b/Source/charon/sa/ike_sa_manager.c index 82a54dafb..78a467d8e 100644 --- a/Source/charon/sa/ike_sa_manager.c +++ b/Source/charon/sa/ike_sa_manager.c @@ -225,7 +225,7 @@ static status_t get_entry_by_id(private_ike_sa_manager_t *this, ike_sa_id_t *ike if ((current->ike_sa_id->get_initiator_spi(current->ike_sa_id) == ike_sa_id->get_initiator_spi(ike_sa_id)) && (ike_sa_id->is_initiator(ike_sa_id) == current->ike_sa_id->is_initiator(current->ike_sa_id))) { - this->logger->log(this->logger,CONTROL | MOST,"Found entry by initiator spi %d",ike_sa_id->get_initiator_spi(ike_sa_id)); + this->logger->log(this->logger,CONTROL | LEVEL2,"Found entry by initiator spi %d",ike_sa_id->get_initiator_spi(ike_sa_id)); *entry = current; status = SUCCESS; break; @@ -236,7 +236,7 @@ static status_t get_entry_by_id(private_ike_sa_manager_t *this, ike_sa_id_t *ike if ((current->ike_sa_id->get_initiator_spi(current->ike_sa_id) == ike_sa_id->get_initiator_spi(ike_sa_id)) && (ike_sa_id->is_initiator(ike_sa_id) == current->ike_sa_id->is_initiator(current->ike_sa_id))) { - this->logger->log(this->logger,CONTROL | MOST,"Found entry by initiator spi %d",ike_sa_id->get_initiator_spi(ike_sa_id)); + this->logger->log(this->logger,CONTROL | LEVEL2,"Found entry by initiator spi %d",ike_sa_id->get_initiator_spi(ike_sa_id)); *entry = current; status = SUCCESS; break; @@ -244,7 +244,7 @@ static status_t get_entry_by_id(private_ike_sa_manager_t *this, ike_sa_id_t *ike } if (current->ike_sa_id->equals(current->ike_sa_id, ike_sa_id)) { - this->logger->log(this->logger,CONTROL | MOST,"Found entry by full ID"); + this->logger->log(this->logger,CONTROL | LEVEL2,"Found entry by full ID"); *entry = current; status = SUCCESS; break; @@ -276,7 +276,7 @@ static status_t get_entry_by_sa(private_ike_sa_manager_t *this, ike_sa_t *ike_sa /* only pointers are compared */ if (current->ike_sa == ike_sa) { - this->logger->log(this->logger,CONTROL | MOST,"Found entry by pointer"); + this->logger->log(this->logger,CONTROL | LEVEL2,"Found entry by pointer"); *entry = current; status = SUCCESS; break; @@ -306,7 +306,7 @@ static status_t delete_entry(private_ike_sa_manager_t *this, ike_sa_entry_t *ent iterator->current(iterator, (void**)¤t); if (current == entry) { - this->logger->log(this->logger,CONTROL | MOST,"Found entry by pointer. Going to delete it."); + this->logger->log(this->logger,CONTROL | LEVEL2,"Found entry by pointer. Going to delete it."); iterator->remove(iterator); entry->destroy(entry); status = SUCCESS; @@ -355,7 +355,7 @@ static void create_and_checkout(private_ike_sa_manager_t *this,ike_sa_t **ike_sa this->ike_sa_list->insert_last(this->ike_sa_list, new_ike_sa_entry); /* check ike_sa out */ - this->logger->log(this->logger,CONTROL | MORE ,"New IKE_SA created and added to list of known IKE_SA's"); + this->logger->log(this->logger,CONTROL | LEVEL1 ,"New IKE_SA created and added to list of known IKE_SA's"); new_ike_sa_entry->checked_out = TRUE; *ike_sa = new_ike_sa_entry->ike_sa; @@ -392,7 +392,7 @@ static status_t checkout(private_ike_sa_manager_t *this, ike_sa_id_t *ike_sa_id, /* can we give this ike_sa out to new requesters?*/ if (entry->driveout_new_threads) { - this->logger->log(this->logger,CONTROL|MORE,"Drive out new thread for existing IKE_SA"); + this->logger->log(this->logger,CONTROL|LEVEL1,"Drive out new thread for existing IKE_SA"); /* no we can't */ retval = NOT_FOUND; } @@ -415,12 +415,12 @@ static status_t checkout(private_ike_sa_manager_t *this, ike_sa_id_t *ike_sa_id, { /* we must signal here, others are interested that we leave */ pthread_cond_signal(&(entry->condvar)); - this->logger->log(this->logger,CONTROL|MORE,"Drive out waiting thread for existing IKE_SA"); + this->logger->log(this->logger,CONTROL|LEVEL1,"Drive out waiting thread for existing IKE_SA"); retval = NOT_FOUND; } else { - this->logger->log(this->logger,CONTROL|MOST,"IKE SA successfully checked out"); + this->logger->log(this->logger,CONTROL|LEVEL2,"IKE SA successfully checked out"); /* ok, this IKE_SA is finally ours */ entry->checked_out = TRUE; *ike_sa = entry->ike_sa; @@ -431,7 +431,7 @@ static status_t checkout(private_ike_sa_manager_t *this, ike_sa_id_t *ike_sa_id, } else { - this->logger->log(this->logger,ERROR | MORE,"IKE SA not stored in known IKE_SA list"); + this->logger->log(this->logger,ERROR | LEVEL1,"IKE SA not stored in known IKE_SA list"); /* looks like there is no such IKE_SA, better luck next time... */ /* DON'T use return, we must unlock the mutex! */ retval = NOT_FOUND; @@ -462,7 +462,7 @@ static status_t checkout(private_ike_sa_manager_t *this, ike_sa_id_t *ike_sa_id, this->ike_sa_list->insert_last(this->ike_sa_list, new_ike_sa_entry); /* check ike_sa out */ - this->logger->log(this->logger,CONTROL | MORE ,"IKE_SA added to list of known IKE_SA's"); + this->logger->log(this->logger,CONTROL | LEVEL1 ,"IKE_SA added to list of known IKE_SA's"); new_ike_sa_entry->checked_out = TRUE; *ike_sa = new_ike_sa_entry->ike_sa; @@ -471,7 +471,7 @@ static status_t checkout(private_ike_sa_manager_t *this, ike_sa_id_t *ike_sa_id, else { /* responder set, initiator not: here is something seriously wrong! */ - this->logger->log(this->logger,ERROR | MORE, "Invalid IKE_SA SPI's"); + this->logger->log(this->logger,ERROR | LEVEL1, "Invalid IKE_SA SPI's"); /* DON'T use return, we must unlock the mutex! */ retval = INVALID_ARG; } @@ -503,14 +503,14 @@ static status_t checkin(private_ike_sa_manager_t *this, ike_sa_t *ike_sa) entry->ike_sa_id->replace_values(entry->ike_sa_id, ike_sa->get_id(ike_sa)); /* signal waiting threads */ entry->checked_out = FALSE; - this->logger->log(this->logger,CONTROL | MORE,"Checkin of IKE_SA successful."); + this->logger->log(this->logger,CONTROL | LEVEL1,"Checkin of IKE_SA successful."); pthread_cond_signal(&(entry->condvar)); retval = SUCCESS; } else { this->logger->log(this->logger,ERROR,"Fatal Error: Tried to checkin nonexisting IKE_SA"); - /* this SA is no more, this REALLY should not happen */ + /* this SA is no more, this RELEVEL3Y should not happen */ retval = NOT_FOUND; } pthread_mutex_unlock(&(this->mutex)); @@ -550,7 +550,7 @@ static status_t checkin_and_delete(private_ike_sa_manager_t *this, ike_sa_t *ike } /* ok, we are alone now, no threads waiting in the entry's condvar */ this->delete_entry(this, entry); - this->logger->log(this->logger,CONTROL | MORE,"Checkin and delete of IKE_SA successful"); + this->logger->log(this->logger,CONTROL | LEVEL1,"Checkin and delete of IKE_SA successful"); retval = SUCCESS; } else @@ -593,7 +593,7 @@ static status_t delete(private_ike_sa_manager_t *this, ike_sa_id_t *ike_sa_id) } /* ok, we are alone now, no threads waiting in the entry's condvar */ this->delete_entry(this, entry); - this->logger->log(this->logger,CONTROL | MORE,"Delete of IKE_SA successful"); + this->logger->log(this->logger,CONTROL | LEVEL1,"Delete of IKE_SA successful"); retval = SUCCESS; } else @@ -618,12 +618,12 @@ static void destroy(private_ike_sa_manager_t *this) pthread_mutex_lock(&(this->mutex)); - this->logger->log(this->logger,CONTROL | MORE,"Going to destroy IKE_SA manager and all managed IKE_SA's"); + this->logger->log(this->logger,CONTROL | LEVEL1,"Going to destroy IKE_SA manager and all managed IKE_SA's"); /* Step 1: drive out all waiting threads */ iterator = list->create_iterator(list, TRUE); - this->logger->log(this->logger,CONTROL | MOST,"Set driveout flags for all stored IKE_SA's"); + this->logger->log(this->logger,CONTROL | LEVEL2,"Set driveout flags for all stored IKE_SA's"); while (iterator->has_next(iterator)) { iterator->current(iterator, (void**)&entry); @@ -632,7 +632,7 @@ static void destroy(private_ike_sa_manager_t *this) entry->driveout_waiting_threads = TRUE; } - this->logger->log(this->logger,CONTROL | MOST,"Wait for all threads to leave IKE_SA's"); + this->logger->log(this->logger,CONTROL | LEVEL2,"Wait for all threads to leave IKE_SA's"); /* Step 2: wait until all are gone */ iterator->reset(iterator); while (iterator->has_next(iterator)) @@ -646,7 +646,7 @@ static void destroy(private_ike_sa_manager_t *this) pthread_cond_wait(&(entry->condvar), &(this->mutex)); } } - this->logger->log(this->logger,CONTROL | MOST,"Delete all IKE_SA's"); + this->logger->log(this->logger,CONTROL | LEVEL2,"Delete all IKE_SA's"); /* Step 3: delete all entries */ iterator->destroy(iterator); @@ -656,7 +656,7 @@ static void destroy(private_ike_sa_manager_t *this) this->delete_entry(this, entry); } list->destroy(list); - this->logger->log(this->logger,CONTROL | MOST,"IKE_SA's deleted"); + this->logger->log(this->logger,CONTROL | LEVEL2,"IKE_SA's deleted"); pthread_mutex_unlock(&(this->mutex)); /* destroy logger at end */ diff --git a/Source/charon/sa/states/ike_auth_requested.c b/Source/charon/sa/states/ike_auth_requested.c index cbd5555eb..8b799d674 100644 --- a/Source/charon/sa/states/ike_auth_requested.c +++ b/Source/charon/sa/states/ike_auth_requested.c @@ -143,14 +143,14 @@ static status_t process_message(private_ike_auth_requested_t *this, message_t *i if (ike_auth_reply->get_exchange_type(ike_auth_reply) != IKE_AUTH) { - this->logger->log(this->logger, ERROR | MORE, "Message of type %s not supported in state ike_auth_requested", + this->logger->log(this->logger, ERROR | LEVEL1, "Message of type %s not supported in state ike_auth_requested", mapping_find(exchange_type_m,ike_auth_reply->get_exchange_type(ike_auth_reply))); return FAILED; } if (ike_auth_reply->get_request(ike_auth_reply)) { - this->logger->log(this->logger, ERROR | MORE, "Only responses of type IKE_AUTH supported in state ike_auth_requested"); + this->logger->log(this->logger, ERROR | LEVEL1, "Only responses of type IKE_AUTH supported in state ike_auth_requested"); return FAILED; } @@ -162,7 +162,7 @@ static status_t process_message(private_ike_auth_requested_t *this, message_t *i status = ike_auth_reply->parse_body(ike_auth_reply, crypter, signer); if (status != SUCCESS) { - this->logger->log(this->logger, ERROR | MORE, "Could not parse body of request message"); + this->logger->log(this->logger, ERROR | LEVEL1, "Could not parse body of request message"); return status; } @@ -212,13 +212,13 @@ static status_t process_message(private_ike_auth_requested_t *this, message_t *i notify_payload_t *notify_payload = (notify_payload_t *) payload; - this->logger->log(this->logger, CONTROL|MORE, "Process notify type %s for protocol %s", + this->logger->log(this->logger, CONTROL|LEVEL1, "Process notify type %s for protocol %s", mapping_find(notify_message_type_m, notify_payload->get_notify_message_type(notify_payload)), mapping_find(protocol_id_m, notify_payload->get_protocol_id(notify_payload))); if (notify_payload->get_protocol_id(notify_payload) != IKE) { - this->logger->log(this->logger, ERROR | MORE, "Notify reply not for IKE protocol"); + this->logger->log(this->logger, ERROR | LEVEL1, "Notify reply not for IKE protocol"); payloads->destroy(payloads); return DELETE_ME; } @@ -313,7 +313,7 @@ static status_t process_message(private_ike_auth_requested_t *this, message_t *i } this->ike_sa->set_last_replied_message_id(this->ike_sa,ike_auth_reply->get_message_id(ike_auth_reply)); - this->logger->log(this->logger, CONTROL | MORE, "IKE_AUTH response successfully handled. IKE_SA established."); + this->logger->log(this->logger, CONTROL | LEVEL1, "IKE_AUTH response successfully handled. IKE_SA established."); /* create new state */ this->ike_sa->set_new_state(this->ike_sa, (state_t*)ike_sa_established_create(this->ike_sa)); @@ -415,7 +415,7 @@ static status_t process_auth_payload(private_ike_auth_requested_t *this, auth_pa return DELETE_ME; } - this->logger->log(this->logger, CONTROL | MORE, "AUTH data verified"); + this->logger->log(this->logger, CONTROL | LEVEL1, "AUTH data verified"); return SUCCESS; } diff --git a/Source/charon/sa/states/ike_sa_init_requested.c b/Source/charon/sa/states/ike_sa_init_requested.c index 9e65e9664..f86170ac8 100644 --- a/Source/charon/sa/states/ike_sa_init_requested.c +++ b/Source/charon/sa/states/ike_sa_init_requested.c @@ -219,14 +219,14 @@ static status_t process_message(private_ike_sa_init_requested_t *this, message_t if (ike_sa_init_reply->get_exchange_type(ike_sa_init_reply) != IKE_SA_INIT) { - this->logger->log(this->logger, ERROR | MORE, "Message of type %s not supported in state ike_sa_init_requested", + this->logger->log(this->logger, ERROR | LEVEL1, "Message of type %s not supported in state ike_sa_init_requested", mapping_find(exchange_type_m,ike_sa_init_reply->get_exchange_type(ike_sa_init_reply))); return FAILED; } if (ike_sa_init_reply->get_request(ike_sa_init_reply)) { - this->logger->log(this->logger, ERROR | MORE, "Only responses of type IKE_SA_INIT supported in state ike_sa_init_requested"); + this->logger->log(this->logger, ERROR | LEVEL1, "Only responses of type IKE_SA_INIT supported in state ike_sa_init_requested"); return FAILED; } @@ -234,7 +234,7 @@ static status_t process_message(private_ike_sa_init_requested_t *this, message_t status = ike_sa_init_reply->parse_body(ike_sa_init_reply, NULL, NULL); if (status != SUCCESS) { - this->logger->log(this->logger, ERROR | MORE, "Parsing of body returned error: %s",mapping_find(status_m,status)); + this->logger->log(this->logger, ERROR | LEVEL1, "Parsing of body returned error: %s",mapping_find(status_m,status)); return status; } @@ -243,7 +243,7 @@ static status_t process_message(private_ike_sa_init_requested_t *this, message_t if (responder_spi == 0) { - this->logger->log(this->logger, ERROR | MORE, "Responder SPI still zero"); + this->logger->log(this->logger, ERROR | LEVEL1, "Responder SPI still zero"); return FAILED; } ike_sa_id = this->ike_sa->public.get_id(&(this->ike_sa->public)); @@ -259,7 +259,7 @@ static status_t process_message(private_ike_sa_init_requested_t *this, message_t payload_t *payload; payloads->current(payloads, (void**)&payload); - this->logger->log(this->logger, CONTROL|MORE, "Processing payload %s", mapping_find(payload_type_m, payload->get_type(payload))); + this->logger->log(this->logger, CONTROL|LEVEL1, "Processing payload %s", mapping_find(payload_type_m, payload->get_type(payload))); switch (payload->get_type(payload)) { case NOTIFY: @@ -267,13 +267,13 @@ static status_t process_message(private_ike_sa_init_requested_t *this, message_t notify_payload_t *notify_payload = (notify_payload_t *) payload; - this->logger->log(this->logger, CONTROL|MORE, "Process notify type %s for protocol %s", + this->logger->log(this->logger, CONTROL|LEVEL1, "Process notify type %s for protocol %s", mapping_find(notify_message_type_m, notify_payload->get_notify_message_type(notify_payload)), mapping_find(protocol_id_m, notify_payload->get_protocol_id(notify_payload))); if (notify_payload->get_protocol_id(notify_payload) != IKE) { - this->logger->log(this->logger, ERROR | MORE, "Notify reply not for IKE protocol."); + this->logger->log(this->logger, ERROR | LEVEL1, "Notify reply not for IKE protocol."); payloads->destroy(payloads); return FAILED; } @@ -299,7 +299,7 @@ static status_t process_message(private_ike_sa_init_requested_t *this, message_t this->logger->log(this->logger, ERROR, "Selected DH group is not the one in the proposal selected by the responder!"); payloads->destroy(payloads); /* Going to change state back to initiator_init_t */ - this->logger->log(this->logger, CONTROL|MOST, "Create next state object"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Create next state object"); initiator_init_state = initiator_init_create(this->ike_sa); /* buffer of sent and received messages has to get reseted */ @@ -309,10 +309,10 @@ static status_t process_message(private_ike_sa_init_requested_t *this, message_t this->ike_sa->set_new_state(this->ike_sa,(state_t *) initiator_init_state); /* state has NOW changed :-) */ - this->logger->log(this->logger, CONTROL|MORE, "Changed state of IKE_SA from %s to %s", mapping_find(ike_sa_state_m,INITIATOR_INIT),mapping_find(ike_sa_state_m,IKE_SA_INIT_REQUESTED) ); + this->logger->log(this->logger, CONTROL|LEVEL1, "Changed state of IKE_SA from %s to %s", mapping_find(ike_sa_state_m,INITIATOR_INIT),mapping_find(ike_sa_state_m,IKE_SA_INIT_REQUESTED) ); - this->logger->log(this->logger, CONTROL|MOST, "Destroy old sate object"); - this->logger->log(this->logger, CONTROL|MOST, "Going to retry initialization of connection"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Destroy old sate object"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Going to retry initialization of connection"); new_dh_group_priority = this->dh_group_priority + 1; this->public.state_interface.destroy(&(this->public.state_interface)); @@ -388,7 +388,7 @@ static status_t process_message(private_ike_sa_init_requested_t *this, message_t return status; } - this->logger->log(this->logger, CONTROL|MOST, "Going to build empty message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Going to build empty message"); this->ike_sa->build_message(this->ike_sa, IKE_AUTH, TRUE, &request); /* build ID payload */ @@ -445,16 +445,16 @@ static status_t process_message(private_ike_sa_init_requested_t *this, message_t ike_sa_init_reply_data = ike_sa_init_reply->get_packet_data(ike_sa_init_reply); /* state can now be changed */ - this->logger->log(this->logger, CONTROL|MOST, "Create next state object"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Create next state object"); next_state = ike_auth_requested_create(this->ike_sa,this->sent_nonce,this->received_nonce,ike_sa_init_reply_data); /* state can now be changed */ this->ike_sa->set_new_state(this->ike_sa,(state_t *) next_state); /* state has NOW changed :-) */ - this->logger->log(this->logger, CONTROL|MORE, "Changed state of IKE_SA from %s to %s", mapping_find(ike_sa_state_m,IKE_SA_INIT_REQUESTED),mapping_find(ike_sa_state_m,IKE_AUTH_REQUESTED) ); + this->logger->log(this->logger, CONTROL|LEVEL1, "Changed state of IKE_SA from %s to %s", mapping_find(ike_sa_state_m,IKE_SA_INIT_REQUESTED),mapping_find(ike_sa_state_m,IKE_AUTH_REQUESTED) ); - this->logger->log(this->logger, CONTROL|MOST, "Destroy old sate object"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Destroy old sate object"); this->destroy_after_state_change(this); return SUCCESS; } @@ -488,31 +488,31 @@ status_t process_sa_payload (private_ike_sa_init_requested_t *this, sa_payload_t status = sa_payload->get_ike_proposals (sa_payload, &ike_proposals,&proposal_count); if (status != SUCCESS) { - this->logger->log(this->logger, ERROR | MORE, "SA payload does not contain IKE proposals"); + this->logger->log(this->logger, ERROR | LEVEL1, "SA payload does not contain IKE proposals"); return DELETE_ME; } /* the peer has to select only one proposal */ if (proposal_count != 1) { - this->logger->log(this->logger, ERROR | MORE, "More then 1 proposal (%d) selected!",proposal_count); + this->logger->log(this->logger, ERROR | LEVEL1, "More then 1 proposal (%d) selected!",proposal_count); allocator_free(ike_proposals); return DELETE_ME; } /* now let the configuration-manager check the selected proposals*/ - this->logger->log(this->logger, CONTROL | MOST, "Check selected proposal"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Check selected proposal"); status = init_config->select_proposal (init_config,ike_proposals,1,&selected_proposal); allocator_free(ike_proposals); if (status != SUCCESS) { - this->logger->log(this->logger, ERROR | MORE, "Selected proposal not a suggested one! Peer is trying to trick me!"); + this->logger->log(this->logger, ERROR | LEVEL1, "Selected proposal not a suggested one! Peer is trying to trick me!"); return DELETE_ME; } status = this->ike_sa->create_transforms_from_proposal(this->ike_sa,&selected_proposal); if (status != SUCCESS) { - this->logger->log(this->logger, ERROR | MORE, "Transform objects could not be created from selected proposal"); + this->logger->log(this->logger, ERROR | LEVEL1, "Transform objects could not be created from selected proposal"); return DELETE_ME; } return SUCCESS; @@ -531,11 +531,11 @@ status_t process_ke_payload (private_ike_sa_init_requested_t *this, ke_payload_t /* store shared secret * status of dh object does not have to get checked cause other key is set */ - this->logger->log(this->logger, CONTROL | MOST, "Retrieve shared secret and store it"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Retrieve shared secret and store it"); status = this->diffie_hellman->get_shared_secret(this->diffie_hellman, &shared_secret); this->logger->log_chunk(this->logger, PRIVATE, "Shared secret", &shared_secret); - this->logger->log(this->logger, CONTROL | MOST, "Going to derive all secrets from shared secret"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Going to derive all secrets from shared secret"); this->ike_sa->compute_secrets(this->ike_sa,shared_secret,this->sent_nonce, this->received_nonce); allocator_free_chunk(&(shared_secret)); @@ -557,7 +557,7 @@ static status_t build_id_payload (private_ike_sa_init_requested_t *this,id_paylo identification = sa_config->get_my_id(sa_config); new_id_payload = id_payload_create_from_identification(TRUE,identification); - this->logger->log(this->logger, CONTROL|MOST, "Add ID payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add ID payload to message"); request->add_payload(request,(payload_t *) new_id_payload); *id_payload = new_id_payload; @@ -583,7 +583,7 @@ static status_t build_auth_payload (private_ike_sa_init_requested_t *this, id_pa return DELETE_ME; } - this->logger->log(this->logger, CONTROL|MOST, "Add AUTH payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add AUTH payload to message"); request->add_payload(request,(payload_t *) auth_payload); return SUCCESS; @@ -609,7 +609,7 @@ static status_t build_sa_payload (private_ike_sa_init_requested_t *this, message sa_payload = sa_payload_create_from_child_proposals(proposals, proposal_count); allocator_free(proposals); - this->logger->log(this->logger, CONTROL|MOST, "Add SA payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add SA payload to message"); request->add_payload(request,(payload_t *) sa_payload); return SUCCESS; @@ -637,7 +637,7 @@ static status_t build_tsi_payload (private_ike_sa_init_requested_t *this, messag } allocator_free(traffic_selectors); - this->logger->log(this->logger, CONTROL|MOST, "Add TSi payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add TSi payload to message"); request->add_payload(request,(payload_t *) ts_payload); return SUCCESS; @@ -665,7 +665,7 @@ static status_t build_tsr_payload (private_ike_sa_init_requested_t *this, messag } allocator_free(traffic_selectors); - this->logger->log(this->logger, CONTROL|MOST, "Add TSr payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add TSr payload to message"); request->add_payload(request,(payload_t *) ts_payload); return SUCCESS; @@ -685,13 +685,13 @@ static ike_sa_state_t get_state(private_ike_sa_init_requested_t *this) */ static void destroy_after_state_change (private_ike_sa_init_requested_t *this) { - this->logger->log(this->logger, CONTROL | MORE, "Going to destroy state of type ike_sa_init_requested_t after state change."); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to destroy state of type ike_sa_init_requested_t after state change."); - this->logger->log(this->logger, CONTROL | MOST, "Destroy diffie hellman object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy diffie hellman object"); this->diffie_hellman->destroy(this->diffie_hellman); - this->logger->log(this->logger, CONTROL | MOST, "Destroy ike_sa_init_request_data"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy ike_sa_init_request_data"); allocator_free_chunk(&(this->ike_sa_init_request_data)); - this->logger->log(this->logger, CONTROL | MOST, "Destroy object itself"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy object itself"); allocator_free(this); } @@ -700,17 +700,17 @@ static void destroy_after_state_change (private_ike_sa_init_requested_t *this) */ static void destroy(private_ike_sa_init_requested_t *this) { - this->logger->log(this->logger, CONTROL | MORE, "Going to destroy state of type ike_sa_init_requested_t"); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to destroy state of type ike_sa_init_requested_t"); - this->logger->log(this->logger, CONTROL | MOST, "Destroy diffie hellman object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy diffie hellman object"); this->diffie_hellman->destroy(this->diffie_hellman); - this->logger->log(this->logger, CONTROL | MOST, "Destroy sent nonce"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy sent nonce"); allocator_free(this->sent_nonce.ptr); - this->logger->log(this->logger, CONTROL | MOST, "Destroy received nonce"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy received nonce"); allocator_free(this->received_nonce.ptr); - this->logger->log(this->logger, CONTROL | MOST, "Destroy ike_sa_init_request_data"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy ike_sa_init_request_data"); allocator_free_chunk(&(this->ike_sa_init_request_data)); - this->logger->log(this->logger, CONTROL | MOST, "Destroy object itself"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy object itself"); allocator_free(this); } diff --git a/Source/charon/sa/states/ike_sa_init_responded.c b/Source/charon/sa/states/ike_sa_init_responded.c index 109a1f10a..8c1ca880d 100644 --- a/Source/charon/sa/states/ike_sa_init_responded.c +++ b/Source/charon/sa/states/ike_sa_init_responded.c @@ -157,14 +157,14 @@ static status_t process_message(private_ike_sa_init_responded_t *this, message_t if (request->get_exchange_type(request) != IKE_AUTH) { - this->logger->log(this->logger, ERROR | MORE, "Message of type %s not supported in state ike_sa_init_responded", + this->logger->log(this->logger, ERROR | LEVEL1, "Message of type %s not supported in state ike_sa_init_responded", mapping_find(exchange_type_m,request->get_exchange_type(request))); return FAILED; } if (!request->get_request(request)) { - this->logger->log(this->logger, ERROR | MORE, "Only requests of type IKE_AUTH supported in state ike_sa_init_responded"); + this->logger->log(this->logger, ERROR | LEVEL1, "Only requests of type IKE_AUTH supported in state ike_sa_init_responded"); return FAILED; } @@ -177,7 +177,7 @@ static status_t process_message(private_ike_sa_init_responded_t *this, message_t { if (status == NOT_SUPPORTED) { - this->logger->log(this->logger, ERROR | MORE, "Message contains unsupported payload with critical flag set"); + this->logger->log(this->logger, ERROR | LEVEL1, "Message contains unsupported payload with critical flag set"); /** * TODO send unsupported type. */ @@ -186,7 +186,7 @@ static status_t process_message(private_ike_sa_init_responded_t *this, message_t } else { - this->logger->log(this->logger, ERROR | MORE, "Could not parse body of request message"); + this->logger->log(this->logger, ERROR | LEVEL1, "Could not parse body of request message"); } return status; } @@ -223,13 +223,13 @@ static status_t process_message(private_ike_sa_init_responded_t *this, message_t case CERTIFICATE: { /* TODO handle cert payloads */ - this->logger->log(this->logger, ERROR | MORE, "Payload type CERTIFICATE currently not supported and so not handled"); + this->logger->log(this->logger, ERROR | LEVEL1, "Payload type CERTIFICATE currently not supported and so not handled"); break; } case CERTIFICATE_REQUEST: { /* TODO handle certrequest payloads */ - this->logger->log(this->logger, ERROR | MORE, "Payload type CERTIFICATE_REQUEST currently not supported and so not handled"); + this->logger->log(this->logger, ERROR | LEVEL1, "Payload type CERTIFICATE_REQUEST currently not supported and so not handled"); break; } case TRAFFIC_SELECTOR_INITIATOR: @@ -246,13 +246,13 @@ static status_t process_message(private_ike_sa_init_responded_t *this, message_t { notify_payload_t *notify_payload = (notify_payload_t *) payload; - this->logger->log(this->logger, CONTROL|MORE, "Process notify type %s for protocol %s", + this->logger->log(this->logger, CONTROL|LEVEL1, "Process notify type %s for protocol %s", mapping_find(notify_message_type_m, notify_payload->get_notify_message_type(notify_payload)), mapping_find(protocol_id_m, notify_payload->get_protocol_id(notify_payload))); if (notify_payload->get_protocol_id(notify_payload) != IKE) { - this->logger->log(this->logger, ERROR | MORE, "Notify not for IKE protocol."); + this->logger->log(this->logger, ERROR | LEVEL1, "Notify not for IKE protocol."); payloads->destroy(payloads); return DELETE_ME; } @@ -268,7 +268,7 @@ static status_t process_message(private_ike_sa_init_responded_t *this, message_t */ default: { - this->logger->log(this->logger, CONTROL|MORE, "Handling of notify type %s not implemented", + this->logger->log(this->logger, CONTROL|LEVEL1, "Handling of notify type %s not implemented", notify_payload->get_notify_message_type(notify_payload)); } } @@ -326,7 +326,7 @@ static status_t process_message(private_ike_sa_init_responded_t *this, message_t return status; } - this->logger->log(this->logger, CONTROL | MORE, "IKE_AUTH request successfully handled. Sending reply."); + this->logger->log(this->logger, CONTROL | LEVEL1, "IKE_AUTH request successfully handled. Sending reply."); status = this->ike_sa->send_response(this->ike_sa, response); /* message can now be sent (must not be destroyed) */ @@ -459,7 +459,7 @@ static status_t build_auth_payload(private_ike_sa_init_responded_t *this, auth_p /* * Send notify message of type AUTHENTICATION_FAILED */ - this->logger->log(this->logger, CONTROL | MORE, "Send notify message of type AUTHENTICATION_FAILED"); + this->logger->log(this->logger, CONTROL | LEVEL1, "Send notify message of type AUTHENTICATION_FAILED"); this->send_notify_reply (this,AUTHENTICATION_FAILED,CHUNK_INITIALIZER); return DELETE_ME; } @@ -535,31 +535,33 @@ static void send_notify_reply (private_ike_sa_init_responded_t *this,notify_mess packet_t *packet; status_t status; - this->logger->log(this->logger, CONTROL|MOST, "Going to build message with notify payload"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Going to build message with notify payload"); /* set up the reply */ this->ike_sa->build_message(this->ike_sa, IKE_AUTH, FALSE, &response); payload = notify_payload_create_from_protocol_and_type(IKE,type); if ((data.ptr != NULL) && (data.len > 0)) { - this->logger->log(this->logger, CONTROL|MOST, "Add Data to notify payload"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add Data to notify payload"); payload->set_notification_data(payload,data); } - this->logger->log(this->logger, CONTROL|MOST, "Add Notify payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add Notify payload to message"); response->add_payload(response,(payload_t *) payload); /* generate packet */ - this->logger->log(this->logger, CONTROL|MOST, "Gnerate packet from message"); - status = response->generate(response, NULL, NULL, &packet); + this->logger->log(this->logger, CONTROL|LEVEL2, "Gnerate packet from message"); + status = response->generate(response, this->ike_sa->get_crypter_responder(this->ike_sa), + this->ike_sa->get_signer_responder(this->ike_sa), &packet); if (status != SUCCESS) { this->logger->log(this->logger, ERROR, "Could not generate packet from message"); + response->destroy(response); return; } - this->logger->log(this->logger, CONTROL|MOST, "Add packet to global send queue"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add packet to global send queue"); charon->send_queue->add(charon->send_queue, packet); - this->logger->log(this->logger, CONTROL|MOST, "Destroy message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Destroy message"); response->destroy(response); } @@ -576,15 +578,15 @@ static ike_sa_state_t get_state(private_ike_sa_init_responded_t *this) */ static void destroy(private_ike_sa_init_responded_t *this) { - this->logger->log(this->logger, CONTROL | MORE, "Going to destroy ike_sa_init_responded_t state object"); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to destroy ike_sa_init_responded_t state object"); - this->logger->log(this->logger, CONTROL | MOST, "Destroy received nonce"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy received nonce"); allocator_free_chunk(&(this->received_nonce)); - this->logger->log(this->logger, CONTROL | MOST, "Destroy sent nonce"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy sent nonce"); allocator_free_chunk(&(this->sent_nonce)); - this->logger->log(this->logger, CONTROL | MOST, "Destroy IKE_SA_INIT response octets"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy IKE_SA_INIT response octets"); allocator_free_chunk(&(this->ike_sa_init_response_data)); - this->logger->log(this->logger, CONTROL | MOST, "Destroy IKE_SA_INIT request octets"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy IKE_SA_INIT request octets"); allocator_free_chunk(&(this->ike_sa_init_request_data)); allocator_free(this); diff --git a/Source/charon/sa/states/initiator_init.c b/Source/charon/sa/states/initiator_init.c index c2a509b5d..ae23df9f3 100644 --- a/Source/charon/sa/states/initiator_init.c +++ b/Source/charon/sa/states/initiator_init.c @@ -131,7 +131,7 @@ static status_t initiate_connection (private_initiator_init_t *this, char *name) status = charon->configuration_manager->get_init_config_for_name(charon->configuration_manager,name,&init_config); if (status != SUCCESS) { - this->logger->log(this->logger, ERROR | MORE, "Could not retrieve INIT configuration informations for %s",name); + this->logger->log(this->logger, ERROR | LEVEL1, "Could not retrieve INIT configuration informations for %s",name); return DELETE_ME; } @@ -141,7 +141,7 @@ static status_t initiate_connection (private_initiator_init_t *this, char *name) if (status != SUCCESS) { - this->logger->log(this->logger, ERROR | MORE, "Could not retrieve SA configuration informations for %s",name); + this->logger->log(this->logger, ERROR | LEVEL1, "Could not retrieve SA configuration informations for %s",name); return DELETE_ME; } @@ -154,7 +154,7 @@ static status_t initiate_connection (private_initiator_init_t *this, char *name) this->dh_group_number = init_config->get_dh_group_number(init_config,this->dh_group_priority); if (this->dh_group_number == MODP_UNDEFINED) { - this->logger->log(this->logger, ERROR | MORE, "Diffie hellman group could not be retrieved with priority %d", this->dh_group_priority); + this->logger->log(this->logger, ERROR | LEVEL1, "Diffie hellman group could not be retrieved with priority %d", this->dh_group_priority); return DELETE_ME; } @@ -185,14 +185,14 @@ status_t retry_initiate_connection (private_initiator_init_t *this, int dh_group this->dh_group_number = init_config->get_dh_group_number(init_config,dh_group_priority); if (this->dh_group_number == MODP_UNDEFINED) { - this->logger->log(this->logger, ERROR | MORE, "Diffie hellman group could not be retrieved with priority %d", dh_group_priority); + this->logger->log(this->logger, ERROR | LEVEL1, "Diffie hellman group could not be retrieved with priority %d", dh_group_priority); return DELETE_ME; } this->diffie_hellman = diffie_hellman_create(this->dh_group_number); /* going to build message */ - this->logger->log(this->logger, CONTROL|MOST, "Going to build message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Going to build message"); this->ike_sa->build_message(this->ike_sa, IKE_SA_INIT, TRUE, &message); /* build SA payload */ @@ -219,16 +219,16 @@ status_t retry_initiate_connection (private_initiator_init_t *this, int dh_group ike_sa_init_request_data = message->get_packet_data(message); /* state can now be changed */ - this->logger->log(this->logger, CONTROL|MOST, "Create next state object"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Create next state object"); next_state = ike_sa_init_requested_create(this->ike_sa, this->dh_group_priority, this->diffie_hellman, this->sent_nonce,ike_sa_init_request_data); /* state can now be changed */ this->ike_sa->set_new_state(this->ike_sa,(state_t *) next_state); /* state has NOW changed :-) */ - this->logger->log(this->logger, CONTROL|MORE, "Changed state of IKE_SA from %s to %s", mapping_find(ike_sa_state_m,INITIATOR_INIT),mapping_find(ike_sa_state_m,IKE_SA_INIT_REQUESTED) ); + this->logger->log(this->logger, CONTROL|LEVEL1, "Changed state of IKE_SA from %s to %s", mapping_find(ike_sa_state_m,INITIATOR_INIT),mapping_find(ike_sa_state_m,IKE_SA_INIT_REQUESTED) ); - this->logger->log(this->logger, CONTROL|MOST, "Destroy old sate object"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Destroy old sate object"); this->destroy_after_state_change(this); return SUCCESS; } @@ -243,7 +243,7 @@ static void build_sa_payload(private_initiator_init_t *this, message_t *request) ike_proposal_t *proposals; init_config_t *init_config; - this->logger->log(this->logger, CONTROL|MORE, "Building SA payload"); + this->logger->log(this->logger, CONTROL|LEVEL1, "Building SA payload"); init_config = this->ike_sa->get_init_config(this->ike_sa); @@ -253,7 +253,7 @@ static void build_sa_payload(private_initiator_init_t *this, message_t *request) allocator_free(proposals); - this->logger->log(this->logger, CONTROL|MOST, "Add SA payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add SA payload to message"); request->add_payload(request, (payload_t *) sa_payload); } @@ -265,7 +265,7 @@ static void build_ke_payload(private_initiator_init_t *this, message_t *request) ke_payload_t *ke_payload; chunk_t key_data; - this->logger->log(this->logger, CONTROL|MORE, "Building KE payload"); + this->logger->log(this->logger, CONTROL|LEVEL1, "Building KE payload"); this->diffie_hellman->get_my_public_value(this->diffie_hellman,&key_data); @@ -275,7 +275,7 @@ static void build_ke_payload(private_initiator_init_t *this, message_t *request) allocator_free_chunk(&key_data); - this->logger->log(this->logger, CONTROL|MOST, "Add KE payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add KE payload to message"); request->add_payload(request, (payload_t *) ke_payload); } @@ -287,20 +287,20 @@ static void build_nonce_payload(private_initiator_init_t *this, message_t *reque nonce_payload_t *nonce_payload; randomizer_t *randomizer; - this->logger->log(this->logger, CONTROL|MORE, "Building NONCE payload"); + this->logger->log(this->logger, CONTROL|LEVEL1, "Building NONCE payload"); - this->logger->log(this->logger, CONTROL|MOST, "Get pseudo random bytes for NONCE"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Get pseudo random bytes for NONCE"); randomizer = this->ike_sa->get_randomizer(this->ike_sa); randomizer->allocate_pseudo_random_bytes(randomizer, NONCE_SIZE, &(this->sent_nonce)); - this->logger->log(this->logger, RAW|MOST, "Initiator NONCE",&(this->sent_nonce)); + this->logger->log(this->logger, RAW|LEVEL2, "Initiator NONCE",&(this->sent_nonce)); nonce_payload = nonce_payload_create(); nonce_payload->set_nonce(nonce_payload, this->sent_nonce); - this->logger->log(this->logger, CONTROL|MOST, "Add NONCE payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add NONCE payload to message"); request->add_payload(request, (payload_t *) nonce_payload); } @@ -309,7 +309,7 @@ static void build_nonce_payload(private_initiator_init_t *this, message_t *reque */ static status_t process_message(private_initiator_init_t *this, message_t *message) { - this->logger->log(this->logger, ERROR|MORE, "In state INITIATOR_INIT no message is processed"); + this->logger->log(this->logger, ERROR|LEVEL1, "In state INITIATOR_INIT no message is processed"); return FAILED; } @@ -326,17 +326,17 @@ static ike_sa_state_t get_state(private_initiator_init_t *this) */ static void destroy(private_initiator_init_t *this) { - this->logger->log(this->logger, CONTROL | MORE, "Going to destroy initiator_init_t state object"); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to destroy initiator_init_t state object"); /* destroy diffie hellman object */ if (this->diffie_hellman != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy diffie_hellman_t object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy diffie_hellman_t object"); this->diffie_hellman->destroy(this->diffie_hellman); } if (this->sent_nonce.ptr != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Free memory of sent nonce"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Free memory of sent nonce"); allocator_free(this->sent_nonce.ptr); } allocator_free(this); @@ -347,7 +347,7 @@ static void destroy(private_initiator_init_t *this) */ static void destroy_after_state_change (private_initiator_init_t *this) { - this->logger->log(this->logger, CONTROL | MORE, "Going to destroy initiator_init_t state object"); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to destroy initiator_init_t state object"); allocator_free(this); } diff --git a/Source/charon/sa/states/responder_init.c b/Source/charon/sa/states/responder_init.c index e4792d6b5..b0dcfa322 100644 --- a/Source/charon/sa/states/responder_init.c +++ b/Source/charon/sa/states/responder_init.c @@ -161,12 +161,12 @@ static status_t process_message(private_responder_init_t *this, message_t *messa if (message->get_exchange_type(message) != IKE_SA_INIT) { - this->logger->log(this->logger, ERROR | MORE, "Message of type %s not supported in state responder_init",mapping_find(exchange_type_m,message->get_exchange_type(message))); + this->logger->log(this->logger, ERROR | LEVEL1, "Message of type %s not supported in state responder_init",mapping_find(exchange_type_m,message->get_exchange_type(message))); return DELETE_ME; } if (!message->get_request(message)) { - this->logger->log(this->logger, ERROR | MORE, "Only requests of type IKE_SA_INIT supported in state responder_init"); + this->logger->log(this->logger, ERROR | LEVEL1, "Only requests of type IKE_SA_INIT supported in state responder_init"); return DELETE_ME; } @@ -178,7 +178,7 @@ static status_t process_message(private_responder_init_t *this, message_t *messa if (status != SUCCESS) { /* no configuration matches given host */ - this->logger->log(this->logger, ERROR | MORE, "No INIT configuration found for given remote and local hosts"); + this->logger->log(this->logger, ERROR | LEVEL1, "No INIT configuration found for given remote and local hosts"); this->send_notify_reply(this,NO_PROPOSAL_CHOSEN,CHUNK_INITIALIZER); return DELETE_ME; } @@ -193,7 +193,7 @@ static status_t process_message(private_responder_init_t *this, message_t *messa { if (status == NOT_SUPPORTED) { - this->logger->log(this->logger, ERROR | MORE, "Message contains unsupported payload with critical flag set"); + this->logger->log(this->logger, ERROR | LEVEL1, "Message contains unsupported payload with critical flag set"); /** * TODO send unsupported type. */ @@ -201,7 +201,7 @@ static status_t process_message(private_responder_init_t *this, message_t *messa } else { - this->logger->log(this->logger, ERROR | MORE, "Could not parse body of request message"); + this->logger->log(this->logger, ERROR | LEVEL1, "Could not parse body of request message"); } return DELETE_ME; } @@ -233,13 +233,13 @@ static status_t process_message(private_responder_init_t *this, message_t *messa case NOTIFY: { notify_payload_t *notify_payload = (notify_payload_t *) payload; - this->logger->log(this->logger, CONTROL|MORE, "Process notify type %s for protocol %s", + this->logger->log(this->logger, CONTROL|LEVEL1, "Process notify type %s for protocol %s", mapping_find(notify_message_type_m, notify_payload->get_notify_message_type(notify_payload)), mapping_find(protocol_id_m, notify_payload->get_protocol_id(notify_payload))); if (notify_payload->get_protocol_id(notify_payload) != IKE) { - this->logger->log(this->logger, ERROR | MORE, "Notify not for IKE protocol."); + this->logger->log(this->logger, ERROR | LEVEL1, "Notify not for IKE protocol."); payloads->destroy(payloads); return DELETE_ME; } @@ -247,7 +247,7 @@ static status_t process_message(private_responder_init_t *this, message_t *messa { default: { - this->logger->log(this->logger, CONTROL|MORE, "Processing of notify type %s not yet implemented", + this->logger->log(this->logger, CONTROL|LEVEL1, "Processing of notify type %s not yet implemented", mapping_find(notify_message_type_m, notify_payload->get_notify_message_type(notify_payload))); break; } @@ -255,14 +255,14 @@ static status_t process_message(private_responder_init_t *this, message_t *messa } default: { - this->logger->log(this->logger, CONTROL | MORE, "Processing of Payload with Type number %d not implemented",payload->get_type(payload)); + this->logger->log(this->logger, CONTROL | LEVEL1, "Processing of Payload with Type number %d not implemented",payload->get_type(payload)); break; } } } payloads->destroy(payloads); - this->logger->log(this->logger, CONTROL | MORE, "Going to process received payloads"); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to process received payloads"); this->ike_sa->build_message(this->ike_sa, IKE_SA_INIT, FALSE, &response); status = this->build_sa_payload(this, sa_request, response); @@ -290,7 +290,7 @@ static status_t process_message(private_responder_init_t *this, message_t *messa } /* store shared secret */ - this->logger->log(this->logger, CONTROL | MOST, "Retrieve shared secret and store it"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Retrieve shared secret and store it"); status = this->diffie_hellman->get_shared_secret(this->diffie_hellman, &shared_secret); this->logger->log_chunk(this->logger, PRIVATE, "Shared Diffie Hellman secret", &shared_secret); @@ -309,7 +309,7 @@ static status_t process_message(private_responder_init_t *this, message_t *messa } /* state can now be changed */ - this->logger->log(this->logger, CONTROL|MOST, "Create next state object of type IKE_SA_INIT_RESPONDED"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Create next state object of type IKE_SA_INIT_RESPONDED"); response = this->ike_sa->get_last_responded_message(this->ike_sa); ike_sa_init_response_data = response->get_packet_data(response); @@ -320,9 +320,9 @@ static status_t process_message(private_responder_init_t *this, message_t *messa /* state can now be changed */ this->ike_sa->set_new_state(this->ike_sa, (state_t *) next_state); /* state has NOW changed :-) */ - this->logger->log(this->logger, CONTROL|MORE, "Changed state of IKE_SA from %s to %s",mapping_find(ike_sa_state_m,RESPONDER_INIT),mapping_find(ike_sa_state_m,IKE_SA_INIT_RESPONDED) ); + this->logger->log(this->logger, CONTROL|LEVEL1, "Changed state of IKE_SA from %s to %s",mapping_find(ike_sa_state_m,RESPONDER_INIT),mapping_find(ike_sa_state_m,IKE_SA_INIT_RESPONDED) ); - this->logger->log(this->logger, CONTROL|MOST, "Destroy old sate object"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Destroy old sate object"); this->destroy_after_state_change(this); return SUCCESS; @@ -342,12 +342,12 @@ static status_t build_sa_payload(private_responder_init_t *this,sa_payload_t *sa init_config = this->ike_sa->get_init_config(this->ike_sa); - this->logger->log(this->logger, CONTROL | MOST, "Process received SA payload"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Process received SA payload"); /* get the list of suggested proposals */ status = sa_request->get_ike_proposals (sa_request, &ike_proposals,&proposal_count); if (status != SUCCESS) { - this->logger->log(this->logger, ERROR | MORE, "SA payload does not contain IKE proposals"); + this->logger->log(this->logger, ERROR | LEVEL1, "SA payload does not contain IKE proposals"); this->send_notify_reply(this,NO_PROPOSAL_CHOSEN,CHUNK_INITIALIZER); return DELETE_ME; } @@ -356,7 +356,7 @@ static status_t build_sa_payload(private_responder_init_t *this,sa_payload_t *sa allocator_free(ike_proposals); if (status != SUCCESS) { - this->logger->log(this->logger, ERROR | MORE, "No proposal of suggested proposals selected"); + this->logger->log(this->logger, ERROR | LEVEL1, "No proposal of suggested proposals selected"); this->send_notify_reply(this,NO_PROPOSAL_CHOSEN,CHUNK_INITIALIZER); return DELETE_ME; } @@ -366,15 +366,15 @@ static status_t build_sa_payload(private_responder_init_t *this,sa_payload_t *sa status = this->ike_sa->create_transforms_from_proposal(this->ike_sa,&(selected_proposal)); if (status != SUCCESS) { - this->logger->log(this->logger, ERROR | MORE, "Transform objects could not be created from selected proposal"); + this->logger->log(this->logger, ERROR | LEVEL1, "Transform objects could not be created from selected proposal"); return DELETE_ME; } - this->logger->log(this->logger, CONTROL | MOST, "SA Payload processed"); + this->logger->log(this->logger, CONTROL | LEVEL2, "SA Payload processed"); - this->logger->log(this->logger, CONTROL|MOST, "Building SA payload"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Building SA payload"); sa_payload = sa_payload_create_from_ike_proposals(&(selected_proposal),1); - this->logger->log(this->logger, CONTROL|MOST, "add SA payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "add SA payload to message"); response->add_payload(response,(payload_t *) sa_payload); return SUCCESS; @@ -390,12 +390,12 @@ static status_t build_ke_payload(private_responder_init_t *this,ke_payload_t *ke diffie_hellman_t *dh; chunk_t key_data; - this->logger->log(this->logger, CONTROL | MOST, "Process received KE payload"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Process received KE payload"); group = ke_request->get_dh_group_number(ke_request); if (group == MODP_UNDEFINED) { - this->logger->log(this->logger, ERROR | MORE, "Diffie hellman group set to undefined!"); + this->logger->log(this->logger, ERROR | LEVEL1, "Diffie hellman group set to undefined!"); return DELETE_ME; } if (this->dh_group_number != group) @@ -404,7 +404,7 @@ static status_t build_ke_payload(private_responder_init_t *this,ke_payload_t *ke chunk_t accepted_group_chunk; /* group not same as selected one * Maybe key exchange payload is before SA payload */ - this->logger->log(this->logger, ERROR | MORE, "Diffie hellman group not as in selected proposal!"); + this->logger->log(this->logger, ERROR | LEVEL1, "Diffie hellman group not as in selected proposal!"); accepted_group = htons(this->dh_group_number); accepted_group_chunk.ptr = (u_int8_t*) &(accepted_group); @@ -420,15 +420,15 @@ static status_t build_ke_payload(private_responder_init_t *this,ke_payload_t *ke this->logger->log(this->logger, ERROR, "Could not generate DH object with group %d",mapping_find(diffie_hellman_group_m,group) ); return DELETE_ME; } - this->logger->log(this->logger, CONTROL | MOST, "Set other DH public value"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Set other DH public value"); dh->set_other_public_value(dh, ke_request->get_key_exchange_data(ke_request)); this->diffie_hellman = dh; - this->logger->log(this->logger, CONTROL | MOST, "KE Payload processed."); + this->logger->log(this->logger, CONTROL | LEVEL2, "KE Payload processed."); - this->logger->log(this->logger, CONTROL|MOST, "Building KE payload"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Building KE payload"); this->diffie_hellman->get_my_public_value(this->diffie_hellman,&key_data); ke_payload = ke_payload_create(); @@ -436,7 +436,7 @@ static status_t build_ke_payload(private_responder_init_t *this,ke_payload_t *ke ke_payload->set_dh_group_number(ke_payload, this->dh_group_number); allocator_free_chunk(&key_data); - this->logger->log(this->logger, CONTROL|MOST, "Add KE payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add KE payload to message"); response->add_payload(response,(payload_t *) ke_payload); return SUCCESS; @@ -450,23 +450,23 @@ static status_t build_nonce_payload(private_responder_init_t *this,nonce_payload nonce_payload_t *nonce_payload; randomizer_t *randomizer; - this->logger->log(this->logger, CONTROL | MOST, "Process received NONCE payload"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Process received NONCE payload"); allocator_free(this->received_nonce.ptr); this->received_nonce = CHUNK_INITIALIZER; - this->logger->log(this->logger, CONTROL | MOST, "Get NONCE value and store it"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Get NONCE value and store it"); this->received_nonce = nonce_request->get_nonce(nonce_request); - this->logger->log(this->logger, CONTROL | MOST, "Create new NONCE value."); + this->logger->log(this->logger, CONTROL | LEVEL2, "Create new NONCE value."); randomizer = this->ike_sa->get_randomizer(this->ike_sa); randomizer->allocate_pseudo_random_bytes(randomizer, NONCE_SIZE, &(this->sent_nonce)); - this->logger->log(this->logger, CONTROL|MOST, "Building NONCE payload"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Building NONCE payload"); nonce_payload = nonce_payload_create(); nonce_payload->set_nonce(nonce_payload, this->sent_nonce); - this->logger->log(this->logger, CONTROL|MOST, "Add NONCE payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add NONCE payload to message"); response->add_payload(response,(payload_t *) nonce_payload); return SUCCESS; @@ -491,21 +491,21 @@ static void send_notify_reply (private_responder_init_t *this,notify_message_typ packet_t *packet; status_t status; - this->logger->log(this->logger, CONTROL|MOST, "Going to build message with notify payload"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Going to build message with notify payload"); /* set up the reply */ this->ike_sa->build_message(this->ike_sa, IKE_SA_INIT, FALSE, &response); payload = notify_payload_create_from_protocol_and_type(IKE,type); if ((data.ptr != NULL) && (data.len > 0)) { - this->logger->log(this->logger, CONTROL|MOST, "Add Data to notify payload"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add Data to notify payload"); payload->set_notification_data(payload,data); } - this->logger->log(this->logger, CONTROL|MOST, "Add Notify payload to message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add Notify payload to message"); response->add_payload(response,(payload_t *) payload); /* generate packet */ - this->logger->log(this->logger, CONTROL|MOST, "Gnerate packet from message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Gnerate packet from message"); status = response->generate(response, NULL, NULL, &packet); if (status != SUCCESS) { @@ -513,9 +513,9 @@ static void send_notify_reply (private_responder_init_t *this,notify_message_typ return; } - this->logger->log(this->logger, CONTROL|MOST, "Add packet to global send queue"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Add packet to global send queue"); charon->send_queue->add(charon->send_queue, packet); - this->logger->log(this->logger, CONTROL|MOST, "Destroy message"); + this->logger->log(this->logger, CONTROL|LEVEL2, "Destroy message"); response->destroy(response); } @@ -524,19 +524,19 @@ static void send_notify_reply (private_responder_init_t *this,notify_message_typ */ static void destroy(private_responder_init_t *this) { - this->logger->log(this->logger, CONTROL | MORE, "Going to destroy responder init state object"); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to destroy responder init state object"); - this->logger->log(this->logger, CONTROL | MOST, "Destroy sent nonce"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy sent nonce"); allocator_free_chunk(&(this->sent_nonce)); - this->logger->log(this->logger, CONTROL | MOST, "Destroy received nonce"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy received nonce"); allocator_free_chunk(&(this->received_nonce)); if (this->diffie_hellman != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy diffie_hellman_t hellman object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy diffie_hellman_t hellman object"); this->diffie_hellman->destroy(this->diffie_hellman); } - this->logger->log(this->logger, CONTROL | MOST, "Destroy object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy object"); allocator_free(this); } @@ -545,16 +545,16 @@ static void destroy(private_responder_init_t *this) */ static void destroy_after_state_change (private_responder_init_t *this) { - this->logger->log(this->logger, CONTROL | MORE, "Going to destroy responder_init_t state object"); + this->logger->log(this->logger, CONTROL | LEVEL1, "Going to destroy responder_init_t state object"); /* destroy diffie hellman object */ if (this->diffie_hellman != NULL) { - this->logger->log(this->logger, CONTROL | MOST, "Destroy diffie_hellman_t object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy diffie_hellman_t object"); this->diffie_hellman->destroy(this->diffie_hellman); } - this->logger->log(this->logger, CONTROL | MOST, "Destroy object"); + this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy object"); allocator_free(this); } |