Server IP : 103.169.32.36 / Your IP : 216.73.217.13 Web Server : Apache System : Linux web.dpmptsp 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : apache ( 48) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/opt/eset/efs/ewap/eset_wap/ |
Upload File : |
| Current File : /var/opt/eset/efs/ewap/eset_wap/ewap_tracepoints.c |
/*
* eset_wap (ESET Web Access Protection module)
* Copyright (C) 1992-2023 ESET, spol. s r.o.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* In case of any questions, you can contact us at ESET, spol. s r.o., Einsteinova 24, 851 01 Bratislava, Slovakia.
*/
#include "ewap_tracepoints.h"
#include "ewap_helpers.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0))
int ewap_tracepoint_register(struct ewap_tracepoint *hook) {
int ret = tracepoint_probe_register(hook->name, hook->handler, NULL);
if (ret != 0) {
ewap_pr_log(EWAP_LOG_ERRORS, "failed to register tracepoint %s (%d)",
hook->name, ret);
} else {
ewap_pr_log(EWAP_LOG_HOOKS, "hook for %s registered", hook->name);
}
return ret;
}
void ewap_tracepoint_unregister(struct ewap_tracepoint *hook) {
tracepoint_probe_unregister(hook->name, hook->handler, NULL);
}
#else
static void tracepoint_iterator(struct tracepoint *tp, void *data) {
struct ewap_tracepoint *hook = data;
if (strcmp(tp->name, hook->name) == 0) {
hook->tp = tp;
}
}
int ewap_tracepoint_register(struct ewap_tracepoint *hook) {
int ret;
hook->tp = NULL;
for_each_kernel_tracepoint(tracepoint_iterator, hook);
if (!hook->tp) {
ewap_pr_log(EWAP_LOG_ERRORS, "failed to find tracepoint for %s",
hook->name);
return -1;
}
ret = tracepoint_probe_register(hook->tp, hook->handler, NULL);
if (ret != 0) {
ewap_pr_log(EWAP_LOG_ERRORS, "failed to register tracepoint %s (%d)",
hook->name, ret);
} else {
ewap_pr_log(EWAP_LOG_HOOKS, "hook for %s registered", hook->name);
}
return ret;
}
void ewap_tracepoint_unregister(struct ewap_tracepoint *hook) {
if (hook->tp) {
tracepoint_probe_unregister(hook->tp, hook->handler, NULL);
ewap_pr_log(EWAP_LOG_HOOKS, "tracepoint %s unregistered", hook->name);
}
}
#endif