suricata
detect-ike-vendor.c
Go to the documentation of this file.
1/* Copyright (C) 2020-2022 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 *
20 * \author Frank Honza <frank.honza@dcso.de>
21 */
22
23#include "suricata-common.h"
24#include "conf.h"
25#include "detect.h"
26#include "detect-parse.h"
27#include "detect-engine.h"
31#include "detect-engine-mpm.h"
32#include "detect-ike-vendor.h"
33#include "rust.h"
34#include "app-layer-parser.h"
35#include "util-byte.h"
36
37#include "util-profiling.h"
38
39static int DetectIkeVendorSetup(DetectEngineCtx *, Signature *, const char *);
40
41static int g_ike_vendor_buffer_id = 0;
42
43/**
44 * \brief Registration function for ike.vendor keyword.
45 */
47{
49 sigmatch_table[DETECT_IKE_VENDOR].desc = "match IKE Vendor";
50 sigmatch_table[DETECT_IKE_VENDOR].url = "/rules/ike-keywords.html#ike-vendor";
51 sigmatch_table[DETECT_IKE_VENDOR].Setup = DetectIkeVendorSetup;
54
56 "ike.vendor", ALPROTO_IKE, SIG_FLAG_TOSERVER, 1, SCIkeTxGetVendor, 1);
57
58 g_ike_vendor_buffer_id = DetectBufferTypeGetByName("ike.vendor");
59
61}
62
63/**
64 * \brief setup the sticky buffer keyword used in the rule
65 *
66 * \param de_ctx Pointer to the Detection Engine Context
67 * \param s Pointer to the Signature to which the current keyword belongs
68 * \param str Should hold an empty string always
69 *
70 * \retval 0 On success
71 * \retval -1 On failure
72 */
73
74static int DetectIkeVendorSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
75{
76 if (SCDetectBufferSetActiveList(de_ctx, s, g_ike_vendor_buffer_id) < 0)
77 return -1;
79 return -1;
80 return 0;
81}
@ ALPROTO_IKE
int SCDetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
@ DETECT_IKE_VENDOR
void DetectBufferTypeSupportsMultiInstance(const char *name)
void DetectAppLayerMultiRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectionMultiBufferGetDataPtr GetData, int priority)
int DetectBufferTypeGetByName(const char *name)
void DetectIkeVendorRegister(void)
Registration function for ike.vendor keyword.
int SCDetectSignatureSetAppProto(Signature *s, AppProto alproto)
SigTableElmt * sigmatch_table
#define SIGMATCH_NOOPT
Definition detect.h:1651
#define SIGMATCH_INFO_STICKY_BUFFER
Definition detect.h:1676
#define SIG_FLAG_TOSERVER
Definition detect.h:271
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
#define str(s)