mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:46:03 +00:00
Remove Heartbeat log messages.
This commit is contained in:
parent
ee290ebd71
commit
ae075e24c8
@ -7,7 +7,6 @@
|
||||
#define FORT_LOG_FLAG_BLOCKED 0x01000000
|
||||
#define FORT_LOG_FLAG_PROC_NEW 0x02000000
|
||||
#define FORT_LOG_FLAG_STAT_TRAF 0x04000000
|
||||
#define FORT_LOG_FLAG_HEARTBEAT 0x08000000
|
||||
#define FORT_LOG_FLAG_BLOCKED_ALLOW 0x10000000
|
||||
#define FORT_LOG_FLAG_TYPE_MASK 0x0F000000
|
||||
#define FORT_LOG_FLAG_OPT_MASK 0xF0000000
|
||||
@ -38,8 +37,6 @@
|
||||
#define FORT_LOG_STAT_BUFFER_PROC_COUNT \
|
||||
((FORT_BUFFER_SIZE - FORT_LOG_STAT_HEADER_SIZE) / FORT_LOG_STAT_TRAF_SIZE(1))
|
||||
|
||||
#define FORT_LOG_HEARTBEAT_SIZE sizeof(UINT32)
|
||||
|
||||
#define FORT_LOG_SIZE_MAX FORT_LOG_BLOCKED_SIZE_MAX
|
||||
|
||||
#define fort_log_type(p) (*((UINT32 *) (p)) & FORT_LOG_FLAG_TYPE_MASK)
|
||||
@ -136,19 +133,3 @@ fort_log_stat_traf_header_read (const char *p, INT64 *unix_time, UINT16 *proc_co
|
||||
*proc_count = (UINT16) *up++;
|
||||
*unix_time = *((INT64 *) up);
|
||||
}
|
||||
|
||||
static void
|
||||
fort_log_heartbeat_write (char *p, UINT16 tick)
|
||||
{
|
||||
UINT32 *up = (UINT32 *) p;
|
||||
|
||||
*up = FORT_LOG_FLAG_HEARTBEAT | tick;
|
||||
}
|
||||
|
||||
static void
|
||||
fort_log_heartbeat_read (const char *p, UINT16 *tick)
|
||||
{
|
||||
const UINT32 *up = (const UINT32 *) p;
|
||||
|
||||
*tick = (UINT16) *up;
|
||||
}
|
||||
|
@ -45,10 +45,6 @@ typedef struct fort_device {
|
||||
FORT_DEFER defer;
|
||||
FORT_TIMER log_timer;
|
||||
FORT_TIMER app_timer;
|
||||
#ifdef LOG_HEARTBEAT
|
||||
FORT_TIMER heartbeat_timer;
|
||||
UINT16 volatile heartbeat_tick;
|
||||
#endif
|
||||
FORT_WORKER worker;
|
||||
} FORT_DEVICE, *PFORT_DEVICE;
|
||||
|
||||
@ -879,39 +875,6 @@ fort_app_period_timer (void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LOG_HEARTBEAT
|
||||
static void
|
||||
fort_heartbeat_timer (void)
|
||||
{
|
||||
PFORT_BUFFER buf = &g_device->buffer;
|
||||
KLOCK_QUEUE_HANDLE buf_lock_queue;
|
||||
|
||||
/* Lock buffer */
|
||||
KeAcquireInStackQueuedSpinLock(&buf->lock, &buf_lock_queue);
|
||||
|
||||
/* Log heartbeat */
|
||||
{
|
||||
const UINT16 tick = InterlockedIncrement16(&g_device->heartbeat_tick);
|
||||
const UINT32 len = FORT_LOG_HEARTBEAT_SIZE;
|
||||
PCHAR out;
|
||||
NTSTATUS status;
|
||||
|
||||
status = fort_buffer_prepare(buf, len, &out, NULL, NULL);
|
||||
if (!NT_SUCCESS(status)) {
|
||||
DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL,
|
||||
"FORT: Heartbeat Timer: Error: %x\n", status);
|
||||
goto end;
|
||||
}
|
||||
|
||||
fort_log_heartbeat_write(out, tick);
|
||||
}
|
||||
|
||||
end:
|
||||
/* Unlock buffer */
|
||||
KeReleaseInStackQueuedSpinLock(&buf_lock_queue);
|
||||
}
|
||||
#endif
|
||||
|
||||
static NTSTATUS
|
||||
fort_device_create (PDEVICE_OBJECT device, PIRP irp)
|
||||
{
|
||||
@ -928,12 +891,6 @@ fort_device_create (PDEVICE_OBJECT device, PIRP irp)
|
||||
if (NT_SUCCESS(status)) {
|
||||
/* Clear buffer */
|
||||
fort_buffer_clear(&g_device->buffer);
|
||||
|
||||
#ifdef LOG_HEARTBEAT
|
||||
InterlockedAnd16(&g_device->heartbeat_tick, 0);
|
||||
fort_heartbeat_timer();
|
||||
fort_timer_update(&g_device->heartbeat_timer, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
fort_request_complete(irp, status);
|
||||
@ -965,11 +922,6 @@ fort_device_cleanup (PDEVICE_OBJECT device, PIRP irp)
|
||||
fort_callout_force_reauth(old_conf_flags, FORT_DEFER_FLUSH_ALL);
|
||||
}
|
||||
|
||||
#ifdef LOG_HEARTBEAT
|
||||
fort_timer_update(&g_device->heartbeat_timer, FALSE);
|
||||
fort_heartbeat_timer();
|
||||
#endif
|
||||
|
||||
/* Clear buffer */
|
||||
fort_buffer_clear(&g_device->buffer);
|
||||
|
||||
@ -1227,9 +1179,6 @@ fort_driver_unload (PDRIVER_OBJECT driver)
|
||||
if (g_device != NULL) {
|
||||
fort_callout_defer_flush();
|
||||
|
||||
#ifdef LOG_HEARTBEAT
|
||||
fort_timer_close(&g_device->heartbeat_timer);
|
||||
#endif
|
||||
fort_timer_close(&g_device->app_timer);
|
||||
fort_timer_close(&g_device->log_timer);
|
||||
fort_defer_close(&g_device->defer);
|
||||
@ -1320,9 +1269,6 @@ DriverEntry (PDRIVER_OBJECT driver, PUNICODE_STRING reg_path)
|
||||
fort_defer_open(&g_device->defer);
|
||||
fort_timer_open(&g_device->log_timer, 500, FALSE, &fort_callout_timer);
|
||||
fort_timer_open(&g_device->app_timer, 60000, TRUE, &fort_app_period_timer);
|
||||
#ifdef LOG_HEARTBEAT
|
||||
fort_timer_open(&g_device->heartbeat_timer, 1000, TRUE, &fort_heartbeat_timer);
|
||||
#endif
|
||||
|
||||
/* Unregister old filters provider */
|
||||
{
|
||||
|
@ -5,7 +5,6 @@
|
||||
#define DOS_DEVICE_NAME L"\\DosDevices\\fortfw"
|
||||
|
||||
#define FORT_DRIVER
|
||||
//#define LOG_HEARTBEAT
|
||||
|
||||
#define fort_request_complete_info(irp, status, info) \
|
||||
do { \
|
||||
|
@ -5,7 +5,6 @@ SOURCES += \
|
||||
$$UIPATH/log/logbuffer.cpp \
|
||||
$$UIPATH/log/logentry.cpp \
|
||||
$$UIPATH/log/logentryblocked.cpp \
|
||||
$$UIPATH/log/logentryheartbeat.cpp \
|
||||
$$UIPATH/log/logentryprocnew.cpp \
|
||||
$$UIPATH/log/logentrystattraf.cpp \
|
||||
$$UIPATH/util/dateutil.cpp \
|
||||
@ -19,7 +18,6 @@ HEADERS += \
|
||||
$$UIPATH/log/logbuffer.h \
|
||||
$$UIPATH/log/logentry.h \
|
||||
$$UIPATH/log/logentryblocked.h \
|
||||
$$UIPATH/log/logentryheartbeat.h \
|
||||
$$UIPATH/log/logentryprocnew.h \
|
||||
$$UIPATH/log/logentrystattraf.h \
|
||||
$$UIPATH/util/dateutil.h \
|
||||
|
@ -8,7 +8,6 @@ SOURCES += \
|
||||
$$UIPATH/log/logbuffer.cpp \
|
||||
$$UIPATH/log/logentry.cpp \
|
||||
$$UIPATH/log/logentryblocked.cpp \
|
||||
$$UIPATH/log/logentryheartbeat.cpp \
|
||||
$$UIPATH/log/logentryprocnew.cpp \
|
||||
$$UIPATH/log/logentrystattraf.cpp \
|
||||
$$UIPATH/util/conf/addressrange.cpp \
|
||||
@ -30,7 +29,6 @@ HEADERS += \
|
||||
$$UIPATH/log/logbuffer.h \
|
||||
$$UIPATH/log/logentry.h \
|
||||
$$UIPATH/log/logentryblocked.h \
|
||||
$$UIPATH/log/logentryheartbeat.h \
|
||||
$$UIPATH/log/logentryprocnew.h \
|
||||
$$UIPATH/log/logentrystattraf.h \
|
||||
$$UIPATH/util/conf/addressrange.h \
|
||||
|
@ -53,7 +53,6 @@ SOURCES += \
|
||||
log/logbuffer.cpp \
|
||||
log/logentry.cpp \
|
||||
log/logentryblocked.cpp \
|
||||
log/logentryheartbeat.cpp \
|
||||
log/logentryprocnew.cpp \
|
||||
log/logentrystattraf.cpp \
|
||||
log/logmanager.cpp \
|
||||
@ -156,7 +155,6 @@ HEADERS += \
|
||||
log/logbuffer.h \
|
||||
log/logentry.h \
|
||||
log/logentryblocked.h \
|
||||
log/logentryheartbeat.h \
|
||||
log/logentryprocnew.h \
|
||||
log/logentrystattraf.h \
|
||||
log/logmanager.h \
|
||||
|
@ -103,11 +103,6 @@ quint32 FortCommon::logStatSize(quint16 procCount)
|
||||
return FORT_LOG_STAT_SIZE(procCount);
|
||||
}
|
||||
|
||||
quint32 FortCommon::logHeartbeatSize()
|
||||
{
|
||||
return FORT_LOG_HEARTBEAT_SIZE;
|
||||
}
|
||||
|
||||
quint32 FortCommon::logType(const char *input)
|
||||
{
|
||||
return fort_log_type(input);
|
||||
@ -148,11 +143,6 @@ void FortCommon::logStatTrafHeaderRead(const char *input,
|
||||
fort_log_stat_traf_header_read(input, unixTime, procCount);
|
||||
}
|
||||
|
||||
void FortCommon::logHeartbeatRead(const char *input, quint16 *tick)
|
||||
{
|
||||
fort_log_heartbeat_read(input, tick);
|
||||
}
|
||||
|
||||
void FortCommon::confAppPermsMaskInit(void *drvConf)
|
||||
{
|
||||
PFORT_CONF conf = (PFORT_CONF) drvConf;
|
||||
|
@ -36,8 +36,6 @@ public:
|
||||
static quint32 logStatTrafSize(quint16 procCount);
|
||||
static quint32 logStatSize(quint16 procCount);
|
||||
|
||||
static quint32 logHeartbeatSize();
|
||||
|
||||
static quint32 logType(const char *input);
|
||||
|
||||
static void logBlockedHeaderWrite(char *output, bool blocked,
|
||||
@ -56,8 +54,6 @@ public:
|
||||
qint64 *unixTime,
|
||||
quint16 *procCount);
|
||||
|
||||
static void logHeartbeatRead(const char *input, quint16 *tick);
|
||||
|
||||
static void confAppPermsMaskInit(void *drvConf);
|
||||
static bool confIpInRange(const void *drvConf, quint32 ip,
|
||||
bool included = false, int addrGroupIndex = 0);
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "fortcommon.h"
|
||||
#include "logentryblocked.h"
|
||||
#include "logentryheartbeat.h"
|
||||
#include "logentryprocnew.h"
|
||||
#include "logentrystattraf.h"
|
||||
|
||||
@ -168,18 +167,3 @@ void LogBuffer::readEntryStatTraf(LogEntryStatTraf *logEntry)
|
||||
const int entrySize = int(FortCommon::logStatSize(procCount));
|
||||
m_offset += entrySize;
|
||||
}
|
||||
|
||||
void LogBuffer::readEntryHeartbeat(LogEntryHeartbeat *logEntry)
|
||||
{
|
||||
Q_ASSERT(m_offset < m_top);
|
||||
|
||||
const char *input = this->input();
|
||||
|
||||
quint16 tick;
|
||||
FortCommon::logHeartbeatRead(input, &tick);
|
||||
|
||||
logEntry->setTick(tick);
|
||||
|
||||
const int entrySize = int(FortCommon::logHeartbeatSize());
|
||||
m_offset += entrySize;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "logentry.h"
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(LogEntryBlocked)
|
||||
QT_FORWARD_DECLARE_CLASS(LogEntryHeartbeat)
|
||||
QT_FORWARD_DECLARE_CLASS(LogEntryProcNew)
|
||||
QT_FORWARD_DECLARE_CLASS(LogEntryStatTraf)
|
||||
|
||||
@ -34,10 +33,6 @@ public:
|
||||
|
||||
void readEntryStatTraf(LogEntryStatTraf *logEntry);
|
||||
|
||||
void readEntryHeartbeat(LogEntryHeartbeat *logEntry);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void reset(int top = 0);
|
||||
|
||||
|
@ -13,8 +13,7 @@ public:
|
||||
// synchronize with FORT_LOG_FLAG_*
|
||||
AppBlocked = 0x01000000,
|
||||
ProcNew = 0x02000000,
|
||||
StatTraf = 0x04000000,
|
||||
Heartbeat = 0x08000000
|
||||
StatTraf = 0x04000000
|
||||
};
|
||||
|
||||
explicit LogEntry() = default;
|
||||
|
@ -1,11 +0,0 @@
|
||||
#include "logentryheartbeat.h"
|
||||
|
||||
LogEntryHeartbeat::LogEntryHeartbeat(quint16 tick) :
|
||||
m_tick(tick)
|
||||
{
|
||||
}
|
||||
|
||||
void LogEntryHeartbeat::setTick(quint16 tick)
|
||||
{
|
||||
m_tick = tick;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
#ifndef LOGENTRYHEARBEAT_H
|
||||
#define LOGENTRYHEARBEAT_H
|
||||
|
||||
#include "logentry.h"
|
||||
|
||||
class LogEntryHeartbeat : public LogEntry
|
||||
{
|
||||
public:
|
||||
explicit LogEntryHeartbeat(quint16 tick = 0);
|
||||
|
||||
LogEntry::LogType type() const override { return Heartbeat; }
|
||||
|
||||
quint16 tick() const { return m_tick; }
|
||||
void setTick(quint16 tick);
|
||||
|
||||
private:
|
||||
quint16 m_tick = 0;
|
||||
};
|
||||
|
||||
#endif // LOGENTRYHEARBEAT_H
|
@ -7,7 +7,6 @@
|
||||
#include "../fortcommon.h"
|
||||
#include "logbuffer.h"
|
||||
#include "logentryblocked.h"
|
||||
#include "logentryheartbeat.h"
|
||||
#include "logentryprocnew.h"
|
||||
#include "logentrystattraf.h"
|
||||
#include "model/applistmodel.h"
|
||||
@ -130,16 +129,6 @@ void LogManager::readLogEntries(LogBuffer *logBuffer)
|
||||
m_appStatModel->handleStatTraf(statTrafEntry);
|
||||
break;
|
||||
}
|
||||
case LogEntry::Heartbeat: {
|
||||
LogEntryHeartbeat heartbeatEntry;
|
||||
logBuffer->readEntryHeartbeat(&heartbeatEntry);
|
||||
if (++m_heartbeatTick != heartbeatEntry.tick()) {
|
||||
qCritical() << "Heartbeat ticks mismatch! Expected:"
|
||||
<< heartbeatEntry.tick() << "Got:" << m_heartbeatTick;
|
||||
abort();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (logBuffer->offset() < logBuffer->top()) {
|
||||
qCritical() << "Unknown Log entry!" << logType;
|
||||
|
@ -58,8 +58,6 @@ private:
|
||||
private:
|
||||
bool m_active = false;
|
||||
|
||||
quint16 m_heartbeatTick = 0;
|
||||
|
||||
AppListModel *m_appListModel = nullptr;
|
||||
AppStatModel *m_appStatModel = nullptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user