Coverage Report

Created: 2026-05-16 07:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/suricata7/src/runmode-erf-dag.c
Line
Count
Source
1
/* Copyright (C) 2007-2010 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17
18
#include "suricata-common.h"
19
#include "tm-threads.h"
20
#include "conf.h"
21
#include "runmodes.h"
22
#include "runmode-erf-dag.h"
23
#include "output.h"
24
25
#include "detect-engine.h"
26
27
#include "util-debug.h"
28
#include "util-time.h"
29
#include "util-cpu.h"
30
#include "util-affinity.h"
31
#include "util-runmodes.h"
32
33
static int DagConfigGetThreadCount(void *conf)
34
0
{
35
0
    return 1;
36
0
}
37
38
static void *ParseDagConfig(const char *iface)
39
0
{
40
0
    return (void *)iface;
41
0
}
42
43
const char *RunModeErfDagGetDefaultMode(void)
44
0
{
45
0
    return "autofp";
46
0
}
47
48
void RunModeErfDagRegister(void)
49
37
{
50
37
    RunModeRegisterNewRunMode(RUNMODE_DAG, "autofp",
51
37
            "Multi threaded DAG mode.  Packets from "
52
37
            "each flow are assigned to a single detect "
53
37
            "thread, unlike \"dag_auto\" where packets "
54
37
            "from the same flow can be processed by any "
55
37
            "detect thread",
56
37
            RunModeIdsErfDagAutoFp, NULL);
57
58
37
    RunModeRegisterNewRunMode(
59
37
            RUNMODE_DAG, "single", "Singled threaded DAG mode", RunModeIdsErfDagSingle, NULL);
60
61
37
    RunModeRegisterNewRunMode(RUNMODE_DAG, "workers",
62
37
            "Workers DAG mode, each thread does all "
63
37
            " tasks from acquisition to logging",
64
37
            RunModeIdsErfDagWorkers, NULL);
65
66
37
    return;
67
37
}
68
69
int RunModeIdsErfDagSingle(void)
70
0
{
71
0
    int ret;
72
73
0
    SCEnter();
74
75
0
    TimeModeSetLive();
76
77
0
    ret = RunModeSetLiveCaptureSingle(ParseDagConfig,
78
0
        DagConfigGetThreadCount,
79
0
        "ReceiveErfDag",
80
0
        "DecodeErfDag",
81
0
        thread_name_single,
82
0
        NULL);
83
0
    if (ret != 0) {
84
0
        FatalError("DAG single runmode failed to start");
85
0
    }
86
87
0
    SCLogInfo("RunModeIdsDagSingle initialised");
88
89
0
    SCReturnInt(0);
90
0
}
91
92
int RunModeIdsErfDagAutoFp(void)
93
0
{
94
0
    int ret;
95
96
0
    SCEnter();
97
98
0
    TimeModeSetLive();
99
100
0
    ret = RunModeSetLiveCaptureAutoFp(ParseDagConfig, DagConfigGetThreadCount, "ReceiveErfDag",
101
0
            "DecodeErfDag", thread_name_autofp, NULL);
102
0
    if (ret != 0) {
103
0
        FatalError("DAG autofp runmode failed to start");
104
0
    }
105
106
0
    SCLogInfo("RunModeIdsDagAutoFp initialised");
107
108
0
    SCReturnInt(0);
109
0
}
110
111
int RunModeIdsErfDagWorkers(void)
112
0
{
113
0
    int ret;
114
115
0
    SCEnter();
116
117
0
    TimeModeSetLive();
118
119
0
    ret = RunModeSetLiveCaptureWorkers(ParseDagConfig, DagConfigGetThreadCount, "ReceiveErfDag",
120
0
            "DecodeErfDag", thread_name_workers, NULL);
121
0
    if (ret != 0) {
122
0
        FatalError("DAG workers runmode failed to start");
123
0
    }
124
125
0
    SCLogInfo("RunModeIdsErfDagWorkers initialised");
126
127
0
    SCReturnInt(0);
128
0
}