mirror of https://github.com/OISF/suricata
Support priority keyword, add priority to alert-fastlog.
parent
867d493d7f
commit
f0ed41fb0a
@ -0,0 +1,34 @@
|
||||
/* PRIORITY part of the detection engine. */
|
||||
|
||||
#include "decode.h"
|
||||
#include "detect.h"
|
||||
#include "flow-var.h"
|
||||
|
||||
int DetectPrioritySetup (Signature *s, SigMatch *m, char *sidstr);
|
||||
|
||||
void DetectPriorityRegister (void) {
|
||||
sigmatch_table[DETECT_PRIORITY].name = "priority";
|
||||
sigmatch_table[DETECT_PRIORITY].Match = NULL;
|
||||
sigmatch_table[DETECT_PRIORITY].Setup = DetectPrioritySetup;
|
||||
sigmatch_table[DETECT_PRIORITY].Free = NULL;
|
||||
sigmatch_table[DETECT_PRIORITY].RegisterTests = NULL;
|
||||
}
|
||||
|
||||
int DetectPrioritySetup (Signature *s, SigMatch *m, char *rawstr)
|
||||
{
|
||||
char *str = rawstr;
|
||||
char dubbed = 0;
|
||||
|
||||
/* strip "'s */
|
||||
if (rawstr[0] == '\"' && rawstr[strlen(rawstr)-1] == '\"') {
|
||||
str = strdup(rawstr+1);
|
||||
str[strlen(rawstr)-2] = '\0';
|
||||
dubbed = 1;
|
||||
}
|
||||
|
||||
s->prio = (u_int32_t)atoi(str);
|
||||
|
||||
if (dubbed) free(str);
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
#ifndef __DETECT_PRIORITY_H__
|
||||
#define __DETECT_PRIORITY_H__
|
||||
|
||||
/* prototypes */
|
||||
void DetectPriorityRegister (void);
|
||||
|
||||
#endif /* __DETECT_PRIORITY_H__ */
|
||||
|
Loading…
Reference in New Issue