64 }
else if (action == 0) {
68 for (uint8_t i = 0; i < 4; i++) {
84static uint8_t ActionAsciiToFlag(
const char *action)
86 if (strcmp(action,
"pass") == 0)
88 if (strcmp(action,
"drop") == 0)
90 if (strcmp(action,
"reject") == 0)
92 if (strcmp(action,
"alert") == 0)
107 uint8_t actions_used = 0;
108 uint8_t action_flag = 0;
109 uint8_t actions_config[4] = {0, 0, 0, 0};
117 if (action_order == NULL) {
124 action_flag = ActionAsciiToFlag(action->
val);
125 if (action_flag == 0) {
126 SCLogError(
"action-order, invalid action: \"%s\". Please, use"
127 " \"pass\",\"drop\",\"alert\",\"reject\". You have"
128 " to specify all of them, without quotes and without"
134 if (actions_used & action_flag) {
135 SCLogError(
"action-order, action already set: \"%s\". Please,"
136 " use \"pass\",\"drop\",\"alert\",\"reject\". You"
137 " have to specify all of them, without quotes and"
138 " without capital letters",
144 SCLogError(
"action-order, you have already specified all the "
145 "possible actions plus \"%s\". Please, use \"pass\","
146 "\"drop\",\"alert\",\"reject\". You have to specify"
147 " all of them, without quotes and without capital"
152 actions_used |= action_flag;
153 actions_config[order++] = action_flag;
157 SCLogError(
"action-order, the config didn't specify all of the "
158 "actions. Please, use \"pass\",\"drop\",\"alert\","
159 "\"reject\". You have to specify all of them, without"
160 " quotes and without capital letters");
165 for (order = 0; order < 4; order++) {
181static int UtilActionTest01(
void)
215static int UtilActionTest02(
void)
249static int UtilActionTest03(
void)
282static int UtilActionTest04(
void)
313static int UtilActionTest05(
void)
347static int UtilActionTest06(
void)
380static int UtilActionTest07(
void)
414static int UtilActionTest08(
void)
416 char config[] =
"%YAML 1.1\n"
#define ACTION_REJECT_ANY
struct HtpBodyChunk_ * next
int SCConfYamlLoadString(const char *string, size_t len)
Load configuration from a YAML string.
void SCConfInit(void)
Initialize the configuration system.
SCConfNode * SCConfGetNode(const char *name)
Get a SCConfNode by name.
void SCConfCreateContextBackup(void)
Creates a backup of the conf_hash hash_table used by the conf API.
void SCConfRestoreContextBackup(void)
Restores the backup of the hash_table present in backup_conf_hash back to conf_hash.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
#define PASS
Pass the test.
#define TAILQ_FOREACH(var, head, field)
uint8_t ActionOrderVal(uint8_t action)
Return the priority associated to an action (to order sigs as specified at config) action_order_sigs ...
void UtilActionRegisterTests(void)
uint8_t action_order_sigs[4]
int ActionInitConfig(void)
Load the action order from config. If none is provided, it will be default to ACTION_PASS,...
#define SCLogError(...)
Macro used to log ERROR messages.