mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Implements l7_proto as filter for flow user scripts
This commit is contained in:
parent
b07f657b26
commit
c0ee292530
2 changed files with 13 additions and 6 deletions
|
|
@ -84,7 +84,7 @@ local available_subdirs = {
|
|||
-- User script execution filters (field names are those that arrive from the C Flow.cpp)
|
||||
filter = {
|
||||
-- Default fields populated automatically when creating filters
|
||||
default_fields = {"srv_addr", "srv_port"},
|
||||
default_fields = {"srv_addr", "srv_port", "l7_proto"},
|
||||
-- All possible filter fields
|
||||
available_fields = {
|
||||
cli_addr = {
|
||||
|
|
@ -103,10 +103,17 @@ local available_subdirs = {
|
|||
lint = http_lint.validatePort,
|
||||
match = function(context, val) return flow.getServerPort() == tonumber(val) end
|
||||
},
|
||||
-- l7_proto = {
|
||||
-- lint = http_lint.validateProtocolIdOrName,
|
||||
-- match = function(context, val) return flow.getServerPort() end
|
||||
-- }
|
||||
l7_proto = {
|
||||
lint = http_lint.validateProtocolIdOrName,
|
||||
match = function(context, val)
|
||||
-- If val is the protocol name, then it is converted to protocol id
|
||||
if not tonumber(val) then val = interface.getnDPIProtoId(val) end
|
||||
-- For integers represented as strings
|
||||
val = tonumber(val)
|
||||
-- Check for equality on either the master or application protocol
|
||||
return flow.getnDPIMasterProtoId() == val or flow.getnDPIAppProtoId() == val
|
||||
end
|
||||
}
|
||||
-- proto = http_lint.validateProtocolIdOrName,
|
||||
-- info = http_lint.validateUnquoted,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue