vici: Optionally terminate IKE_SA immediately

This commit is contained in:
Tobias Brunner
2018-05-22 10:06:07 +02:00
parent 7b72909774
commit 0bcfed1aa2
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -279,7 +279,9 @@ Terminates an SA while streaming _control-log_ events.
ike = <terminate an IKE_SA by configuration name> ike = <terminate an IKE_SA by configuration name>
child-id = <terminate a CHILD_SA by its reqid> child-id = <terminate a CHILD_SA by its reqid>
ike-id = <terminate an IKE_SA by its unique id> ike-id = <terminate an IKE_SA by its unique id>
timeout = <timeout in ms before returning> force = <terminate IKE_SA without waiting for proper DELETE, if timeout
is given, waits for a response until it is reached>
timeout = <timeout in ms before returning, see below>
loglevel = <loglevel to issue "control-log" events for> loglevel = <loglevel to issue "control-log" events for>
} => { } => {
success = <yes or no> success = <yes or no>
+3 -1
View File
@@ -225,6 +225,7 @@ CALLBACK(terminate, vici_message_t*,
enumerator_t *enumerator, *isas, *csas; enumerator_t *enumerator, *isas, *csas;
char *child, *ike, *errmsg = NULL; char *child, *ike, *errmsg = NULL;
u_int child_id, ike_id, current, *del, done = 0; u_int child_id, ike_id, current, *del, done = 0;
bool force;
int timeout; int timeout;
ike_sa_t *ike_sa; ike_sa_t *ike_sa;
child_sa_t *child_sa; child_sa_t *child_sa;
@@ -240,6 +241,7 @@ CALLBACK(terminate, vici_message_t*,
ike = request->get_str(request, NULL, "ike"); ike = request->get_str(request, NULL, "ike");
child_id = request->get_int(request, 0, "child-id"); child_id = request->get_int(request, 0, "child-id");
ike_id = request->get_int(request, 0, "ike-id"); ike_id = request->get_int(request, 0, "ike-id");
force = request->get_bool(request, FALSE, "force");
timeout = request->get_int(request, 0, "timeout"); timeout = request->get_int(request, 0, "timeout");
log.level = request->get_int(request, 1, "loglevel"); log.level = request->get_int(request, 1, "loglevel");
@@ -326,7 +328,7 @@ CALLBACK(terminate, vici_message_t*,
} }
else else
{ {
if (charon->controller->terminate_ike(charon->controller, *del, FALSE, if (charon->controller->terminate_ike(charon->controller, *del, force,
log_cb, &log, timeout) == SUCCESS) log_cb, &log, timeout) == SUCCESS)
{ {
done++; done++;