mirror of https://github.com/OISF/suricata
detect: expose opaque SigMatch lookup to plugins and Rust
Add accessors so a keyword Setup callback can inspect earlier instances of its keyword in the signature being set up without depending on the Signature or SigMatch layout: - SCDetectSignatureGetLastSMByType: last SigMatch of a keyword in a list - SCSigMatchGetPrevByType: previous SigMatch of the same keyword - SCSigMatchGetCtx: the keyword context of a SigMatch This is what keywords like app-layer-protocol do to reject duplicate or conflicting options, by walking the match list directly. Plugins, and keywords implemented in Rust, can't do that as these types are opaque to them. The existing SCDetectGetLastSMFromLists is not a substitute as it ignores the packet match list once a sticky buffer is active in the rule, and gives no access to the context. The lookup is limited to the static lists from DetectSigmatchListEnum. A dynamic buffer list can have several instances in a signature, each with its own SigMatch chain, so the previous-SigMatch walk could not cover it, and DetectGetLastSMByListId would search every buffer rather than the requested one. Expose the new functions through the generated Rust bindings. Related to ticket: 7499pull/16454/head
parent
c92af11867
commit
c2d192db92
Loading…
Reference in New Issue