mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Accept CIDR in IP filters
This commit is contained in:
parent
fb160d1b85
commit
363b48d7ae
2 changed files with 15 additions and 5 deletions
|
|
@ -179,7 +179,9 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
function isIPv4Network(address)
|
||||
-- Check if address is a CIDR
|
||||
-- strict (optional) do not accept subnets without the '/<mask>'
|
||||
function isIPv4Network(address, strict)
|
||||
-- Check for @ VLAN
|
||||
local parts = split(address, "@")
|
||||
if #parts == 2 then
|
||||
|
|
@ -195,6 +197,9 @@ function isIPv4Network(address)
|
|||
return false
|
||||
end
|
||||
|
||||
elseif #parts == 1 and strict then
|
||||
return false
|
||||
|
||||
-- Check empty
|
||||
elseif #parts ~= 1 then
|
||||
return false
|
||||
|
|
@ -206,7 +211,9 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
function isIPv6Network(address)
|
||||
-- Check if address is a CIDR
|
||||
-- strict (optional) do not accept subnets without the '/<mask>'
|
||||
function isIPv6Network(address, strict)
|
||||
-- Check for @ VLAN
|
||||
local parts = split(address, "@")
|
||||
if #parts == 2 then
|
||||
|
|
@ -222,6 +229,9 @@ function isIPv6Network(address)
|
|||
return false
|
||||
end
|
||||
|
||||
elseif #parts == 1 and strict then
|
||||
return false
|
||||
|
||||
-- Check empty
|
||||
elseif #parts ~= 1 then
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -74,19 +74,19 @@ tag_utils.defined_tags = {
|
|||
operators = {'eq','neq'},
|
||||
},
|
||||
ip = {
|
||||
value_type = 'ip',
|
||||
value_type = 'cidr', -- Set to 'ip' to accept IP only
|
||||
i18n_label = i18n('db_search.tags.ip'),
|
||||
operators = {'eq', 'neq'},
|
||||
bpf_key = 'ip host',
|
||||
},
|
||||
cli_ip = {
|
||||
value_type = 'ip',
|
||||
value_type = 'cidr', -- Set to 'ip' to accept IP only
|
||||
i18n_label = i18n('db_search.tags.cli_ip'),
|
||||
operators = {'eq', 'neq'},
|
||||
bpf_key = 'ip host',
|
||||
},
|
||||
srv_ip = {
|
||||
value_type = 'ip',
|
||||
value_type = 'cidr', -- Set to 'ip' to accept IP only
|
||||
i18n_label = i18n('db_search.tags.srv_ip'),
|
||||
operators = {'eq', 'neq'},
|
||||
bpf_key = 'ip host',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue