-- changed --help to give overview of help
-- fixed stream_ip alerts (defrag -> stream_ip)
-- added missing help to parameters
+-- pulled in latest from Josh
+-- added Flow* to StreamSplitter::reassemble()
108
-- added IpsAction for ips rule action plugins
# initialization
#--------------------------------------------------------------------------
-AC_INIT([snort], [2.10.108])
+AC_INIT([snort], [2.10.109])
AC_PREREQ([2.68])
AC_CONFIG_SRCDIR([src/main.h])
// note: you can NOT do ss.str().c_str() here
const string& rule = ss.str();
- ParseConfigString(sc, rule.c_str(), true);
+ ParseConfigString(sc, rule.c_str());
r++;
}
unsigned i, sz = bindings.size();
Port port = (p->packet_flags & PKT_FROM_CLIENT) ? p->dp : p->sp;
- uint16_t vlan = vlan::vth_vlan(layer::get_vlan_layer(p));
for ( i = 0; i < sz; i++ )
{
#define RULE_OPT__METADATA "metadata"
#define RULE_OPT__PRIORITY "priority"
#define RULE_OPT__REFERENCE "reference"
+#define RULE_OPT__REM "rem"
#define RULE_OPT__REVISION "rev"
#define RULE_OPT__SID "sid"
#define RULE_OPT__SOID "soid"
++loc.line;
}
-static bool s_parse_rules = false;
static void ParseTheConf(SnortConfig*, const char* fname);
-/* Used to determine whether or not to parse the keyword line based on
- * whether or not we're parsing rules */
-typedef enum _KeywordType
-{
- KEYWORD_TYPE__MAIN,
- KEYWORD_TYPE__RULE,
- KEYWORD_TYPE__ALL
-
-} KeywordType;
-
typedef void (*ParseFunc)(SnortConfig *, const char *);
-typedef struct _KeywordFunc
+struct KeywordFunc
{
const char *name;
- KeywordType type;
int expand_vars;
int default_policy_only;
ParseFunc parse_func;
-} KeywordFunc;
+};
// only keep drop rules ...
// if we are inline (and can actually drop),
}
}
-static void ParseFile(SnortConfig *sc, const char *args)
-{
- parse_file_rule(args, &(sc->file_config));
-}
-
static const KeywordFunc snort_conf_keywords[] =
{
// this stuff is expected to remain since rules don't fit in Lua tables
// nested rules files
// however, these must become pluggable ...
- { ACTION_ALERT, KEYWORD_TYPE__RULE, 0, 0, ParseAlert },
- { ACTION_DROP, KEYWORD_TYPE__RULE, 0, 0, ParseDrop },
- { ACTION_BLOCK, KEYWORD_TYPE__RULE, 0, 0, ParseDrop },
- { ACTION_LOG, KEYWORD_TYPE__RULE, 0, 0, ParseLog },
- { ACTION_PASS, KEYWORD_TYPE__RULE, 0, 0, ParsePass },
- { ACTION_REJECT, KEYWORD_TYPE__RULE, 0, 0, ParseReject },
- { ACTION_SDROP, KEYWORD_TYPE__RULE, 0, 0, ParseSdrop },
- { ACTION_SBLOCK, KEYWORD_TYPE__RULE, 0, 0, ParseSdrop },
-
- { SNORT_CONF_KEYWORD__FILE, KEYWORD_TYPE__MAIN, 0, 1, ParseFile },
- { SNORT_CONF_KEYWORD__INCLUDE, KEYWORD_TYPE__ALL, 1, 0, ParseInclude },
-
-#if 0
- // this needs to be turned into an action plugin
- // the special case parsing got in the way refactoring for Lua
- // so it's toast - here for reference only
-
- /* Special parsing case is ruletype. Need to send the file pointer so
- * it can parse what's between '{' and '}' which can span multiple
- * lines without a line continuation character */
- { SNORT_CONF_KEYWORD__RULE_TYPE, KEYWORD_TYPE__ALL, 1, 0, ParseRuleTypeDeclaration },
-#endif
-
- { NULL, KEYWORD_TYPE__ALL, 0, 0, NULL } /* Marks end of array */
+ { ACTION_ALERT, 0, 0, ParseAlert },
+ { ACTION_DROP, 0, 0, ParseDrop },
+ { ACTION_BLOCK, 0, 0, ParseDrop },
+ { ACTION_LOG, 0, 0, ParseLog },
+ { ACTION_PASS, 0, 0, ParsePass },
+ { ACTION_REJECT, 0, 0, ParseReject },
+ { ACTION_SDROP, 0, 0, ParseSdrop },
+ { ACTION_SBLOCK, 0, 0, ParseSdrop },
+
+ { SNORT_CONF_KEYWORD__INCLUDE, 1, 0, ParseInclude },
+
+ { NULL, 0, 0, NULL } // sentinel
};
static int ContinuationCheck(char *rule)
{
if (strcasecmp(keyword, snort_conf_keywords[i].name) == 0)
{
- if (((snort_conf_keywords[i].type == KEYWORD_TYPE__RULE) &&
- !s_parse_rules) ||
- ((snort_conf_keywords[i].type == KEYWORD_TYPE__MAIN) &&
- s_parse_rules))
- {
- break;
- }
-
if (snort_conf_keywords[i].expand_vars)
args = SnortStrdup(ExpandVars(sc, toks[1]));
/* Didn't find any pre-defined snort_conf_keywords. Look for a user defined
* rule type */
- if ((snort_conf_keywords[i].name == NULL) && s_parse_rules)
+ if ( (snort_conf_keywords[i].name == NULL) )
{
RuleListNode *node;
free(buf);
}
-void ParseConfigString(SnortConfig* sc, const char* s, bool parse_rules)
+void ParseConfigString(SnortConfig* sc, const char* s)
{
- s_parse_rules = parse_rules;
-
string rules = s;
stringstream ss(rules);
}
void ParseConfigFile(
- SnortConfig *sc, const char *fname, bool parse_rules)
+ SnortConfig *sc, const char *fname)
{
- s_parse_rules = parse_rules;
-
if ( fname )
ParseTheConf(sc, fname);
}
struct SnortConfig;
-void ParseConfigFile(SnortConfig*, const char* fname, bool do_rules);
-void ParseConfigString(SnortConfig*, const char* str, bool do_rules);
+void ParseConfigFile(SnortConfig*, const char* fname);
+void ParseConfigString(SnortConfig*, const char* str);
void AddRuleState(SnortConfig*, const RuleState&);
mSplitFree(&toks, num_toks);
}
+static void ParseOtnRem(
+ SnortConfig*, RuleTreeNode*,
+ OptTreeNode*, const char*)
+{
+}
+
static void ParseOtnRevision(
SnortConfig*, RuleTreeNode*,
OptTreeNode *otn, const char *args)
{ RULE_OPT__MSG, 1, 1, 0, ParseOtnMessage },
{ RULE_OPT__PRIORITY, 1, 1, 0, ParseOtnPriority },
{ RULE_OPT__REFERENCE, 1, 0, 0, ParseOtnReference },
+ { RULE_OPT__REM, 1, 1, 0, ParseOtnRem },
{ RULE_OPT__REVISION, 1, 1, 0, ParseOtnRevision },
{ RULE_OPT__SID, 1, 1, 0, ParseOtnSid },
{ RULE_OPT__SOID, 1, 1, 0, ParseOtnSoid },
if ( fname && *fname )
{
push_parse_location(fname);
- ParseConfigFile(sc, fname, true);
+ ParseConfigFile(sc, fname);
pop_parse_location();
}
if ( !p->rules.empty() )
{
push_parse_location("rules");
- ParseConfigString(sc, p->rules.c_str(), true);
+ ParseConfigString(sc, p->rules.c_str());
pop_parse_location();
}
}
return tmp;
}
-bool FtpClientModule::begin(const char*, int, SnortConfig*)
+bool FtpClientModule::begin(const char* fqn, int, SnortConfig*)
{
if ( !conf )
conf = new FTP_CLIENT_PROTO_CONF;
address.clear();
port = last_port = 0;
+
+ if ( !strcmp(fqn, "ftp_client.bounce_to") )
+ {
+ for ( auto p : bounce_to )
+ delete p;
+ }
return true;
}
/****************************************************************************
*
-** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved.
+ * Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved.
* Copyright (C) 2007-2013 Sourcefire, Inc.
*
* This program is free software; you can redistribute it and/or modify
return &p->ip6h->ip_src;
}
-sfip_t *orig_ip6_ret_src(const Packet *p)
+sfip_t *orig_ip6_ret_src(const Packet*)
{
VALIDATE(p, 1);
return nullptr;
-// return &p->orig_ip6h->ip_src;
+ //return &p->orig_ip6h->ip_src;
}
sfip_t *ip6_ret_dst(const Packet *p)
{ return 16384; } // FIXIT make default configurable
const StreamBuffer* StreamSplitter::reassemble(
- unsigned offset, const uint8_t* p, unsigned n, uint32_t flags, unsigned& copied)
+ Flow*, unsigned offset, const uint8_t* p,
+ unsigned n, uint32_t flags, unsigned& copied)
{
assert(offset + n < sizeof(pdu_buf));
memcpy(pdu_buf+offset, p, n);
PAF_START, // internal use only
PAF_SEARCH, // searching for next flush point
PAF_FLUSH, // flush at given offset
- PAF_BUILD, // reassemble to given offset
PAF_SKIP // skip ahead to given offset
};
) = 0;
virtual const StreamBuffer* reassemble(
+ Flow*,
unsigned offset, // data offset from start of reassembly
const uint8_t* data, // data to reassemble
unsigned len, // length of data
* flush the client seglist up to the most recently acked segment
*/
static int FlushStream(
- Packet*, StreamTracker *st, uint32_t toSeq, uint8_t *flushbuf,
+ Packet* p, StreamTracker *st, uint32_t toSeq, uint8_t *flushbuf,
const uint8_t *flushbuf_end)
{
uint16_t bytes_flushed = 0;
flags |= PKT_PDU_TAIL;
const StreamBuffer* sb = st->splitter->reassemble(
- bytes_flushed, ss->payload, bytes_to_copy, flags, bytes_copied);
+ p->flow, bytes_flushed, ss->payload, bytes_to_copy, flags, bytes_copied);
flags = 0;