mirror of
https://github.com/openwrt/packages.git
synced 2025-12-21 23:34:31 +04:00
snort3: clean up ucode usage
- Add missing 'ucode' package dependency - Proto-ify the ConfigItem objects - Fix indentation and tab usage Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
This commit is contained in:
committed by
Tianling Shen
parent
aec4766913
commit
db58c9cd81
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=snort3
|
PKG_NAME:=snort3
|
||||||
PKG_VERSION:=3.1.78.0
|
PKG_VERSION:=3.1.78.0
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=4
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://github.com/snort3/snort3/archive/refs/tags/
|
PKG_SOURCE_URL:=https://github.com/snort3/snort3/archive/refs/tags/
|
||||||
@@ -25,7 +25,8 @@ define Package/snort3
|
|||||||
SUBMENU:=Firewall
|
SUBMENU:=Firewall
|
||||||
SECTION:=net
|
SECTION:=net
|
||||||
CATEGORY:=Network
|
CATEGORY:=Network
|
||||||
DEPENDS:=+libstdcpp +libdaq3 +libdnet +libopenssl +libpcap +libpcre +libpthread +libuuid +zlib +libhwloc +libtirpc @HAS_LUAJIT_ARCH +luajit +libatomic +kmod-nft-queue +liblzma
|
DEPENDS:=+libstdcpp +libdaq3 +libdnet +libopenssl +libpcap +libpcre +libpthread +libuuid +zlib +libhwloc +libtirpc @HAS_LUAJIT_ARCH +luajit +libatomic +kmod-nft-queue +liblzma \
|
||||||
|
+ucode +ucode-mod-fs +ucode-mod-uci
|
||||||
TITLE:=Lightweight Network Intrusion Detection System
|
TITLE:=Lightweight Network Intrusion Detection System
|
||||||
URL:=http://www.snort.org/
|
URL:=http://www.snort.org/
|
||||||
MENU:=1
|
MENU:=1
|
||||||
|
|||||||
@@ -30,15 +30,46 @@ function wrn(fmt, ...args) {
|
|||||||
|
|
||||||
function rpad(str, fill, len)
|
function rpad(str, fill, len)
|
||||||
{
|
{
|
||||||
str = rtrim(str) + ' ';
|
str = rtrim(str) + ' ';
|
||||||
while (length(str) < len) {
|
while (length(str) < len) {
|
||||||
str += fill;
|
str += fill;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const ConfigItem = {
|
||||||
|
contains: function(value) {
|
||||||
|
// Check if the value is contained in the listed values,
|
||||||
|
// depending on the item type.
|
||||||
|
switch (this.type) {
|
||||||
|
case "enum":
|
||||||
|
return value in this.values;
|
||||||
|
case "range":
|
||||||
|
return value >= this.values[0] && value <= this.values[1];
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
allowed: function() {
|
||||||
|
// Show a pretty version of the possible values, for error messages.
|
||||||
|
switch (this.type) {
|
||||||
|
case "enum":
|
||||||
|
return "one of [" + join(", ", this.values) + "]";
|
||||||
|
case "range":
|
||||||
|
return `${this.values[0]} <= x <= ${this.values[1]}`;
|
||||||
|
case "path":
|
||||||
|
return "a path string";
|
||||||
|
case "str":
|
||||||
|
return "a string";
|
||||||
|
default:
|
||||||
|
return "???";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
function config_item(type, values, def) {
|
function config_item(type, values, def) {
|
||||||
// If no default value is provided explicity, then values[0] is used as default.
|
// If no default value is provided explicity, then values[0] is used as default.
|
||||||
if (! type in [ "enum", "range", "path", "str" ]) {
|
if (! type in [ "enum", "range", "path", "str" ]) {
|
||||||
@@ -49,42 +80,13 @@ function config_item(type, values, def) {
|
|||||||
wrn(`A 'range' type item must have exactly 2 values in ascending order.`);
|
wrn(`A 'range' type item must have exactly 2 values in ascending order.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Maybe check paths for existence???
|
// Maybe check 'path' values for existence???
|
||||||
|
|
||||||
return {
|
return proto({
|
||||||
type: type,
|
type: type,
|
||||||
values: values,
|
values: values,
|
||||||
default: def ?? values[0],
|
default: def ?? values[0],
|
||||||
|
}, ConfigItem);
|
||||||
contains: function(value) {
|
|
||||||
// Check if the value is contained in the listed values,
|
|
||||||
// depending on the item type.
|
|
||||||
switch (this.type) {
|
|
||||||
case "enum":
|
|
||||||
return value in this.values;
|
|
||||||
case "range":
|
|
||||||
return value >= this.values[0] && value <= this.values[1];
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
allowed: function() {
|
|
||||||
// Show a pretty version of the possible values, for error messages.
|
|
||||||
switch (this.type) {
|
|
||||||
case "enum":
|
|
||||||
return "one of [" + join(", ", this.values) + "]";
|
|
||||||
case "range":
|
|
||||||
return `${this.values[0]} <= x <= ${this.values[1]}`;
|
|
||||||
case "path":
|
|
||||||
return "a path string";
|
|
||||||
case "str":
|
|
||||||
return "a string";
|
|
||||||
default:
|
|
||||||
return "???";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const snort_config = {
|
const snort_config = {
|
||||||
|
|||||||
Reference in New Issue
Block a user