../svn-commit.tmp

This commit is contained in:
Martin Willi 2005-12-07 07:57:18 +00:00
parent a36a745a18
commit aee3eb5299
22 changed files with 367 additions and 357 deletions

View File

@ -360,7 +360,7 @@ static void load_default_config (private_configuration_manager_t *this)
this->add_new_configuration(this,"localhost",init_config3,sa_config3);
this->add_new_preshared_secret(this,ID_IPV4_ADDR, "152.96.193.130","verschluesselt");
this->add_new_preshared_secret(this,ID_IPV4_ADDR, "152.96.193.131","verschluesselt");
this->add_new_preshared_secret(this,ID_IPV4_ADDR, "152.96.193.131","scheisen");
this->add_new_preshared_secret(this,ID_IPV4_ADDR, "127.0.0.1","verschluesselt");
this->add_new_rsa_public_key(this,ID_IPV4_ADDR, "127.0.0.1", public_key_1, 256);
@ -379,7 +379,7 @@ static status_t get_init_config_for_host (private_configuration_manager_t *this,
iterator = this->configurations->create_iterator(this->configurations,TRUE);
this->logger->log(this->logger, CONTROL|MORE, "getting config for hosts %s - %s",
this->logger->log(this->logger, CONTROL|LEVEL1, "getting config for hosts %s - %s",
my_host->get_address(my_host), other_host->get_address(other_host));
while (iterator->has_next(iterator))
@ -396,7 +396,7 @@ static status_t get_init_config_for_host (private_configuration_manager_t *this,
/* first check if ip is equal */
if(config_other_host->ip_is_equal(config_other_host,other_host))
{
this->logger->log(this->logger, CONTROL|MOST, "config entry with remote host %s",
this->logger->log(this->logger, CONTROL|LEVEL2, "config entry with remote host %s",
config_other_host->get_address(config_other_host));
/* could be right one, check my_host for default route*/
if (config_my_host->is_default_route(config_my_host))
@ -749,9 +749,9 @@ static u_int32_t get_half_open_ike_sa_timeout (private_configuration_manager_t *
*/
static void destroy(private_configuration_manager_t *this)
{
this->logger->log(this->logger,CONTROL | MORE, "Going to destroy configuration manager ");
this->logger->log(this->logger,CONTROL | LEVEL1, "Going to destroy configuration manager ");
this->logger->log(this->logger,CONTROL | MOST, "Destroy configuration entries");
this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy configuration entries");
while (this->configurations->get_count(this->configurations) > 0)
{
configuration_entry_t *entry;
@ -760,7 +760,7 @@ static void destroy(private_configuration_manager_t *this)
}
this->configurations->destroy(this->configurations);
this->logger->log(this->logger,CONTROL | MOST, "Destroy sa_config_t objects");
this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy sa_config_t objects");
while (this->sa_configs->get_count(this->sa_configs) > 0)
{
sa_config_t *sa_config;
@ -770,7 +770,7 @@ static void destroy(private_configuration_manager_t *this)
this->sa_configs->destroy(this->sa_configs);
this->logger->log(this->logger,CONTROL | MOST, "Destroy init_config_t objects");
this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy init_config_t objects");
while (this->init_configs->get_count(this->init_configs) > 0)
{
init_config_t *init_config;
@ -789,7 +789,7 @@ static void destroy(private_configuration_manager_t *this)
}
this->preshared_secrets->destroy(this->preshared_secrets);
this->logger->log(this->logger,CONTROL | MOST, "Destroy rsa private keys");
this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy rsa private keys");
while (this->rsa_private_keys->get_count(this->rsa_private_keys) > 0)
{
rsa_private_key_entry_t *entry;
@ -800,7 +800,7 @@ static void destroy(private_configuration_manager_t *this)
}
this->rsa_private_keys->destroy(this->rsa_private_keys);
this->logger->log(this->logger,CONTROL | MOST, "Destroy rsa public keys");
this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy rsa public keys");
while (this->rsa_public_keys->get_count(this->rsa_public_keys) > 0)
{
rsa_public_key_entry_t *entry;
@ -811,7 +811,7 @@ static void destroy(private_configuration_manager_t *this)
}
this->rsa_public_keys->destroy(this->rsa_public_keys);
this->logger->log(this->logger,CONTROL | MOST, "Destroy assigned logger");
this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy assigned logger");
charon->logger_manager->destroy_logger(charon->logger_manager,this->logger);
allocator_free(this);
}

View File

@ -341,7 +341,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t
u_int8_t low_val = *(this->out_position) & 0x0F;
/* highval is set, low_val is not changed */
*(this->out_position) = high_val | low_val;
this->logger->log(this->logger, RAW|MOST, " => 0x%x", *(this->out_position));
this->logger->log(this->logger, RAW|LEVEL2, " => 0x%x", *(this->out_position));
/* write position is not changed, just bit position is moved */
this->current_bit = 4;
}
@ -352,7 +352,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t
/* lowval of current byte in buffer has to be set to the new value*/
u_int low_val = *((u_int8_t *)(this->data_struct + offset)) & 0x0F;
*(this->out_position) = high_val | low_val;
this->logger->log(this->logger, RAW|MOST, " => 0x%x", *(this->out_position));
this->logger->log(this->logger, RAW|LEVEL2, " => 0x%x", *(this->out_position));
this->out_position++;
this->current_bit = 0;
@ -370,7 +370,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t
{
/* 8 bit values are written as they are */
*this->out_position = *((u_int8_t *)(this->data_struct + offset));
this->logger->log(this->logger, RAW|MOST, " => 0x%x", *(this->out_position));
this->logger->log(this->logger, RAW|LEVEL2, " => 0x%x", *(this->out_position));
this->out_position++;
break;
@ -392,7 +392,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t
int16_val = int16_val & 0xFF7F;
int16_val = int16_val | attribute_format_flag;
this->logger->log(this->logger, RAW|MOST, " => 0x%x", int16_val);
this->logger->log(this->logger, RAW|LEVEL2, " => 0x%x", int16_val);
/* write bytes to buffer (set bit is overwritten)*/
this->write_bytes_to_buffer(this,&int16_val,sizeof(u_int16_t));
this->current_bit = 0;
@ -403,14 +403,14 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t
case CONFIGURATION_ATTRIBUTE_LENGTH:
{
u_int16_t int16_val = htons(*((u_int16_t*)(this->data_struct + offset)));
this->logger->log_bytes(this->logger, RAW|MOST, " =>", (void*)&int16_val, sizeof(int16_val));
this->logger->log_bytes(this->logger, RAW|LEVEL2, " =>", (void*)&int16_val, sizeof(int16_val));
this->write_bytes_to_buffer(this,&int16_val,sizeof(u_int16_t));
break;
}
case U_INT_32:
{
u_int32_t int32_val = htonl(*((u_int32_t*)(this->data_struct + offset)));
this->logger->log_bytes(this->logger, RAW|MOST, " =>", (void*)&int32_val, sizeof(int32_val));
this->logger->log_bytes(this->logger, RAW|LEVEL2, " =>", (void*)&int32_val, sizeof(int32_val));
this->write_bytes_to_buffer(this,&int32_val,sizeof(u_int32_t));
break;
}
@ -419,8 +419,8 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t
/* 64 bit integers are written as two 32 bit integers */
u_int32_t int32_val_low = htonl(*((u_int32_t*)(this->data_struct + offset)));
u_int32_t int32_val_high = htonl(*((u_int32_t*)(this->data_struct + offset) + 1));
this->logger->log_bytes(this->logger, RAW|MOST, " => (low)", (void*)&int32_val_low, sizeof(int32_val_low));
this->logger->log_bytes(this->logger, RAW|MOST, " => (high)", (void*)&int32_val_high, sizeof(int32_val_high));
this->logger->log_bytes(this->logger, RAW|LEVEL2, " => (low)", (void*)&int32_val_low, sizeof(int32_val_low));
this->logger->log_bytes(this->logger, RAW|LEVEL2, " => (high)", (void*)&int32_val_high, sizeof(int32_val_high));
/* TODO add support for big endian machines */
this->write_bytes_to_buffer(this,&int32_val_high,sizeof(u_int32_t));
this->write_bytes_to_buffer(this,&int32_val_low,sizeof(u_int32_t));
@ -431,7 +431,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t
{
/* 64 bit are written as they come :-) */
this->write_bytes_to_buffer(this,(this->data_struct + offset),sizeof(u_int64_t));
this->logger->log_bytes(this->logger, RAW|MOST, " =>", (void*)(this->data_struct + offset), sizeof(u_int64_t));
this->logger->log_bytes(this->logger, RAW|LEVEL2, " =>", (void*)(this->data_struct + offset), sizeof(u_int64_t));
break;
}
default:
@ -516,7 +516,7 @@ static void generate_flag (private_generator_t *this,u_int32_t offset)
*(this->out_position) = *(this->out_position) | flag;
this->logger->log(this->logger, RAW|MOST, " => 0x0%x", *(this->out_position));
this->logger->log(this->logger, RAW|LEVEL2, " => 0x0%x", *(this->out_position));
this->current_bit++;
if (this->current_bit >= 8)
@ -540,7 +540,7 @@ static void generate_from_chunk (private_generator_t *this,u_int32_t offset)
/* position in buffer */
chunk_t *attribute_value = (chunk_t *)(this->data_struct + offset);
this->logger->log_chunk(this->logger, RAW|MOST, " =>", attribute_value);
this->logger->log_chunk(this->logger, RAW|LEVEL2, " =>", attribute_value);
/* use write_bytes_to_buffer function to do the job */
this->write_bytes_to_buffer(this,attribute_value->ptr,attribute_value->len);
@ -558,7 +558,7 @@ static void make_space_available (private_generator_t *this, size_t bits)
size_t new_buffer_size = old_buffer_size + GENERATOR_DATA_BUFFER_INCREASE_VALUE;
size_t out_position_offset = ((this->out_position) - (this->buffer));
this->logger->log(this->logger, CONTROL|ALL, "increased gen buffer from %d to %d byte",
this->logger->log(this->logger, CONTROL|LEVEL3, "increased gen buffer from %d to %d byte",
old_buffer_size, new_buffer_size);
/* Reallocate space for new buffer */
@ -655,7 +655,7 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
payload_start = this->out_position;
this->logger->log(this->logger, CONTROL|MORE, "generating payload of type %s",
this->logger->log(this->logger, CONTROL|LEVEL1, "generating payload of type %s",
mapping_find(payload_type_m,payload_type));
/* each payload has its own encoding rules */
@ -663,7 +663,7 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
for (i = 0; i < rule_count;i++)
{
this->logger->log(this->logger, CONTROL|MOST, " generating rule %d %s",
this->logger->log(this->logger, CONTROL|LEVEL2, " generating rule %d %s",
i, mapping_find(encoding_type_m,rules[i].type));
switch (rules[i].type)
{
@ -964,7 +964,7 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
{
if (this->attribute_format == FALSE)
{
this->logger->log(this->logger, CONTROL|ALL, "attribute value has not fixed size");
this->logger->log(this->logger, CONTROL|LEVEL3, "attribute value has not fixed size");
/* the attribute value is generated */
this->generate_from_chunk(this,rules[i].offset);
}
@ -1017,7 +1017,7 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
return;
}
}
this->logger->log_bytes(this->logger, RAW|MORE, "generated data for this payload",
this->logger->log_bytes(this->logger, RAW|LEVEL1, "generated data for this payload",
payload_start, this->out_position-payload_start);
}

View File

@ -479,7 +479,7 @@ static void add_payload(private_message_t *this, payload_t *payload)
payload->set_next_type(payload, NO_PAYLOAD);
this->payloads->insert_last(this->payloads, (void*)payload);
this->logger->log(this->logger, CONTROL|MORE, "Added payload of type %s to message",
this->logger->log(this->logger, CONTROL|LEVEL1, "Added payload of type %s to message",
mapping_find(payload_type_m, payload->get_type(payload)));
}
@ -543,7 +543,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t*
if (this->exchange_type == EXCHANGE_TYPE_UNDEFINED)
{
this->logger->log(this->logger, ERROR | MORE, "Exchange type %s is not defined",
this->logger->log(this->logger, ERROR | LEVEL1, "Exchange type %s is not defined",
mapping_find(exchange_type_m,this->exchange_type));
return INVALID_STATE;
}
@ -551,7 +551,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t*
if (this->packet->get_source(this->packet) == NULL ||
this->packet->get_destination(this->packet) == NULL)
{
this->logger->log(this->logger, ERROR|MORE, "%s not defined",
this->logger->log(this->logger, ERROR|LEVEL1, "%s not defined",
!this->packet->get_source(this->packet) ? "source" : "destination");
return INVALID_STATE;
}
@ -571,7 +571,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t*
status = this->encrypt_payloads(this, crypter, signer);
if (status != SUCCESS)
{
this->logger->log(this->logger, ERROR | MORE, "Could not encrypt payloads");
this->logger->log(this->logger, ERROR | LEVEL1, "Could not encrypt payloads");
return status;
}
@ -615,7 +615,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t*
/* if last payload is of type encrypted, integrity checksum if necessary */
if (payload->get_type(payload) == ENCRYPTED)
{
this->logger->log(this->logger, CONTROL | MORE, "Build signature on whole message");
this->logger->log(this->logger, CONTROL | LEVEL1, "Build signature on whole message");
encryption_payload_t *encryption_payload = (encryption_payload_t*)payload;
status = encryption_payload->build_signature(encryption_payload, packet_data);
if (status != SUCCESS)
@ -659,13 +659,13 @@ static status_t parse_header(private_message_t *this)
status_t status;
this->logger->log(this->logger, CONTROL|MORE, "parsing Header of message");
this->logger->log(this->logger, CONTROL|LEVEL1, "parsing Header of message");
this->parser->reset_context(this->parser);
status = this->parser->parse_payload(this->parser,HEADER,(payload_t **) &ike_header);
if (status != SUCCESS)
{
this->logger->log(this->logger, ERROR | MORE, "Header could not be parsed");
this->logger->log(this->logger, ERROR | LEVEL1, "Header could not be parsed");
return status;
}
@ -674,7 +674,7 @@ static status_t parse_header(private_message_t *this)
status = ike_header->payload_interface.verify(&(ike_header->payload_interface));
if (status != SUCCESS)
{
this->logger->log(this->logger, ERROR | MORE, "Header verification failed");
this->logger->log(this->logger, ERROR | LEVEL1, "Header verification failed");
ike_header->destroy(ike_header);
return status;
}
@ -723,7 +723,7 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t
current_payload_type = this->first_payload;
this->logger->log(this->logger, CONTROL|MORE, "Parsing body of message, first payload %s",
this->logger->log(this->logger, CONTROL|LEVEL1, "Parsing body of message, first payload %s",
mapping_find(payload_type_m, current_payload_type));
/* parse payload for payload, while there are more available */
@ -731,7 +731,7 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t
{
payload_t *current_payload;
this->logger->log(this->logger, CONTROL|MOST, "Start parsing payload of type %s",
this->logger->log(this->logger, CONTROL|LEVEL2, "Start parsing payload of type %s",
mapping_find(payload_type_m, current_payload_type));
/* parse current payload */
@ -743,7 +743,7 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t
return status;
}
this->logger->log(this->logger, CONTROL|MOST, "Verify payload of type %s",
this->logger->log(this->logger, CONTROL|LEVEL2, "Verify payload of type %s",
mapping_find(payload_type_m, current_payload_type));
/* verify it, stop parsig if its invalid */
@ -757,14 +757,14 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t
return status;
}
this->logger->log(this->logger, CONTROL|MOST, "Payload verified. Adding to payload list",
this->logger->log(this->logger, CONTROL|LEVEL2, "Payload verified. Adding to payload list",
mapping_find(payload_type_m, current_payload_type));
this->payloads->insert_last(this->payloads,current_payload);
/* an encryption payload is the last one, so STOP here. decryption is done later */
if (current_payload_type == ENCRYPTED)
{
this->logger->log(this->logger, CONTROL|MOST, "Payload of type encrypted found. Stop parsing",
this->logger->log(this->logger, CONTROL|LEVEL2, "Payload of type encrypted found. Stop parsing",
mapping_find(payload_type_m, current_payload_type));
break;
}
@ -804,7 +804,7 @@ static status_t verify(private_message_t *this)
iterator_t *iterator;
size_t total_found_payloads = 0;
this->logger->log(this->logger, CONTROL|MORE, "Verifying message structure");
this->logger->log(this->logger, CONTROL|LEVEL1, "Verifying message structure");
iterator = this->payloads->create_iterator(this->payloads,TRUE);
/* check for payloads with wrong count*/
@ -829,7 +829,7 @@ static status_t verify(private_message_t *this)
unknown_payload_t *unknown_payload = (unknown_payload_t*)current_payload;
if (unknown_payload->is_critical(unknown_payload))
{
this->logger->log(this->logger, ERROR|MORE, "%s (%d) is not supported, but its critical!",
this->logger->log(this->logger, ERROR|LEVEL1, "%s (%d) is not supported, but its critical!",
mapping_find(payload_type_m, current_payload_type), current_payload_type);
iterator->destroy(iterator);
return NOT_SUPPORTED;
@ -839,13 +839,13 @@ static status_t verify(private_message_t *this)
{
found_payloads++;
total_found_payloads++;
this->logger->log(this->logger, CONTROL|MOST, "Found payload of type %s",
this->logger->log(this->logger, CONTROL|LEVEL2, "Found payload of type %s",
mapping_find(payload_type_m, this->message_rule->payload_rules[i].payload_type));
/* as soon as ohe payload occures more then specified, the verification fails */
if (found_payloads > this->message_rule->payload_rules[i].max_occurence)
{
this->logger->log(this->logger, ERROR|MORE, "Payload of type %s more than %d times (%d) occured in current message",
this->logger->log(this->logger, ERROR|LEVEL1, "Payload of type %s more than %d times (%d) occured in current message",
mapping_find(payload_type_m, current_payload_type),
this->message_rule->payload_rules[i].max_occurence, found_payloads);
iterator->destroy(iterator);
@ -856,7 +856,7 @@ static status_t verify(private_message_t *this)
if (found_payloads < this->message_rule->payload_rules[i].min_occurence)
{
this->logger->log(this->logger, ERROR|MORE, "Payload of type %s not occured %d times (%d)",
this->logger->log(this->logger, ERROR|LEVEL1, "Payload of type %s not occured %d times (%d)",
mapping_find(payload_type_m, this->message_rule->payload_rules[i].payload_type),
this->message_rule->payload_rules[i].min_occurence, found_payloads);
iterator->destroy(iterator);
@ -899,7 +899,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig
/* needed to check */
current_payload_type = current_payload->get_type(current_payload);
this->logger->log(this->logger, CONTROL|MOST, "Process payload of type %s",
this->logger->log(this->logger, CONTROL|LEVEL2, "Process payload of type %s",
mapping_find(payload_type_m,current_payload_type));
if (current_payload_type == ENCRYPTED)
@ -909,30 +909,30 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig
encryption_payload = (encryption_payload_t*)current_payload;
this->logger->log(this->logger, CONTROL | MOST, "Found an encryption payload");
this->logger->log(this->logger, CONTROL | LEVEL2, "Found an encryption payload");
if (payload_number != this->payloads->get_count(this->payloads))
{
/* encrypted payload is not last one */
this->logger->log(this->logger, ERROR | MORE, "Encrypted payload is not last payload");
this->logger->log(this->logger, ERROR | LEVEL1, "Encrypted payload is not last payload");
iterator->destroy(iterator);
return FAILED;
}
/* decrypt */
encryption_payload->set_transforms(encryption_payload, crypter, signer);
this->logger->log(this->logger, CONTROL | MORE, "Verify signature of encryption payload");
this->logger->log(this->logger, CONTROL | LEVEL1, "Verify signature of encryption payload");
status = encryption_payload->verify_signature(encryption_payload, this->packet->get_data(this->packet));
if (status != SUCCESS)
{
this->logger->log(this->logger, ERROR | MORE, "encryption payload signature invalid");
this->logger->log(this->logger, ERROR | LEVEL1, "encryption payload signature invalid");
iterator->destroy(iterator);
return status;
}
this->logger->log(this->logger, CONTROL | MOST, "Decrypt content of encryption payload");
this->logger->log(this->logger, CONTROL | LEVEL2, "Decrypt content of encryption payload");
status = encryption_payload->decrypt(encryption_payload);
if (status != SUCCESS)
{
this->logger->log(this->logger, ERROR | MORE, "Encrypted payload could not be decrypted and parsed: %s",
this->logger->log(this->logger, ERROR | LEVEL1, "Encrypted payload could not be decrypted and parsed: %s",
mapping_find(status_m, status));
iterator->destroy(iterator);
return status;
@ -944,7 +944,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig
/* check if there are payloads contained in the encryption payload */
if (encryption_payload->get_payload_count(encryption_payload) == 0)
{
this->logger->log(this->logger, CONTROL|MOST, "Encrypted payload is empty");
this->logger->log(this->logger, CONTROL|LEVEL2, "Encrypted payload is empty");
/* remove the encryption payload, is not needed anymore */
iterator->remove(iterator);
/* encrypted payload contains no other payload */
@ -974,7 +974,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig
while (encryption_payload->get_payload_count(encryption_payload) > 0)
{
encryption_payload->remove_first_payload(encryption_payload, &current_encrypted_payload);
this->logger->log(this->logger, CONTROL | MORE, "Insert unencrypted payload of type %s at end of list.",
this->logger->log(this->logger, CONTROL | LEVEL1, "Insert unencrypted payload of type %s at end of list.",
mapping_find(payload_type_m,current_encrypted_payload->get_type(current_encrypted_payload)));
this->payloads->insert_last(this->payloads,current_encrypted_payload);
}
@ -991,7 +991,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig
if (status != SUCCESS)
{
/* payload is not allowed */
this->logger->log(this->logger, ERROR | MORE, "Payload type %s not allowed",mapping_find(payload_type_m,current_payload_type));
this->logger->log(this->logger, ERROR | LEVEL1, "Payload type %s not allowed",mapping_find(payload_type_m,current_payload_type));
iterator->destroy(iterator);
return status;
}
@ -1000,7 +1000,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig
if (payload_rule->encrypted != current_payload_was_encrypted)
{
/* payload was not encrypted, but should have been. or vice-versa */
this->logger->log(this->logger, ERROR | MORE, "Payload type %s should be %s!",
this->logger->log(this->logger, ERROR | LEVEL1, "Payload type %s should be %s!",
mapping_find(payload_type_m,current_payload_type),
(payload_rule->encrypted) ? "encrypted" : "not encrypted");
iterator->destroy(iterator);
@ -1027,12 +1027,12 @@ static status_t encrypt_payloads (private_message_t *this,crypter_t *crypter, si
if (!this->message_rule->encrypted_content)
{
this->logger->log(this->logger, CONTROL | MORE, "Message doesn't have to be encrypted");
this->logger->log(this->logger, CONTROL | LEVEL1, "Message doesn't have to be encrypted");
/* message contains no content to encrypt */
return SUCCESS;
}
this->logger->log(this->logger, CONTROL | MOST, "Copy all payloads to a temporary list");
this->logger->log(this->logger, CONTROL | LEVEL2, "Copy all payloads to a temporary list");
all_payloads = linked_list_create();
/* first copy all payloads in a temporary list */
@ -1043,7 +1043,7 @@ static status_t encrypt_payloads (private_message_t *this,crypter_t *crypter, si
all_payloads->insert_last(all_payloads,current_payload);
}
this->logger->log(this->logger, CONTROL | MOST, "Check each payloads if they have to get encrypted");
this->logger->log(this->logger, CONTROL | LEVEL2, "Check each payloads if they have to get encrypted");
while (all_payloads->get_count(all_payloads) > 0)
{
payload_rule_t *payload_rule;
@ -1051,7 +1051,7 @@ static status_t encrypt_payloads (private_message_t *this,crypter_t *crypter, si
bool to_encrypt = FALSE;
all_payloads->remove_first(all_payloads,(void **)&current_payload);
this->logger->log(this->logger, CONTROL | ALL, "Get rule for payload %s",
this->logger->log(this->logger, CONTROL | LEVEL3, "Get rule for payload %s",
mapping_find(payload_type_m,current_payload->get_type(current_payload)));
status = this->get_payload_rule(this,current_payload->get_type(current_payload),&payload_rule);
@ -1059,13 +1059,13 @@ static status_t encrypt_payloads (private_message_t *this,crypter_t *crypter, si
* that they don't have to be encrypted */
if ((status == SUCCESS) && (payload_rule->encrypted))
{
this->logger->log(this->logger, CONTROL | MOST, "Payload %s has to get encrypted",
this->logger->log(this->logger, CONTROL | LEVEL2, "Payload %s has to get encrypted",
mapping_find(payload_type_m,current_payload->get_type(current_payload)));
to_encrypt = TRUE;
}
else if (status != SUCCESS)
{
this->logger->log(this->logger, CONTROL | MOST, "Payload %s not defined for exchange type %s. Handle it anyway",
this->logger->log(this->logger, CONTROL | LEVEL2, "Payload %s not defined for exchange type %s. Handle it anyway",
mapping_find(payload_type_m,current_payload->get_type(current_payload)),
mapping_find(exchange_type_m,this->exchange_type));
}
@ -1076,14 +1076,14 @@ static status_t encrypt_payloads (private_message_t *this,crypter_t *crypter, si
{
encryption_payload = encryption_payload_create();
}
this->logger->log(this->logger, CONTROL | MOST, "Insert payload %s to encryption payload",
this->logger->log(this->logger, CONTROL | LEVEL2, "Insert payload %s to encryption payload",
mapping_find(payload_type_m,current_payload->get_type(current_payload)));
encryption_payload->add_payload(encryption_payload,current_payload);
}
else
{
this->logger->log(this->logger, CONTROL | MOST, "Insert payload %s as payload wich does not have to be encrypted",
this->logger->log(this->logger, CONTROL | LEVEL2, "Insert payload %s as payload wich does not have to be encrypted",
mapping_find(payload_type_m,current_payload->get_type(current_payload)));
this->public.add_payload(&(this->public), (payload_t*)encryption_payload);
}
@ -1092,11 +1092,11 @@ static status_t encrypt_payloads (private_message_t *this,crypter_t *crypter, si
status = SUCCESS;
if (encryption_payload != NULL)
{
this->logger->log(this->logger, CONTROL | MOST, "Set transforms for encryption payload ");
this->logger->log(this->logger, CONTROL | LEVEL2, "Set transforms for encryption payload ");
encryption_payload->set_transforms(encryption_payload,crypter,signer);
this->logger->log(this->logger, CONTROL | MORE, "Encrypt all payloads of encrypted payload");
this->logger->log(this->logger, CONTROL | LEVEL1, "Encrypt all payloads of encrypted payload");
status = encryption_payload->encrypt(encryption_payload);
this->logger->log(this->logger, CONTROL | MOST, "Add encrypted payload to payload list");
this->logger->log(this->logger, CONTROL | LEVEL2, "Add encrypted payload to payload list");
this->public.add_payload(&(this->public), (payload_t*)encryption_payload);
}
@ -1113,7 +1113,7 @@ static void destroy (private_message_t *this)
{
iterator_t *iterator;
this->logger->log(this->logger, CONTROL|ALL, "Going to destroy message_t object");
this->logger->log(this->logger, CONTROL|LEVEL3, "Going to destroy message_t object");
this->packet->destroy(this->packet);
@ -1127,7 +1127,7 @@ static void destroy (private_message_t *this)
{
payload_t *payload;
iterator->current(iterator, (void**)&payload);
this->logger->log(this->logger, CONTROL|ALL, "Destroying payload of type %s",
this->logger->log(this->logger, CONTROL|LEVEL3, "Destroying payload of type %s",
mapping_find(payload_type_m, payload->get_type(payload)));
payload->destroy(payload);
}

View File

@ -246,7 +246,7 @@ static status_t parse_uint4(private_parser_t *this, int rule_number, u_int8_t *o
{
if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
{
this->logger->log(this->logger, ERROR|MORE, " not enough input to parse rule %d %s",
this->logger->log(this->logger, ERROR|LEVEL1, " not enough input to parse rule %d %s",
rule_number, mapping_find(encoding_type_m,
this->rules[rule_number].type));
return PARSE_ERROR;
@ -279,7 +279,7 @@ static status_t parse_uint4(private_parser_t *this, int rule_number, u_int8_t *o
if (output_pos != NULL)
{
this->logger->log(this->logger, RAW|MOST, " => %d", *output_pos);
this->logger->log(this->logger, RAW|LEVEL2, " => %d", *output_pos);
}
return SUCCESS;
@ -292,7 +292,7 @@ static status_t parse_uint8(private_parser_t *this, int rule_number, u_int8_t *o
{
if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
{
this->logger->log(this->logger, ERROR|MORE, " not enough input to parse rule %d %s",
this->logger->log(this->logger, ERROR|LEVEL1, " not enough input to parse rule %d %s",
rule_number, mapping_find(encoding_type_m,
this->rules[rule_number].type));
return PARSE_ERROR;
@ -309,7 +309,7 @@ static status_t parse_uint8(private_parser_t *this, int rule_number, u_int8_t *o
if (output_pos != NULL)
{
*output_pos = *(this->byte_pos);
this->logger->log(this->logger, RAW|MOST, " => %d", *output_pos);
this->logger->log(this->logger, RAW|LEVEL2, " => %d", *output_pos);
}
this->byte_pos++;
@ -323,7 +323,7 @@ static status_t parse_uint15(private_parser_t *this, int rule_number, u_int16_t
{
if (this->byte_pos + sizeof(u_int16_t) > this->input_roof)
{
this->logger->log(this->logger, ERROR|MORE, " not enough input to parse rule %d %s",
this->logger->log(this->logger, ERROR|LEVEL1, " not enough input to parse rule %d %s",
rule_number, mapping_find(encoding_type_m,
this->rules[rule_number].type));
return PARSE_ERROR;
@ -339,7 +339,7 @@ static status_t parse_uint15(private_parser_t *this, int rule_number, u_int16_t
if (output_pos != NULL)
{
*output_pos = ntohs(*((u_int16_t*)this->byte_pos)) & ~0x8000;
this->logger->log(this->logger, RAW|MOST, " => %d", *output_pos);
this->logger->log(this->logger, RAW|LEVEL2, " => %d", *output_pos);
}
this->byte_pos += 2;
this->bit_pos = 0;
@ -354,7 +354,7 @@ static status_t parse_uint16(private_parser_t *this, int rule_number, u_int16_t
{
if (this->byte_pos + sizeof(u_int16_t) > this->input_roof)
{
this->logger->log(this->logger, ERROR|MORE, " not enough input to parse rule %d %s",
this->logger->log(this->logger, ERROR|LEVEL1, " not enough input to parse rule %d %s",
rule_number, mapping_find(encoding_type_m, this->rules[rule_number].type));
return PARSE_ERROR;
}
@ -370,7 +370,7 @@ static status_t parse_uint16(private_parser_t *this, int rule_number, u_int16_t
{
*output_pos = ntohs(*((u_int16_t*)this->byte_pos));
this->logger->log(this->logger, RAW|MOST, " => %d", *output_pos);
this->logger->log(this->logger, RAW|LEVEL2, " => %d", *output_pos);
}
this->byte_pos += 2;
@ -383,7 +383,7 @@ static status_t parse_uint32(private_parser_t *this, int rule_number, u_int32_t
{
if (this->byte_pos + sizeof(u_int32_t) > this->input_roof)
{
this->logger->log(this->logger, ERROR|MORE, " not enough input to parse rule %d %s",
this->logger->log(this->logger, ERROR|LEVEL1, " not enough input to parse rule %d %s",
rule_number, mapping_find(encoding_type_m, this->rules[rule_number].type));
return PARSE_ERROR;
}
@ -399,7 +399,7 @@ static status_t parse_uint32(private_parser_t *this, int rule_number, u_int32_t
{
*output_pos = ntohl(*((u_int32_t*)this->byte_pos));
this->logger->log(this->logger, RAW|MOST, " => %d", *output_pos);
this->logger->log(this->logger, RAW|LEVEL2, " => %d", *output_pos);
}
this->byte_pos += 4;
@ -413,7 +413,7 @@ static status_t parse_uint64(private_parser_t *this, int rule_number, u_int64_t
{
if (this->byte_pos + sizeof(u_int64_t) > this->input_roof)
{
this->logger->log(this->logger, ERROR|MORE, " not enough input to parse rule %d %s",
this->logger->log(this->logger, ERROR|LEVEL1, " not enough input to parse rule %d %s",
rule_number, mapping_find(encoding_type_m, this->rules[rule_number].type));
return PARSE_ERROR;
}
@ -431,7 +431,7 @@ static status_t parse_uint64(private_parser_t *this, int rule_number, u_int64_t
*(output_pos + 1) = ntohl(*((u_int32_t*)this->byte_pos));
*output_pos = ntohl(*(((u_int32_t*)this->byte_pos) + 1));
this->logger->log_bytes(this->logger, RAW|MOST, " =>", (void*)output_pos, 8);
this->logger->log_bytes(this->logger, RAW|LEVEL2, " =>", (void*)output_pos, 8);
}
this->byte_pos += 8;
@ -445,7 +445,7 @@ static status_t parse_bytes (private_parser_t *this, int rule_number, u_int8_t *
{
if (this->byte_pos + bytes > this->input_roof)
{
this->logger->log(this->logger, ERROR|MORE, " not enough input to parse rule %d %s",
this->logger->log(this->logger, ERROR|LEVEL1, " not enough input to parse rule %d %s",
rule_number, mapping_find(encoding_type_m, this->rules[rule_number].type));
return PARSE_ERROR;
}
@ -462,7 +462,7 @@ static status_t parse_bytes (private_parser_t *this, int rule_number, u_int8_t *
{
memcpy(output_pos,this->byte_pos,bytes);
this->logger->log_bytes(this->logger, RAW|MOST, " =>", (void*)output_pos, bytes);
this->logger->log_bytes(this->logger, RAW|LEVEL2, " =>", (void*)output_pos, bytes);
}
this->byte_pos += bytes;
@ -476,7 +476,7 @@ static status_t parse_bit(private_parser_t *this, int rule_number, bool *output_
{
if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
{
this->logger->log(this->logger, ERROR|MORE, " not enough input to parse rule %d %s",
this->logger->log(this->logger, ERROR|LEVEL1, " not enough input to parse rule %d %s",
rule_number, mapping_find(encoding_type_m, this->rules[rule_number].type));
return PARSE_ERROR;
}
@ -493,7 +493,7 @@ static status_t parse_bit(private_parser_t *this, int rule_number, bool *output_
*output_pos = TRUE;
}
this->logger->log(this->logger, RAW|MOST, " => %d", *output_pos);
this->logger->log(this->logger, RAW|LEVEL2, " => %d", *output_pos);
}
this->bit_pos = (this->bit_pos + 1) % 8;
if (this->bit_pos == 0)
@ -513,7 +513,7 @@ static status_t parse_list(private_parser_t *this, int rule_number, linked_list_
if (length < 0)
{
this->logger->log(this->logger, ERROR|MORE, " invalid length for rule %d %s",
this->logger->log(this->logger, ERROR|LEVEL1, " invalid length for rule %d %s",
rule_number, mapping_find(encoding_type_m, this->rules[rule_number].type));
return PARSE_ERROR;
}
@ -530,7 +530,7 @@ static status_t parse_list(private_parser_t *this, int rule_number, linked_list_
u_int8_t *pos_before = this->byte_pos;
payload_t *payload;
status_t status;
this->logger->log(this->logger, CONTROL|MORE, " %d bytes left, parsing recursivly %s",
this->logger->log(this->logger, CONTROL|LEVEL1, " %d bytes left, parsing recursivly %s",
length, mapping_find(payload_type_m, payload_type));
status = this->public.parse_payload((parser_t*)this, payload_type, &payload);
if (status != SUCCESS)
@ -570,7 +570,7 @@ static status_t parse_chunk(private_parser_t *this, int rule_number, chunk_t *ou
memcpy(output_pos->ptr, this->byte_pos, length);
}
this->byte_pos += length;
this->logger->log_bytes(this->logger, RAW|MOST, " =>", (void*)output_pos->ptr, length);
this->logger->log_bytes(this->logger, RAW|LEVEL2, " =>", (void*)output_pos->ptr, length);
return SUCCESS;
}
@ -591,7 +591,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
/* create instance of the payload to parse */
pld = payload_create(payload_type);
this->logger->log(this->logger, CONTROL|MORE, "parsing %s payload, %d bytes left",
this->logger->log(this->logger, CONTROL|LEVEL1, "parsing %s payload, %d bytes left",
mapping_find(payload_type_m, payload_type),
this->input_roof-this->byte_pos);
@ -600,7 +600,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
if (pld->get_type(pld) == UNKNOWN_PAYLOAD)
{
this->logger->log(this->logger, ERROR|MORE, " payload type %d is unknown, handling as %s",
this->logger->log(this->logger, ERROR|LEVEL1, " payload type %d is unknown, handling as %s",
payload_type, mapping_find(payload_type_m, UNKNOWN_PAYLOAD));
}
@ -612,7 +612,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
for (rule_number = 0; rule_number < rule_count; rule_number++)
{
rule = &(this->rules[rule_number]);
this->logger->log(this->logger, CONTROL|MOST, " parsing rule %d %s",
this->logger->log(this->logger, CONTROL|LEVEL2, " parsing rule %d %s",
rule_number, mapping_find(encoding_type_m, rule->type));
switch (rule->type)
{

View File

@ -288,7 +288,7 @@ static status_t encrypt(private_encryption_payload_t *this)
/* build payload chunk */
this->generate(this);
this->logger->log(this->logger, CONTROL|MOST, "encrypting payloads");
this->logger->log(this->logger, CONTROL|LEVEL2, "encrypting payloads");
/* build padding */
block_size = this->crypter->get_block_size(this->crypter);
@ -315,7 +315,7 @@ static status_t encrypt(private_encryption_payload_t *this)
allocator_free(to_crypt.ptr);
if (status != SUCCESS)
{
this->logger->log(this->logger, ERROR|MORE, "encryption failed");
this->logger->log(this->logger, ERROR|LEVEL1, "encryption failed");
allocator_free(iv.ptr);
return status;
}
@ -344,7 +344,7 @@ static status_t decrypt(private_encryption_payload_t *this)
status_t status;
this->logger->log(this->logger, CONTROL|MOST, "decrypting encryption payload");
this->logger->log(this->logger, CONTROL|LEVEL2, "decrypting encryption payload");
if (this->signer == NULL || this->crypter == NULL)
{
@ -366,7 +366,7 @@ static status_t decrypt(private_encryption_payload_t *this)
*/
if (concatenated.len < iv.len)
{
this->logger->log(this->logger, ERROR|MORE, "could not decrypt, invalid input");
this->logger->log(this->logger, ERROR|LEVEL1, "could not decrypt, invalid input");
return FAILED;
}
@ -376,7 +376,7 @@ static status_t decrypt(private_encryption_payload_t *this)
status = this->crypter->decrypt(this->crypter, concatenated, iv, &(this->decrypted));
if (status != SUCCESS)
{
this->logger->log(this->logger, ERROR|MORE, "could not decrypt, decryption failed");
this->logger->log(this->logger, ERROR|LEVEL1, "could not decrypt, decryption failed");
return FAILED;
}
@ -389,14 +389,14 @@ static status_t decrypt(private_encryption_payload_t *this)
/* check size again */
if (padding_length > concatenated.len || this->decrypted.len < 0)
{
this->logger->log(this->logger, ERROR|MORE, "decryption failed, invalid padding length found. Invalid key?");
this->logger->log(this->logger, ERROR|LEVEL1, "decryption failed, invalid padding length found. Invalid key?");
/* decryption failed :-/ */
return FAILED;
}
/* free padding */
this->decrypted.ptr = allocator_realloc(this->decrypted.ptr, this->decrypted.len);
this->logger->log(this->logger, CONTROL|MOST, "decryption successful, trying to parse content");
this->logger->log(this->logger, CONTROL|LEVEL2, "decryption successful, trying to parse content");
return (this->parse(this));
}
@ -426,7 +426,7 @@ static status_t build_signature(private_encryption_payload_t *this, chunk_t data
sig.len = this->signer->get_block_size(this->signer);
data_without_sig.len -= sig.len;
sig.ptr = data.ptr + data_without_sig.len;
this->logger->log(this->logger, CONTROL|MOST, "building signature");
this->logger->log(this->logger, CONTROL|LEVEL2, "building signature");
this->signer->get_signature(this->signer, data_without_sig, sig.ptr);
return SUCCESS;
}
@ -448,7 +448,7 @@ static status_t verify_signature(private_encryption_payload_t *this, chunk_t dat
sig.len = this->signer->get_block_size(this->signer);
if (data.len <= sig.len)
{
this->logger->log(this->logger, ERROR|MORE, "unable to verify signature, invalid input");
this->logger->log(this->logger, ERROR|LEVEL1, "unable to verify signature, invalid input");
return FAILED;
}
sig.ptr = data.ptr + data.len - sig.len;
@ -460,11 +460,11 @@ static status_t verify_signature(private_encryption_payload_t *this, chunk_t dat
if (!valid)
{
this->logger->log(this->logger, ERROR|MORE, "signature verification failed");
this->logger->log(this->logger, ERROR|LEVEL1, "signature verification failed");
return FAILED;
}
this->logger->log(this->logger, CONTROL|MOST, "signature verification successful");
this->logger->log(this->logger, CONTROL|LEVEL2, "signature verification successful");
return SUCCESS;
}
@ -492,7 +492,7 @@ static void generate(private_encryption_payload_t *this)
else
{
/* no paylads? */
this->logger->log(this->logger, CONTROL|MORE, "generating contained payloads, but no available");
this->logger->log(this->logger, CONTROL|LEVEL1, "generating contained payloads, but no available");
allocator_free(this->decrypted.ptr);
this->decrypted = CHUNK_INITIALIZER;
iterator->destroy(iterator);
@ -520,7 +520,7 @@ static void generate(private_encryption_payload_t *this)
generator->write_to_chunk(generator, &(this->decrypted));
generator->destroy(generator);
this->logger->log(this->logger, CONTROL|MORE, "successfully generated content in encrpytion payload");
this->logger->log(this->logger, CONTROL|LEVEL1, "successfully generated content in encrpytion payload");
}
/**
@ -559,7 +559,7 @@ static status_t parse(private_encryption_payload_t *this)
status = current_payload->verify(current_payload);
if (status != SUCCESS)
{
this->logger->log(this->logger, ERROR|MORE, "%s verification failed: %s",
this->logger->log(this->logger, ERROR|LEVEL1, "%s verification failed: %s",
mapping_find(payload_type_m,current_payload->get_type(current_payload)),
mapping_find(status_m, status));
current_payload->destroy(current_payload);
@ -573,7 +573,7 @@ static status_t parse(private_encryption_payload_t *this)
this->payloads->insert_last(this->payloads,current_payload);
}
parser->destroy(parser);
this->logger->log(this->logger, CONTROL|MORE, "succesfully parsed content of encryption payload");
this->logger->log(this->logger, CONTROL|LEVEL1, "succesfully parsed content of encryption payload");
return SUCCESS;
}

View File

@ -77,7 +77,7 @@ status_t receiver(private_socket_t *this, packet_t **packet)
pkt->set_source(pkt, source);
pkt->set_destination(pkt, dest);
this->logger->log(this->logger, CONTROL|MORE, "going to read from socket");
this->logger->log(this->logger, CONTROL|LEVEL1, "going to read from socket");
/* do the read */
data.len = recvfrom(this->socket_fd, buffer, MAX_PACKET, 0,
source->get_sockaddr(source),

View File

@ -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;
}

View File

@ -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);

View File

@ -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**)&current);
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 */

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -386,7 +386,7 @@ static void receive_messages(private_kernel_interface_t *this)
pthread_mutex_lock(&(this->mutex));
this->responses->insert_last(this->responses, (void*)listed_response);
pthread_mutex_unlock(&(this->mutex));
/* signal ALL waiting threads */
/* signal LEVEL3 waiting threads */
pthread_cond_broadcast(&(this->condvar));
}
/* get the next one */

View File

@ -160,7 +160,7 @@ static void get_prime(private_prime_pool_t *this, size_t prime_size, mpz_t *prim
prime_list->usage += this->prime_lists->get_count(this->prime_lists);
if (prime_list->primes->remove_first(prime_list->primes, (void*)&removed_prime) == SUCCESS)
{
this->logger->log(this->logger, CONTROL|MOST, "Thread removed a prime with size %d", prime_size);
this->logger->log(this->logger, CONTROL|LEVEL2, "Thread removed a prime with size %d", prime_size);
mpz_init_set(*prime, *removed_prime);
mpz_clear(*removed_prime);
allocator_free(removed_prime);
@ -174,7 +174,7 @@ static void get_prime(private_prime_pool_t *this, size_t prime_size, mpz_t *prim
if (create_new_list)
{
this->logger->log(this->logger, CONTROL|MORE, "Creating a new list for primes with size %d", prime_size);
this->logger->log(this->logger, CONTROL|LEVEL1, "Creating a new list for primes with size %d", prime_size);
/* there is no list for this prime size, create one */
prime_list_t *prime_list;
prime_list = allocator_alloc_thing(prime_list_t);
@ -191,7 +191,7 @@ static void get_prime(private_prime_pool_t *this, size_t prime_size, mpz_t *prim
if (!prime_found)
{
/* no prime found, create one ourself */
this->logger->log(this->logger, CONTROL|MOST, "Caller didn't find a prime, generates on it's own.");
this->logger->log(this->logger, CONTROL|LEVEL2, "Caller didn't find a prime, generates on it's own.");
this->compute_prime(this, prime_size, prime);
}
}
@ -245,7 +245,7 @@ void generate_primes(private_prime_pool_t *this)
mpz_t *prime;
this->logger->log(this->logger, CONTROL|MOST, "Finding most important prime size...");
this->logger->log(this->logger, CONTROL|LEVEL2, "Finding most important prime size...");
pthread_mutex_lock(&(this->mutex));
@ -255,7 +255,7 @@ void generate_primes(private_prime_pool_t *this)
{
prime_list_t *prime_list;
iterator->current(iterator, (void*)&prime_list);
this->logger->log(this->logger, CONTROL|MOST, "Primes with size %d have usage %d, %d in list",
this->logger->log(this->logger, CONTROL|LEVEL2, "Primes with size %d have usage %d, %d in list",
prime_list->prime_size, prime_list->usage,
prime_list->primes->get_count(prime_list->primes));
/* get the prime_size with the highest usage factor */
@ -273,7 +273,7 @@ void generate_primes(private_prime_pool_t *this)
if (selected_prime_list == NULL)
{
this->logger->log(this->logger, CONTROL|MORE, "Nothing to do, goint to sleep");
this->logger->log(this->logger, CONTROL|LEVEL1, "Nothing to do, goint to sleep");
/* nothing to do. wait, while able to cancel */
pthread_cleanup_push((void(*)(void*))pthread_mutex_unlock, (void*)&(this->mutex));
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
@ -288,14 +288,14 @@ void generate_primes(private_prime_pool_t *this)
if (selected_prime_list != NULL)
{
this->logger->log(this->logger, CONTROL|MORE, "Going to generate a prime with size %d",
this->logger->log(this->logger, CONTROL|LEVEL1, "Going to generate a prime with size %d",
selected_prime_list->prime_size);
/* generate the prime of requested size */
prime = allocator_alloc_thing(mpz_t);
compute_prime(this, selected_prime_list->prime_size, prime);
/* insert prime */
this->logger->log(this->logger, CONTROL|MOST, "Prime generated, inserting in list");
this->logger->log(this->logger, CONTROL|LEVEL2, "Prime generated, inserting in list");
pthread_mutex_lock(&(this->mutex));
selected_prime_list->primes->insert_last(selected_prime_list->primes, (void*)prime);
pthread_mutex_unlock(&(this->mutex));

View File

@ -81,7 +81,7 @@ static void receive_packets(private_receiver_t * this)
{
while (charon->socket->receive(charon->socket,&current_packet) == SUCCESS)
{
this->logger->log(this->logger, CONTROL | MORE, "Creating job from packet");
this->logger->log(this->logger, CONTROL | LEVEL1, "Creating job from packet");
current_job = (job_t *) incoming_packet_job_create(current_packet);
charon->job_queue->add(charon->job_queue,current_job);
@ -97,11 +97,11 @@ static void receive_packets(private_receiver_t * this)
*/
static void destroy(private_receiver_t *this)
{
this->logger->log(this->logger, CONTROL | MORE, "Going to terminate receiver thread");
this->logger->log(this->logger, CONTROL | LEVEL1, "Going to terminate receiver thread");
pthread_cancel(this->assigned_thread);
pthread_join(this->assigned_thread, NULL);
this->logger->log(this->logger, CONTROL | MORE, "Receiver thread terminated");
this->logger->log(this->logger, CONTROL | LEVEL1, "Receiver thread terminated");
charon->logger_manager->destroy_logger(charon->logger_manager, this->logger);

View File

@ -77,12 +77,12 @@ static void get_events(private_scheduler_t * this)
for (;;)
{
this->logger->log(this->logger, CONTROL|MOST, "Waiting for next event...");
this->logger->log(this->logger, CONTROL|LEVEL2, "Waiting for next event...");
/* get a job, this block until one is available */
current_job = charon->event_queue->get(charon->event_queue);
/* queue the job in the job queue, workers will eat them */
charon->job_queue->add(charon->job_queue, current_job);
this->logger->log(this->logger, CONTROL | MORE, "Got event, added job %s to job-queue.",
this->logger->log(this->logger, CONTROL | LEVEL1, "Got event, added job %s to job-queue.",
mapping_find(job_type_m, current_job->get_type(current_job)));
}
}
@ -92,11 +92,11 @@ static void get_events(private_scheduler_t * this)
*/
static void destroy(private_scheduler_t *this)
{
this->logger->log(this->logger, CONTROL | MORE, "Going to terminate scheduler thread");
this->logger->log(this->logger, CONTROL | LEVEL1, "Going to terminate scheduler thread");
pthread_cancel(this->assigned_thread);
pthread_join(this->assigned_thread, NULL);
this->logger->log(this->logger, CONTROL | MORE, "Scheduler thread terminated");
this->logger->log(this->logger, CONTROL | LEVEL1, "Scheduler thread terminated");
charon->logger_manager->destroy_logger(charon->logger_manager, this->logger);

View File

@ -79,7 +79,7 @@ static void send_packets(private_sender_t * this)
while (1)
{
current_packet = charon->send_queue->get(charon->send_queue);
this->logger->log(this->logger, CONTROL|MORE, "Got a packet, sending it");
this->logger->log(this->logger, CONTROL|LEVEL1, "Got a packet, sending it");
status = charon->socket->send(charon->socket,current_packet);
if (status != SUCCESS)
{
@ -95,11 +95,11 @@ static void send_packets(private_sender_t * this)
*/
static void destroy(private_sender_t *this)
{
this->logger->log(this->logger, CONTROL | MORE, "Going to terminate sender thread");
this->logger->log(this->logger, CONTROL | LEVEL1, "Going to terminate sender thread");
pthread_cancel(this->assigned_thread);
pthread_join(this->assigned_thread, NULL);
this->logger->log(this->logger, CONTROL | MORE, "Sender thread terminated");
this->logger->log(this->logger, CONTROL | LEVEL1, "Sender thread terminated");
charon->logger_manager->destroy_logger(charon->logger_manager, this->logger);

View File

@ -151,7 +151,7 @@ static void process_jobs(private_thread_pool_t *this)
job = charon->job_queue->get(charon->job_queue);
job_type = job->get_type(job);
this->worker_logger->log(this->worker_logger, CONTROL|MOST, "Process job of type %s",
this->worker_logger->log(this->worker_logger, CONTROL|LEVEL2, "Process job of type %s",
mapping_find(job_type_m,job_type));
gettimeofday(&start_time,NULL);
switch (job_type)
@ -195,7 +195,7 @@ static void process_jobs(private_thread_pool_t *this)
}
gettimeofday(&end_time,NULL);
this->worker_logger->log(this->worker_logger, CONTROL | MOST, "Processed job of type %s in %d us",
this->worker_logger->log(this->worker_logger, CONTROL | LEVEL2, "Processed job of type %s in %d us",
mapping_find(job_type_m,job_type),
(((end_time.tv_sec - start_time.tv_sec) * 1000000) + (end_time.tv_usec - start_time.tv_usec)));
@ -227,7 +227,7 @@ static void process_incoming_packet_job(private_thread_pool_t *this, incoming_pa
return;
}
this->worker_logger->log(this->worker_logger, CONTROL|MOST, "Message is a %s %s",
this->worker_logger->log(this->worker_logger, CONTROL|LEVEL2, "Message is a %s %s",
mapping_find(exchange_type_m, message->get_exchange_type(message)),
message->get_request(message) ? "request" : "reply");
@ -235,7 +235,7 @@ static void process_incoming_packet_job(private_thread_pool_t *this, incoming_pa
(message->get_minor_version(message) != IKE_MINOR_VERSION))
{
this->worker_logger->log(this->worker_logger, ERROR | MOST, "IKE version %d.%d not supported",
this->worker_logger->log(this->worker_logger, ERROR | LEVEL2, "IKE version %d.%d not supported",
message->get_major_version(message),
message->get_minor_version(message));
/*
@ -276,7 +276,7 @@ static void process_incoming_packet_job(private_thread_pool_t *this, incoming_pa
ike_sa_id->switch_initiator(ike_sa_id);
this->worker_logger->log(this->worker_logger, CONTROL|ALL, "Checking out IKE SA %lld:%lld, role %s",
this->worker_logger->log(this->worker_logger, CONTROL|LEVEL3, "Checking out IKE SA %lld:%lld, role %s",
ike_sa_id->get_initiator_spi(ike_sa_id),
ike_sa_id->get_responder_spi(ike_sa_id),
ike_sa_id->is_initiator(ike_sa_id) ? "initiator" : "responder");
@ -297,7 +297,7 @@ static void process_incoming_packet_job(private_thread_pool_t *this, incoming_pa
if (status == CREATED)
{
this->worker_logger->log(this->worker_logger, CONTROL|ALL, "Create Job to delete half open IKE_SA.");
this->worker_logger->log(this->worker_logger, CONTROL|LEVEL3, "Create Job to delete half open IKE_SA.");
this->create_delete_half_open_ike_sa_job(this,ike_sa_id,charon->configuration_manager->get_half_open_ike_sa_timeout(charon->configuration_manager));
}
@ -307,7 +307,7 @@ static void process_incoming_packet_job(private_thread_pool_t *this, incoming_pa
this->worker_logger->log(this->worker_logger, ERROR, "Message could not be processed by IKE SA");
}
this->worker_logger->log(this->worker_logger, CONTROL|ALL, "%s IKE SA %lld:%lld, role %s",
this->worker_logger->log(this->worker_logger, CONTROL|LEVEL3, "%s IKE SA %lld:%lld, role %s",
(status == DELETE_ME) ? "Checkin and delete" : "Checkin",
ike_sa_id->get_initiator_spi(ike_sa_id),
ike_sa_id->get_responder_spi(ike_sa_id),
@ -345,7 +345,7 @@ static void process_initiate_ike_sa_job(private_thread_pool_t *this, initiate_ik
status_t status;
this->worker_logger->log(this->worker_logger, CONTROL|MOST, "Create and checking out IKE SA");
this->worker_logger->log(this->worker_logger, CONTROL|LEVEL2, "Create and checking out IKE SA");
charon->ike_sa_manager->create_and_checkout(charon->ike_sa_manager, &ike_sa);
@ -360,10 +360,10 @@ static void process_initiate_ike_sa_job(private_thread_pool_t *this, initiate_ik
return;
}
this->worker_logger->log(this->worker_logger, CONTROL|ALL, "Create Job to delete half open IKE_SA.");
this->worker_logger->log(this->worker_logger, CONTROL|LEVEL3, "Create Job to delete half open IKE_SA.");
this->create_delete_half_open_ike_sa_job(this,ike_sa->get_id(ike_sa),charon->configuration_manager->get_half_open_ike_sa_timeout(charon->configuration_manager));
this->worker_logger->log(this->worker_logger, CONTROL|MOST, "Checking in IKE SA");
this->worker_logger->log(this->worker_logger, CONTROL|LEVEL2, "Checking in IKE SA");
status = charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
if (status != SUCCESS)
{
@ -383,7 +383,7 @@ static void process_delete_half_open_ike_sa_job(private_thread_pool_t *this, del
status = charon->ike_sa_manager->checkout(charon->ike_sa_manager,ike_sa_id, &ike_sa);
if ((status != SUCCESS) && (status != CREATED))
{
this->worker_logger->log(this->worker_logger, CONTROL | ALL, "IKE SA seems to be allready deleted and so doesn't have to be deleted");
this->worker_logger->log(this->worker_logger, CONTROL | LEVEL3, "IKE SA seems to be allready deleted and so doesn't have to be deleted");
return;
}
@ -428,7 +428,7 @@ static void process_delete_established_ike_sa_job(private_thread_pool_t *this, d
status = charon->ike_sa_manager->checkout(charon->ike_sa_manager,ike_sa_id, &ike_sa);
if ((status != SUCCESS) && (status != CREATED))
{
this->worker_logger->log(this->worker_logger, CONTROL | ALL, "IKE SA seems to be allready deleted and so doesn't have to be deleted");
this->worker_logger->log(this->worker_logger, CONTROL | LEVEL3, "IKE SA seems to be allready deleted and so doesn't have to be deleted");
return;
}
@ -472,7 +472,7 @@ static void process_retransmit_request_job(private_thread_pool_t *this, retransm
ike_sa_t *ike_sa;
status_t status;
this->worker_logger->log(this->worker_logger, CONTROL|MOST, "Checking out IKE SA %lld:%lld, role %s",
this->worker_logger->log(this->worker_logger, CONTROL|LEVEL2, "Checking out IKE SA %lld:%lld, role %s",
ike_sa_id->get_initiator_spi(ike_sa_id),
ike_sa_id->get_responder_spi(ike_sa_id),
ike_sa_id->is_initiator(ike_sa_id) ? "initiator" : "responder");
@ -489,11 +489,11 @@ static void process_retransmit_request_job(private_thread_pool_t *this, retransm
if (status != SUCCESS)
{
this->worker_logger->log(this->worker_logger, CONTROL | ALL, "Message doesn't have to be retransmitted");
this->worker_logger->log(this->worker_logger, CONTROL | LEVEL3, "Message doesn't have to be retransmitted");
stop_retransmitting = TRUE;
}
this->worker_logger->log(this->worker_logger, CONTROL|MOST, "Checkin IKE SA %lld:%lld, role %s",
this->worker_logger->log(this->worker_logger, CONTROL|LEVEL2, "Checkin IKE SA %lld:%lld, role %s",
ike_sa_id->get_initiator_spi(ike_sa_id),
ike_sa_id->get_responder_spi(ike_sa_id),
ike_sa_id->is_initiator(ike_sa_id) ? "initiator" : "responder");
@ -514,7 +514,7 @@ static void process_retransmit_request_job(private_thread_pool_t *this, retransm
status = charon->configuration_manager->get_retransmit_timeout (charon->configuration_manager,job->get_retransmit_count(job),&timeout);
if (status != SUCCESS)
{
this->worker_logger->log(this->worker_logger, CONTROL | MOST, "Message will not be anymore retransmitted");
this->worker_logger->log(this->worker_logger, CONTROL | LEVEL2, "Message will not be anymore retransmitted");
job->destroy(job);
/*
* TODO delete IKE_SA ?
@ -533,7 +533,7 @@ static void create_delete_half_open_ike_sa_job(private_thread_pool_t *this,ike_s
{
job_t *delete_job;
this->worker_logger->log(this->worker_logger, CONTROL | MOST, "Going to create job to delete half open IKE_SA in %d ms", delay);
this->worker_logger->log(this->worker_logger, CONTROL | LEVEL2, "Going to create job to delete half open IKE_SA in %d ms", delay);
delete_job = (job_t *) delete_half_open_ike_sa_job_create(ike_sa_id);
charon->event_queue->add_relative(charon->event_queue,delete_job, delay);

View File

@ -102,15 +102,15 @@ static void prepend_prefix(private_logger_t *this, logger_level_t loglevel, char
log_type = '-';
}
if (loglevel & (ALL - MOST))
if (loglevel & (LEVEL3 - LEVEL2))
{
log_details = '3';
}
else if (loglevel & (MOST - MORE))
else if (loglevel & (LEVEL2 - LEVEL1))
{
log_details = '2';
}
else if (loglevel & MORE)
else if (loglevel & LEVEL1)
{
log_details = '1';
}

View File

@ -52,32 +52,40 @@ enum logger_level_t {
* Error reporting.
*/
ERROR = 2,
/**
* Logs important for the sysadmin.
*/
AUDIT = 4,
/**
* Raw data dumps.
*/
RAW = 4,
RAW = 8,
/**
* Private data dumps.
*/
PRIVATE = 8,
PRIVATE = 16,
/**
* Use more detailed output for those above.
* Log most important output, can be omitted.
*/
MORE = 16,
LEVEL0 = 0,
/**
* Use even more detailed output.
* Log more detailed output.
*/
MOST = MORE + 32,
LEVEL1 = 32,
/**
* Use full detailed output.
* Log even more detailed output.
*/
ALL = MOST + 64,
LEVEL2 = LEVEL1 + 64,
/**
* Use maximum detailed output.
*/
LEVEL3 = LEVEL2 + 128,
/**
* Summary for all types with all detail-levels.
*/
FULL = ALL + CONTROL + ERROR + RAW + PRIVATE
FULL = LEVEL3 + CONTROL + ERROR + RAW + PRIVATE + AUDIT
};
typedef struct logger_t logger_t;