-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lua dataset/v6 #12090
base: master
Are you sure you want to change the base?
Lua dataset/v6 #12090
Conversation
Only useful when debugging. Add a prefix and a stack size indication.
Add optional `thread_init` function support. This function is called per script, per thread to allow a user to initialize the lua state.
dataset.get_ref gets a reference to an existing dataset dataset.add returns 1 if a new entry was added returns 0 if entry was already in the set Example: ``` function init (args) local needs = {} needs["packet"] = tostring(true) return needs end function thread_init (args) conn_new, err = dataset.get_ref("conn-seen") if err ~= nil then SCLogWarning("dataset warning: " .. err) return 0 end end function match (args) ipver, srcip, dstip, proto, sp, dp = SCFlowTuple() str = ipver .. ":<" .. srcip .. ">:<" .. dstip .. ">:" .. dp ret, err = dataset.add(conn_new, str, #str); if ret == 1 then SCLogInfo(str .. " => " .. ret) end return ret end ``` Ticket: OISF#7243.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #12090 +/- ##
==========================================
+ Coverage 83.25% 83.28% +0.02%
==========================================
Files 910 910
Lines 257571 257624 +53
==========================================
+ Hits 214450 214559 +109
+ Misses 43121 43065 -56
Flags with carried forward coverage won't be shown. Click here to find out more. |
Information: QA ran without warnings. Pipeline 23255 |
Passed my QA. Ran this PR with SV PR OISF/suricata-verify#2120. Local pipeline 5131, run 627. |
return 1; | ||
} | ||
|
||
static int LuaDatasetAdd(lua_State *luastate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to this function: OISF/suricata-verify#2120 (comment)
Initial dataset support for lua.
https://redmine.openinfosecfoundation.org/issues/7243
SV_BRANCH=OISF/suricata-verify#2120