suricata
detect-noalert.c
Go to the documentation of this file.
1/* Copyright (C) 2007-2024 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/**
19 * \file
20 *
21 * \author Victor Julien <victor@inliniac.net>
22 *
23 * Implements the noalert and alert keywords.
24 */
25
26#include "suricata-common.h"
27#include "action-globals.h"
28#include "detect.h"
29#include "detect-noalert.h"
30#include "util-debug.h"
31#include "util-validate.h"
32
33static int DetectNoalertSetup(DetectEngineCtx *de_ctx, Signature *s, const char *nullstr)
34{
35 DEBUG_VALIDATE_BUG_ON(nullstr != NULL);
36
37 s->action &= ~ACTION_ALERT;
38 return 0;
39}
40
41static int DetectAlertSetup(DetectEngineCtx *de_ctx, Signature *s, const char *nullstr)
42{
43 DEBUG_VALIDATE_BUG_ON(nullstr != NULL);
44
45 s->action |= ACTION_ALERT;
46 return 0;
47}
48
50{
52 sigmatch_table[DETECT_NOALERT].desc = "no alert will be generated by the rule";
53 sigmatch_table[DETECT_NOALERT].url = "/rules/noalert.html";
54 sigmatch_table[DETECT_NOALERT].Setup = DetectNoalertSetup;
56
58 sigmatch_table[DETECT_ALERT].desc = "alert will be generated by the rule";
59 sigmatch_table[DETECT_ALERT].url = "/rules/noalert.html";
60 sigmatch_table[DETECT_ALERT].Setup = DetectAlertSetup;
62}
#define ACTION_ALERT
void DetectNoalertRegister(void)
SigTableElmt * sigmatch_table
#define SIGMATCH_NOOPT
Definition detect.h:1651
DetectEngineCtx * de_ctx
main detection engine ctx
Definition detect.h:932
const char * url
Definition detect.h:1462
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition detect.h:1441
uint16_t flags
Definition detect.h:1450
const char * desc
Definition detect.h:1461
const char * name
Definition detect.h:1459
Signature container.
Definition detect.h:668
uint8_t action
Definition detect.h:683
#define DEBUG_VALIDATE_BUG_ON(exp)