@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2013 Tobias Brunner
|
* Copyright (C) 2013-2015 Tobias Brunner
|
||||||
* Copyright (C) 2008 Martin Willi
|
* Copyright (C) 2008 Martin Willi
|
||||||
* Hochschule fuer Technik Rapperswil
|
* Hochschule fuer Technik Rapperswil
|
||||||
*
|
*
|
||||||
@@ -298,30 +298,17 @@ static void report_terminate_status(private_stroke_control_t *this,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(stroke_control_t, terminate, void,
|
/**
|
||||||
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
* Call the charon controller to terminate a CHILD_SA
|
||||||
|
*/
|
||||||
|
static void charon_terminate(private_stroke_control_t *this, u_int32_t id,
|
||||||
|
stroke_msg_t *msg, FILE *out, bool child)
|
||||||
{
|
{
|
||||||
char *name;
|
if (msg->output_verbosity >= 0)
|
||||||
u_int32_t id;
|
|
||||||
bool child, all;
|
|
||||||
ike_sa_t *ike_sa;
|
|
||||||
enumerator_t *enumerator;
|
|
||||||
linked_list_t *ike_list, *child_list;
|
|
||||||
stroke_log_info_t info;
|
|
||||||
uintptr_t del;
|
|
||||||
status_t status;
|
|
||||||
|
|
||||||
if (!parse_specifier(msg->terminate.name, &id, &name, &child, &all))
|
|
||||||
{
|
{
|
||||||
DBG1(DBG_CFG, "error parsing specifier string");
|
stroke_log_info_t info = { msg->output_verbosity, out };
|
||||||
return;
|
status_t status;
|
||||||
}
|
|
||||||
|
|
||||||
info.out = out;
|
|
||||||
info.level = msg->output_verbosity;
|
|
||||||
|
|
||||||
if (id)
|
|
||||||
{
|
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
status = charon->controller->terminate_child(charon->controller, id,
|
status = charon->controller->terminate_child(charon->controller, id,
|
||||||
@@ -332,7 +319,40 @@ METHOD(stroke_control_t, terminate, void,
|
|||||||
status = charon->controller->terminate_ike(charon->controller, id,
|
status = charon->controller->terminate_ike(charon->controller, id,
|
||||||
(controller_cb_t)stroke_log, &info, this->timeout);
|
(controller_cb_t)stroke_log, &info, this->timeout);
|
||||||
}
|
}
|
||||||
return report_terminate_status(this, status, out, id, child);
|
report_terminate_status(this, status, out, id, child);
|
||||||
|
}
|
||||||
|
else if (child)
|
||||||
|
{
|
||||||
|
charon->controller->terminate_child(charon->controller, id,
|
||||||
|
NULL, NULL, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
charon->controller->terminate_ike(charon->controller, id,
|
||||||
|
NULL, NULL, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
METHOD(stroke_control_t, terminate, void,
|
||||||
|
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
u_int32_t id;
|
||||||
|
bool child, all;
|
||||||
|
ike_sa_t *ike_sa;
|
||||||
|
enumerator_t *enumerator;
|
||||||
|
linked_list_t *ike_list, *child_list;
|
||||||
|
uintptr_t del;
|
||||||
|
|
||||||
|
if (!parse_specifier(msg->terminate.name, &id, &name, &child, &all))
|
||||||
|
{
|
||||||
|
DBG1(DBG_CFG, "error parsing specifier string");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id)
|
||||||
|
{
|
||||||
|
return charon_terminate(this, id, msg, out, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
ike_list = linked_list_create();
|
ike_list = linked_list_create();
|
||||||
@@ -380,18 +400,14 @@ METHOD(stroke_control_t, terminate, void,
|
|||||||
enumerator = child_list->create_enumerator(child_list);
|
enumerator = child_list->create_enumerator(child_list);
|
||||||
while (enumerator->enumerate(enumerator, &del))
|
while (enumerator->enumerate(enumerator, &del))
|
||||||
{
|
{
|
||||||
status = charon->controller->terminate_child(charon->controller, del,
|
charon_terminate(this, del, msg, out, TRUE);
|
||||||
(controller_cb_t)stroke_log, &info, this->timeout);
|
|
||||||
report_terminate_status(this, status, out, del, TRUE);
|
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
|
||||||
enumerator = ike_list->create_enumerator(ike_list);
|
enumerator = ike_list->create_enumerator(ike_list);
|
||||||
while (enumerator->enumerate(enumerator, &del))
|
while (enumerator->enumerate(enumerator, &del))
|
||||||
{
|
{
|
||||||
status = charon->controller->terminate_ike(charon->controller, del,
|
charon_terminate(this, del, msg, out, FALSE);
|
||||||
(controller_cb_t)stroke_log, &info, this->timeout);
|
|
||||||
report_terminate_status(this, status, out, del, FALSE);
|
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
|
||||||
@@ -548,11 +564,6 @@ METHOD(stroke_control_t, purge_ike, void,
|
|||||||
child_sa_t *child_sa;
|
child_sa_t *child_sa;
|
||||||
linked_list_t *list;
|
linked_list_t *list;
|
||||||
uintptr_t del;
|
uintptr_t del;
|
||||||
stroke_log_info_t info;
|
|
||||||
status_t status;
|
|
||||||
|
|
||||||
info.out = out;
|
|
||||||
info.level = msg->output_verbosity;
|
|
||||||
|
|
||||||
list = linked_list_create();
|
list = linked_list_create();
|
||||||
enumerator = charon->controller->create_ike_sa_enumerator(
|
enumerator = charon->controller->create_ike_sa_enumerator(
|
||||||
@@ -572,9 +583,7 @@ METHOD(stroke_control_t, purge_ike, void,
|
|||||||
enumerator = list->create_enumerator(list);
|
enumerator = list->create_enumerator(list);
|
||||||
while (enumerator->enumerate(enumerator, &del))
|
while (enumerator->enumerate(enumerator, &del))
|
||||||
{
|
{
|
||||||
status = charon->controller->terminate_ike(charon->controller, del,
|
charon_terminate(this, del, msg, out, FALSE);
|
||||||
(controller_cb_t)stroke_log, &info, this->timeout);
|
|
||||||
report_terminate_status(this, status, out, del, TRUE);
|
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
list->destroy(list);
|
list->destroy(list);
|
||||||
|
|||||||
Reference in New Issue
Block a user