From: Victor Julien Date: Mon, 16 May 2016 10:26:22 +0000 (+0200) Subject: detect-ipopts: cleanup X-Git-Tag: suricata-3.1RC1~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ab7dfd98813a19754f01db7f081f7d7419cac3f;p=thirdparty%2Fsuricata.git detect-ipopts: cleanup --- diff --git a/src/detect-ipopts.c b/src/detect-ipopts.c index 6fce99f5b2..bd47c3b0c6 100644 --- a/src/detect-ipopts.c +++ b/src/detect-ipopts.c @@ -35,9 +35,6 @@ #include "util-debug.h" -/* Need to get the DIpOpts[] array */ -#define DETECT_EVENTS - #include "detect-ipopts.h" #include "util-unittest.h" @@ -67,6 +64,33 @@ void DetectIpOptsRegister (void) DetectSetupParseRegexes(PARSE_REGEX, &parse_regex, &parse_regex_study); } +/** + * Used to check ipopts:any + */ + +#define IPV4_OPT_ANY 0xff + +/** + * \struct DetectIpOptss_ + * DetectIpOptss_ is used to store supported iptops values + */ + +struct DetectIpOptss_ { + char *ipopt_name; /**< Ip option name */ + uint8_t code; /**< Ip option value */ +} ipopts[] = { + { "rr", IPV4_OPT_RR, }, + { "lsrr", IPV4_OPT_LSRR, }, + { "eol", IPV4_OPT_EOL, }, + { "nop", IPV4_OPT_NOP, }, + { "ts", IPV4_OPT_TS, }, + { "sec", IPV4_OPT_SEC, }, + { "ssrr", IPV4_OPT_SSRR, }, + { "satid", IPV4_OPT_SID, }, + { "any", IPV4_OPT_ANY, }, + { NULL, 0 }, +}; + /** * \internal * \brief This function is used to match ip option on a packet with those passed via ipopts: @@ -145,8 +169,8 @@ DetectIpOptsData *DetectIpOptsParse (char *rawstr) goto error; } - for(i = 0; DIpOpts[i].ipopt_name != NULL; i++) { - if((strcasecmp(DIpOpts[i].ipopt_name,rawstr)) == 0) { + for(i = 0; ipopts[i].ipopt_name != NULL; i++) { + if((strcasecmp(ipopts[i].ipopt_name,rawstr)) == 0) { found = 1; break; } @@ -159,7 +183,7 @@ DetectIpOptsData *DetectIpOptsParse (char *rawstr) if (unlikely(de == NULL)) goto error; - de->ipopt = DIpOpts[i].code; + de->ipopt = ipopts[i].code; return de; diff --git a/src/detect-ipopts.h b/src/detect-ipopts.h index bd34625617..bb402a0731 100644 --- a/src/detect-ipopts.h +++ b/src/detect-ipopts.h @@ -47,34 +47,5 @@ typedef struct DetectIpOptsData_ { void DetectIpOptsRegister (void); -#ifdef DETECT_EVENTS - -/** - * Used to check ipopts:any - */ - -#define IPV4_OPT_ANY 0xff - -/** - * \struct DetectIpOptss_ - * DetectIpOptss_ is used to store supported iptops values - */ - -struct DetectIpOptss_ { - char *ipopt_name; /**< Ip option name */ - uint8_t code; /**< Ip option value */ -} DIpOpts[] = { - { "rr", IPV4_OPT_RR, }, - { "lsrr", IPV4_OPT_LSRR, }, - { "eol", IPV4_OPT_EOL, }, - { "nop", IPV4_OPT_NOP, }, - { "ts", IPV4_OPT_TS, }, - { "sec", IPV4_OPT_SEC, }, - { "ssrr", IPV4_OPT_SSRR, }, - { "satid", IPV4_OPT_SID, }, - { "any", IPV4_OPT_ANY, }, - { NULL, 0 }, -}; -#endif /* DETECT_EVENTS */ #endif /*__DETECT_IPOPTS_H__ */