mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
added option to send statistics periodically to sec-mod
This commit is contained in:
@@ -249,6 +249,42 @@ int process_packet(void *pool, sec_mod_st * sec, cmd_request_t cmd,
|
||||
|
||||
return ret;
|
||||
|
||||
case SM_CMD_CLI_STATS:{
|
||||
CliStatsMsg *tmsg;
|
||||
client_entry_st *e;
|
||||
|
||||
tmsg = cli_stats_msg__unpack(&pa, data.size, data.data);
|
||||
if (tmsg == NULL) {
|
||||
seclog(sec, LOG_ERR, "error unpacking data");
|
||||
ret = ERR_BAD_COMMAND;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (tmsg->has_sid == 0 || tmsg->sid.len != SID_SIZE) {
|
||||
cli_stats_msg__free_unpacked(tmsg, &pa);
|
||||
seclog(sec, LOG_INFO, "error in SID received by client (size: %d)",
|
||||
(int)tmsg->sid.len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
e = find_client_entry(sec, tmsg->sid.data);
|
||||
if (e == NULL) {
|
||||
cli_stats_msg__free_unpacked(tmsg, &pa);
|
||||
seclog(sec, LOG_INFO, "session stats received with non-existing sid!");
|
||||
return -1;
|
||||
}
|
||||
cli_stats_msg__free_unpacked(tmsg, &pa);
|
||||
|
||||
if (e->status != PS_AUTH_COMPLETED) {
|
||||
seclog(sec, LOG_ERR, "session stats received in unauthenticated client!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
e->bytes_in = tmsg->bytes_in;
|
||||
e->bytes_out = tmsg->bytes_out;
|
||||
}
|
||||
break;
|
||||
|
||||
case SM_CMD_AUTH_INIT:{
|
||||
SecAuthInitMsg *auth_init;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user