- fixes
This commit is contained in:
@@ -166,8 +166,8 @@ static void load_default_config (private_configuration_manager_t *this)
|
|||||||
sa_config_t *sa_config1, *sa_config2, *sa_config3;
|
sa_config_t *sa_config1, *sa_config2, *sa_config3;
|
||||||
traffic_selector_t *ts;
|
traffic_selector_t *ts;
|
||||||
|
|
||||||
init_config1 = init_config_create("152.96.193.130","152.96.193.131",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
|
init_config1 = init_config_create("0.0.0.0","152.96.193.131",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
|
||||||
init_config2 = init_config_create("152.96.193.131","152.96.193.130",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
|
init_config2 = init_config_create("0.0.0.0","152.96.193.130",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
|
||||||
init_config3 = init_config_create("0.0.0.0","127.0.0.1",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
|
init_config3 = init_config_create("0.0.0.0","127.0.0.1",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
|
||||||
ts = traffic_selector_create_from_string(1, TS_IPV4_ADDR_RANGE, "0.0.0.0", 0, "255.255.255.255", 65535);
|
ts = traffic_selector_create_from_string(1, TS_IPV4_ADDR_RANGE, "0.0.0.0", 0, "255.255.255.255", 65535);
|
||||||
|
|
||||||
@@ -254,6 +254,9 @@ static status_t get_init_config_for_host (private_configuration_manager_t *this,
|
|||||||
|
|
||||||
iterator = this->configurations->create_iterator(this->configurations,TRUE);
|
iterator = this->configurations->create_iterator(this->configurations,TRUE);
|
||||||
|
|
||||||
|
this->logger->log(this->logger, CONTROL|MORE, "getting config for hosts %s - %s",
|
||||||
|
my_host->get_address(my_host), other_host->get_address(other_host));
|
||||||
|
|
||||||
while (iterator->has_next(iterator))
|
while (iterator->has_next(iterator))
|
||||||
{
|
{
|
||||||
configuration_entry_t *entry;
|
configuration_entry_t *entry;
|
||||||
@@ -268,9 +271,12 @@ static status_t get_init_config_for_host (private_configuration_manager_t *this,
|
|||||||
/* first check if ip is equal */
|
/* first check if ip is equal */
|
||||||
if(config_other_host->ip_is_equal(config_other_host,other_host))
|
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",
|
||||||
|
config_other_host->get_address(config_other_host));
|
||||||
/* could be right one, check my_host for default route*/
|
/* could be right one, check my_host for default route*/
|
||||||
if (config_my_host->is_default_route(config_my_host))
|
if (config_my_host->is_default_route(config_my_host))
|
||||||
{
|
{
|
||||||
|
printf("is default route\n");
|
||||||
*init_config = entry->init_config;
|
*init_config = entry->init_config;
|
||||||
status = SUCCESS;
|
status = SUCCESS;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ static void kill_daemon(private_daemon_t *this, char *reason)
|
|||||||
static void build_test_jobs(private_daemon_t *this)
|
static void build_test_jobs(private_daemon_t *this)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i<1; i++)
|
for(i = 0; i<0; i++)
|
||||||
{
|
{
|
||||||
initiate_ike_sa_job_t *initiate_job;
|
initiate_ike_sa_job_t *initiate_job;
|
||||||
initiate_job = initiate_ike_sa_job_create("pinflb30");
|
initiate_job = initiate_ike_sa_job_create("pinflb30");
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ static supported_payload_entry_t supported_ike_auth_r_payloads[] =
|
|||||||
{
|
{
|
||||||
{NOTIFY,0,1,TRUE,TRUE},
|
{NOTIFY,0,1,TRUE,TRUE},
|
||||||
{CERTIFICATE,0,1,TRUE,FALSE},
|
{CERTIFICATE,0,1,TRUE,FALSE},
|
||||||
{ID_RESPONDER,0,1,TRUE,FALSE},
|
{ID_RESPONDER,1,1,TRUE,FALSE},
|
||||||
{AUTHENTICATION,1,1,TRUE,FALSE},
|
{AUTHENTICATION,1,1,TRUE,FALSE},
|
||||||
{SECURITY_ASSOCIATION,1,1,TRUE,FALSE},
|
{SECURITY_ASSOCIATION,1,1,TRUE,FALSE},
|
||||||
{TRAFFIC_SELECTOR_INITIATOR,1,1,TRUE,FALSE},
|
{TRAFFIC_SELECTOR_INITIATOR,1,1,TRUE,FALSE},
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ static status_t decrypt(private_encryption_payload_t *this)
|
|||||||
|
|
||||||
/* get IV */
|
/* get IV */
|
||||||
iv.len = this->crypter->get_block_size(this->crypter);
|
iv.len = this->crypter->get_block_size(this->crypter);
|
||||||
|
|
||||||
iv.ptr = this->encrypted.ptr;
|
iv.ptr = this->encrypted.ptr;
|
||||||
|
|
||||||
/* point concatenated to data + padding + padding_length*/
|
/* point concatenated to data + padding + padding_length*/
|
||||||
@@ -394,7 +395,6 @@ static status_t decrypt(private_encryption_payload_t *this)
|
|||||||
|
|
||||||
/* free padding */
|
/* free padding */
|
||||||
this->decrypted.ptr = allocator_realloc(this->decrypted.ptr, this->decrypted.len);
|
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|MOST, "decryption successful, trying to parse content");
|
||||||
return (this->parse(this));
|
return (this->parse(this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ struct private_host_t {
|
|||||||
*/
|
*/
|
||||||
int family;
|
int family;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* string representation of host
|
||||||
|
*/
|
||||||
|
char *string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* low-lewel structure, wich stores the address
|
* low-lewel structure, wich stores the address
|
||||||
*/
|
*/
|
||||||
@@ -78,16 +83,15 @@ static bool is_default_route (private_host_t *this)
|
|||||||
{
|
{
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
{
|
{
|
||||||
int i;
|
static u_int8_t default_route[4] = {0x00,0x00,0x00,0x00};
|
||||||
for (i = 0; i < 4;i++)
|
struct sockaddr_in *sin = (struct sockaddr_in*)&(this->address);
|
||||||
|
printf("host address: %ul\n", sin->sin_addr.s_addr);
|
||||||
|
|
||||||
|
if (memcmp(default_route,&(sin->sin_addr.s_addr),4) == 0)
|
||||||
{
|
{
|
||||||
struct sockaddr_in *sin = (struct sockaddr_in*)&(this->address);
|
return TRUE;
|
||||||
if (*((&sin->sin_addr.s_addr) + i) != 0)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@@ -106,8 +110,13 @@ static char *get_address(private_host_t *this)
|
|||||||
{
|
{
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
{
|
{
|
||||||
|
char *string;
|
||||||
struct sockaddr_in *sin = (struct sockaddr_in*)&(this->address);
|
struct sockaddr_in *sin = (struct sockaddr_in*)&(this->address);
|
||||||
return inet_ntoa(sin->sin_addr);
|
allocator_free(this->string);
|
||||||
|
string = inet_ntoa(sin->sin_addr);
|
||||||
|
this->string = allocator_alloc(strlen(string)+1);
|
||||||
|
strcpy(this->string, string);
|
||||||
|
return this->string;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@@ -161,13 +170,6 @@ static u_int16_t get_port(private_host_t *this)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements host_t.destroy
|
|
||||||
*/
|
|
||||||
static void destroy(private_host_t *this)
|
|
||||||
{
|
|
||||||
allocator_free(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements host_t.clone.
|
* Implements host_t.clone.
|
||||||
@@ -175,8 +177,14 @@ static void destroy(private_host_t *this)
|
|||||||
static private_host_t *clone(private_host_t *this)
|
static private_host_t *clone(private_host_t *this)
|
||||||
{
|
{
|
||||||
private_host_t *new = allocator_alloc_thing(private_host_t);
|
private_host_t *new = allocator_alloc_thing(private_host_t);
|
||||||
|
|
||||||
|
|
||||||
memcpy(new, this, sizeof(private_host_t));
|
memcpy(new, this, sizeof(private_host_t));
|
||||||
|
if (this->string)
|
||||||
|
{
|
||||||
|
new->string = allocator_alloc(strlen(this->string)+1);
|
||||||
|
strcpy(new->string, this->string);
|
||||||
|
}
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +211,14 @@ static bool ip_is_equal(private_host_t *this, private_host_t *other)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements host_t.destroy
|
||||||
|
*/
|
||||||
|
static void destroy(private_host_t *this)
|
||||||
|
{
|
||||||
|
allocator_free(this->string);
|
||||||
|
allocator_free(this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty host_t object
|
* Creates an empty host_t object
|
||||||
@@ -221,6 +237,8 @@ static private_host_t *host_create_empty()
|
|||||||
this->public.is_default_route = (bool (*) (host_t *)) is_default_route;
|
this->public.is_default_route = (bool (*) (host_t *)) is_default_route;
|
||||||
this->public.destroy = (void (*) (host_t*))destroy;
|
this->public.destroy = (void (*) (host_t*))destroy;
|
||||||
|
|
||||||
|
this->string = NULL;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -259,24 +259,21 @@ static status_t process_idr_payload(private_ike_auth_requested_t *this, id_paylo
|
|||||||
{
|
{
|
||||||
identification_t *other_id, *configured_other_id;
|
identification_t *other_id, *configured_other_id;
|
||||||
|
|
||||||
/* idr is optional */
|
other_id = idr_payload->get_identification(idr_payload);
|
||||||
if (idr_payload)
|
|
||||||
|
configured_other_id = this->sa_config->get_other_id(this->sa_config);
|
||||||
|
if (configured_other_id)
|
||||||
{
|
{
|
||||||
other_id = idr_payload->get_identification(idr_payload);
|
if (!other_id->equals(other_id, configured_other_id))
|
||||||
|
|
||||||
configured_other_id = this->sa_config->get_other_id(this->sa_config);
|
|
||||||
if (configured_other_id)
|
|
||||||
{
|
{
|
||||||
if (!other_id->equals(other_id, configured_other_id))
|
other_id->destroy(other_id);
|
||||||
{
|
this->logger->log(this->logger, ERROR, "IKE_AUTH reply didn't contain requested id");
|
||||||
this->logger->log(this->logger, ERROR, "IKE_AUTH reply didn't contain requested id");
|
return FAILED;
|
||||||
return FAILED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
other_id->destroy(other_id);
|
|
||||||
/* TODO do we have to store other_id somewhere ? */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
other_id->destroy(other_id);
|
||||||
|
/* TODO do we have to store other_id somewhere ? */
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ static logger_t *create_logger(private_logger_manager_t *this, logger_context_t
|
|||||||
case MESSAGE:
|
case MESSAGE:
|
||||||
case ENCRYPTION_PAYLOAD:
|
case ENCRYPTION_PAYLOAD:
|
||||||
case WORKER:
|
case WORKER:
|
||||||
|
case CONFIGURATION_MANAGER:
|
||||||
logger_level |= ALL;
|
logger_level |= ALL;
|
||||||
case PARSER:
|
case PARSER:
|
||||||
case GENERATOR:
|
case GENERATOR:
|
||||||
@@ -160,13 +161,11 @@ static logger_t *create_logger(private_logger_manager_t *this, logger_context_t
|
|||||||
case RECEIVER:
|
case RECEIVER:
|
||||||
case SOCKET:
|
case SOCKET:
|
||||||
case DAEMON:
|
case DAEMON:
|
||||||
case CONFIGURATION_MANAGER:
|
|
||||||
log_thread_ids = FALSE;
|
log_thread_ids = FALSE;
|
||||||
logger_level |= ERROR|CONTROL;
|
logger_level |= ERROR|CONTROL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* reduce to global definiton of loglevel */
|
/* reduce to global definiton of loglevel */
|
||||||
logger_level &= this->public.get_logger_level(&(this->public),context);
|
logger_level &= this->public.get_logger_level(&(this->public),context);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user