LuajitRegisterExtensions(t->luastate);
+ lua_pushinteger(t->luastate, (lua_Integer)(luajit->sid));
+ lua_setglobal(t->luastate, "SCRuleSid");
+ lua_pushinteger(t->luastate, (lua_Integer)(luajit->rev));
+ lua_setglobal(t->luastate, "SCRuleRev");
+ lua_pushinteger(t->luastate, (lua_Integer)(luajit->gid));
+ lua_setglobal(t->luastate, "SCRuleGid");
+
/* hackish, needed to allow unittests to pass buffers as scripts instead of files */
#ifdef UNITTESTS
if (ut_script != NULL) {
return -1;
}
+/** \brief post-sig parse function to set the sid,rev,gid into the
+ * ctx, as this isn't available yet during parsing.
+ */
+void DetectLuajitPostSetup(Signature *s) {
+ int i;
+ SigMatch *sm;
+
+ for (i = 0; i < DETECT_SM_LIST_MAX; i++) {
+ for (sm = s->sm_lists[i]; sm != NULL; sm = sm->next) {
+ if (sm->type != DETECT_LUAJIT)
+ continue;
+
+ DetectLuajitData *ld = sm->ctx;
+ ld->sid = s->id;
+ ld->rev = s->rev;
+ ld->gid = s->gid;
+ }
+ }
+}
+
/**
* \brief this function will free memory associated with DetectLuajitData
*
uint16_t flowints;
uint16_t flowvar[DETECT_LUAJIT_MAX_FLOWVARS];
uint16_t flowvars;
+ uint32_t sid;
+ uint32_t rev;
+ uint32_t gid;
} DetectLuajitData;
#endif
Flow *f, int need_flow_lock);
int DetectLuajitSetupStatesPool(int num, int reloads);
+void DetectLuajitPostSetup(Signature *s);
#endif /* __DETECT_FILELUAJIT_H__ */
#include "detect-flow.h"
#include "detect-app-layer-protocol.h"
#include "detect-engine-apt-event.h"
+#include "detect-luajit.h"
#include "pkt-var.h"
#include "host.h"
}
}
+#ifdef HAVE_LUAJIT
+ DetectLuajitPostSetup(s);
+#endif
+
#ifdef DEBUG
int i;
for (i = 0; i < DETECT_SM_LIST_MAX; i++) {