vici: Expose ike-update event
This commit is contained in:
parent
2b255f01af
commit
d79cefc3fc
|
@ -976,6 +976,22 @@ The _ike-rekey_ event is issued when an IKE_SA is rekeyed.
|
|||
}
|
||||
}
|
||||
|
||||
### ike-update ###
|
||||
|
||||
The _ike-update_ event is issued when the local or remote endpoint address of an
|
||||
IKE_SA is about to change (at least one address/port is different).
|
||||
|
||||
{
|
||||
local-host = <new/current local IKE endpoint address>
|
||||
local-port = <new/current local IKE endpoint port>
|
||||
remote-host = <new/current remote IKE endpoint address>
|
||||
remote-port = <new/current remote IKE endpoint port>
|
||||
<IKE_SA config name> = {
|
||||
<same data as in the list-sas event, but without child-sas section
|
||||
and listing the old addresses/ports>
|
||||
}
|
||||
}
|
||||
|
||||
### child-updown ###
|
||||
|
||||
The _child-updown_ event is issued when a CHILD_SA is established or terminated.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2017 Tobias Brunner
|
||||
* Copyright (C) 2015-2020 Tobias Brunner
|
||||
* Copyright (C) 2015-2018 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
|
@ -510,6 +510,7 @@ CALLBACK(list_sas, vici_message_t*,
|
|||
bool bl;
|
||||
char buf[BUF_LEN];
|
||||
|
||||
|
||||
bl = request->get_str(request, NULL, "noblock") == NULL;
|
||||
ike = request->get_str(request, NULL, "ike");
|
||||
ike_id = request->get_int(request, 0, "ike-id");
|
||||
|
@ -1683,6 +1684,7 @@ static void manage_commands(private_vici_query_t *this, bool reg)
|
|||
this->dispatcher->manage_event(this->dispatcher, "list-cert", reg);
|
||||
this->dispatcher->manage_event(this->dispatcher, "ike-updown", reg);
|
||||
this->dispatcher->manage_event(this->dispatcher, "ike-rekey", reg);
|
||||
this->dispatcher->manage_event(this->dispatcher, "ike-update", reg);
|
||||
this->dispatcher->manage_event(this->dispatcher, "child-updown", reg);
|
||||
this->dispatcher->manage_event(this->dispatcher, "child-rekey", reg);
|
||||
manage_command(this, "list-sas", list_sas, reg);
|
||||
|
@ -1755,6 +1757,36 @@ METHOD(listener_t, ike_rekey, bool,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(listener_t, ike_update, bool,
|
||||
private_vici_query_t *this, ike_sa_t *ike_sa, host_t *local, host_t *remote)
|
||||
{
|
||||
vici_builder_t *b;
|
||||
time_t now;
|
||||
|
||||
if (!this->dispatcher->has_event_listeners(this->dispatcher, "ike-update"))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
now = time_monotonic(NULL);
|
||||
|
||||
b = vici_builder_create();
|
||||
|
||||
b->add_kv(b, "local-host", "%H", local);
|
||||
b->add_kv(b, "local-port", "%d", local->get_port(local));
|
||||
b->add_kv(b, "remote-host", "%H", remote);
|
||||
b->add_kv(b, "remote-port", "%d", remote->get_port(remote));
|
||||
|
||||
b->begin_section(b, ike_sa->get_name(ike_sa));
|
||||
list_ike(this, b, ike_sa, now);
|
||||
b->end_section(b);
|
||||
|
||||
this->dispatcher->raise_event(this->dispatcher,
|
||||
"ike-update", 0, b->finalize(b));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(listener_t, child_updown, bool,
|
||||
private_vici_query_t *this, ike_sa_t *ike_sa, child_sa_t *child_sa, bool up)
|
||||
{
|
||||
|
@ -1853,6 +1885,7 @@ vici_query_t *vici_query_create(vici_dispatcher_t *dispatcher)
|
|||
.listener = {
|
||||
.ike_updown = _ike_updown,
|
||||
.ike_rekey = _ike_rekey,
|
||||
.ike_update = _ike_update,
|
||||
.child_updown = _child_updown,
|
||||
.child_rekey = _child_rekey,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue