luci app nft qos: bump to new version

This commit is contained in:
coolsnowwolf 2019-05-12 15:54:43 +08:00
parent 2bbdf6527c
commit aee3fbbcd0
9 changed files with 294 additions and 43 deletions

View File

@ -8,6 +8,9 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=Qos over Nftables
LUCI_DEPENDS:=+nft-qos
LUCI_PKGARCH:=all
PKG_VERSION:=1.0
PKG_RELEASE:=2
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -0,0 +1,241 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.2.1\n"
"Last-Translator: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: es\n"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:136
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:155
msgid "Bytes Total"
msgstr "Total de bytes"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:141
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:160
msgid "Collecting data..."
msgstr "Recolectando datos..."
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:224
msgid "Comment"
msgstr "Comentario"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:48
msgid "Default Download Rate"
msgstr "Velocidad de descarga predeterminada"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:53
msgid "Default Download Unit"
msgstr "Unidad de descarga predeterminada"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:107
msgid "Default Network Interface"
msgstr "Interfaz de red predeterminada"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:60
msgid "Default Upload Rate"
msgstr "Velocidad de carga predeterminada"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:65
msgid "Default Upload Unit"
msgstr "Unidad de carga predeterminada"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:53
msgid "Default unit for download rate"
msgstr "Unidad predeterminada para la velocidad de descarga"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:65
msgid "Default unit for upload rate"
msgstr "Unidad predeterminada para la velocidad de carga"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:75
msgid "Default value for download bandwidth"
msgstr "Valor predeterminado para el ancho de banda de descarga"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:48
msgid "Default value for download rate"
msgstr "Valor predeterminado para la velocidad de descarga"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:80
msgid "Default value for upload bandwidth"
msgstr "Valor predeterminado para el ancho de banda de carga"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:60
msgid "Default value for upload rate"
msgstr "Valor predeterminado para la velocidad de carga"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:75
msgid "Download Bandwidth (Mbps)"
msgstr "Ancho de banda de descarga (Mbps)"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:135
msgid "Download Rate"
msgstr "Velocidad de descarga"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:38
msgid "Enable Limit Rate Feature"
msgstr "Habilitar función de límite de velocidad"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:103
msgid "Enable Traffic Priority"
msgstr "Habilitar prioridad de tráfico"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:103
msgid "Enable this feature"
msgstr "Habilitar esta característica"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:121
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:158
msgid "Hostname"
msgstr "Nombre de host"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:134
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:153
msgid "IP Address"
msgstr "Dirección IP"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:126
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:163
msgid "IP Address(V4 / V6)"
msgstr "Dirección IP (v4/v6)"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:128
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:165
msgid "IP Address(V4 Only)"
msgstr "Dirección IP (sólo v4)"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:38
msgid "Limit Enable"
msgstr "Habilitar límite"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:42
msgid "Limit Type"
msgstr "Tipo de límite"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:135
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:172
msgid "MAC (optional)"
msgstr "MAC (opcional)"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:48
msgid "MB"
msgstr "MB"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:28
msgid "NFT-QoS Settings"
msgstr "Configuración de NFT-QoS"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:107
msgid "Network Interface for Traffic Shaping, e.g. br-lan, eth0.1, eth0, etc"
msgstr "Interfaz de red para configuración de tráfico, por ejemplo, br-lan, eth0.1, eth0, etc."
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:85
msgid "Network to be apply, e.g. 192.168.1.0/24, 10.2.0.0/16, etc"
msgstr "Red a aplicar, por ejemplo. 192.168.1.0/24, 10.2.0.0/16, etc."
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:91
msgid "Network to be apply, e.g. AAAA::BBBB/64, CCCC::1/128, etc"
msgstr "Red a aplicar, por ejemplo. AAAA::BBBB/64, CCCC::1/128, etc."
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:65
msgid "No information available"
msgstr "No hay información disponible"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:137
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:156
msgid "Packets Total"
msgstr "Paquetes totales"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:207
msgid "Priority"
msgstr "Prioridad"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:199
msgid "Protocol"
msgstr "Protocolo"
#: applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua:16
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:23
msgid "Qos over Nftables"
msgstr "Qos sobre Nftables"
#: applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua:12
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:139
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:176
msgid "Rate"
msgstr "Velocidad"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:130
msgid "Realtime Download Rate"
msgstr "Velocidad de descarga en tiempo real"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:125
msgid "Realtime Rate"
msgstr "Velocidad en tiempo real"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:149
msgid "Realtime Upload Rate"
msgstr "Velocidad de carga en tiempo real"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:221
msgid "Service"
msgstr "Servicio"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:116
msgid "Static QoS-Download Rate"
msgstr "Velocidad de descarga de QoS estática"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:153
msgid "Static QoS-Upload Rate"
msgstr "Velocidad de carga de QoS estática"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:85
msgid "Target Network (IPv4/MASK)"
msgstr "Red de destino (IPv4 / MASK)"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:91
msgid "Target Network6 (IPv6/MASK)"
msgstr "Red de destino 6 (IPv6/MÁSCARA)"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:127
msgid "This page gives an overview over currently download/upload rate."
msgstr "Esta página ofrece una vista general sobre la velocidad de descarga/carga actual."
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:194
msgid "Traffic Priority Settings"
msgstr "Ajustes de prioridad de tráfico"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:42
msgid "Type of Limit Rate"
msgstr "Tipo de límite de velocidad"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:144
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:181
msgid "Unit"
msgstr "Unidad"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:80
msgid "Upload Bandwidth (Mbps)"
msgstr "Ancho de banda de carga (Mbps)"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:154
msgid "Upload Rate"
msgstr "Velocidad de carga"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:96
msgid "White List for Limit Rate"
msgstr "Lista blanca para el límite de velocidad"
#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:221
msgid "e.g. https, 23, (separator is comma)"
msgstr "p.ej. https, 23, (el separador es una coma)"
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:44
msgid "kB"
msgstr "kB"

View File

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nft-qos
PKG_VERSION:=1.0.4
PKG_VERSION:=1.0.6
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
@ -23,6 +23,7 @@ define Package/nft-qos
CATEGORY:=Base system
DEPENDS:=+nftables +kmod-nft-netdev +kmod-nft-bridge
TITLE:=QoS scripts over nftables
PKGARCH:=all
endef
define Package/nft-qos/description

View File

@ -5,6 +5,14 @@
. /lib/nft-qos/core.sh
qosdef_validate_dynamic() {
uci_load_validate nft-qos default "$1" "$2" \
'limit_enable:bool:0' \
'limit_type:maxlength(8)' \
'dynamic_bw_up:uinteger:100' \
'dynamic_bw_down:uinteger:100'
}
# return average rate for dhcp leases
qosdef_dynamic_rate() { # <bandwidth>
local c=0 c6=0
@ -55,16 +63,9 @@ qosdef_flush_dynamic() {
# init dynamic qos
qosdef_init_dynamic() {
local dynamic_bw_up dynamic_bw_down limit_enable limit_type
local hook_ul="prerouting" hook_dl="postrouting"
uci_validate_section nft-qos default default \
'limit_enable:bool:0' \
'limit_type:maxlength(8)' \
'dynamic_bw_up:uinteger:100' \
'dynamic_bw_down:uinteger:100'
[ $? -ne 0 ] && {
[ "$2" = 0 ] || {
logger -t nft-qos-dynamic "validation failed"
return 1
}

View File

@ -9,6 +9,12 @@
P1=""; P2=""; P3=""; P4=""; P5=""; P6="";
P7=""; P8=""; P9=""; P10=""; P11="";
qosdef_validate_priority() {
uci_load_validate nft-qos default "$1" "$2" \
'priority_enable:bool:0' \
'priority_netdev:maxlength(8)'
}
_qosdef_handle_protox() { # <priority> <rule>
case "$1" in
-400) P1="$P1""$2";;
@ -61,13 +67,9 @@ qosdef_remove_priority() {
# init traffic priority
qosdef_init_priority() {
local priority_enable priority_netdev ifname="br-lan"
local ifname="br-lan"
uci_validate_section nft-qos default default \
'priority_enable:bool:0' \
'priority_netdev:maxlength(8)'
[ $? -ne 0 ] && {
[ "$2" = 0 ] || {
logger -t nft-qos-priority "validation failed"
return 1
}
@ -82,6 +84,7 @@ qosdef_init_priority() {
;;
wan*) network_get_device ifname "$priority_netdev" || \
ifname="$(uci_get network.$priority_netdev.ifname)"
;;
esac
qosdef_appendx "table netdev nft-qos-priority {\n"

View File

@ -5,6 +5,16 @@
. /lib/nft-qos/core.sh
qosdef_validate_static() {
uci_load_validate nft-qos default "$1" "$2" \
'limit_enable:bool:0' \
'limit_type:maxlength(8)' \
'static_unit_dl:string:kbytes' \
'static_unit_ul:string:kbytes' \
'static_rate_dl:uinteger:50' \
'static_rate_ul:uinteger:50'
}
# append rule for static qos
qosdef_append_rule_sta() { # <section> <operator> <default-unit> <default-rate>
local ipaddr unit rate
@ -42,18 +52,9 @@ qosdef_flush_static() {
# static limit rate init
qosdef_init_static() {
local unit_dl unit_ul rate_dl rate_ul
local limit_enable limit_type hook_ul="prerouting" hook_dl="postrouting"
local hook_ul="prerouting" hook_dl="postrouting"
uci_validate_section nft-qos default default \
'limit_enable:bool:0' \
'limit_type:maxlength(8)' \
'static_unit_dl:string:kbytes' \
'static_unit_ul:string:kbytes' \
'static_rate_dl:uinteger:50' \
'static_rate_ul:uinteger:50'
[ $? -ne 0 ] && {
[ "$2" = 0 ] || {
logger -t nft-qos-static "validation failed"
return 1
}
@ -67,7 +68,7 @@ qosdef_init_static() {
}
qosdef_appendx "table $NFT_QOS_INET_FAMILY nft-qos-static {\n"
qosdef_append_chain_sta $hook_ul upload upload $unit_ul $rate_ul
qosdef_append_chain_sta $hook_dl download download $unit_dl $rate_dl
qosdef_append_chain_sta $hook_ul upload upload $static_unit_ul $static_rate_ul
qosdef_append_chain_sta $hook_dl download download $static_unit_dl $static_rate_dl
qosdef_appendx "}\n"
}

View File

@ -11,13 +11,7 @@ export initscript="nft-qos-dynamic"
NFT_QOS_DYNAMIC_ON=
qosdef_validate_section_dynamic() {
local limit_enable limit_type
uci_validate_section nft-qos default default \
'limit_enable:bool:0' \
'limit_type:maxlength(8)'
qosdef_check_if_dynamic() {
[ $limit_enable -eq 1 -a \
"$limit_type" = "dynamic" ] && \
NFT_QOS_DYNAMIC_ON="y"
@ -28,14 +22,14 @@ logger -t nft-qos-dynamic "ACTION=$ACTION, MACADDR=$MACADDR, IPADDR=$IPADDR, HOS
case "$ACTION" in
add | update | remove)
qosdef_validate_section_dynamic
qosdef_validate_dynamic default qosdef_check_if_dynamic
[ -z "$NFT_QOS_DYNAMIC_ON" ] && return
qosdef_init_env
qosdef_flush_dynamic
qosdef_init_header
qosdef_init_dynamic
qosdef_validate_dynamic default qosdef_init_dynamic
qosdef_init_done
qosdef_start
;;

View File

@ -26,7 +26,7 @@
config default default
# Enable Flag for limit rate
option limit_enable '1'
option limit_enable '0'
# Options for enable Static QoS (rate limit)
option limit_type 'static'
@ -77,8 +77,9 @@ config default default
# Traffic Priority Samples :
#
# protocol : tcp, udp, udplite, sctp, dccp, tcp is default
# priority : integer between 1-11, 1 is default
# service : you can input a integer or service name, e.g. '22', '11-22', 'telnet', 'ssh, http, ftp', etc
# priority : integer between 1-11, 1 is default and the highest
# service : you can input a integer or service name,
# e.g. '22', '11-22', 'telnet', 'ssh, http, ftp', etc
#
#config priority
# option protocol 'tcp'

View File

@ -14,6 +14,12 @@ USE_PROCD=1
service_triggers() {
procd_add_reload_trigger nft-qos
procd_open_validate
qosdef_validate_dynamic
qosdef_validate_static
qosdef_validate_priority
procd_close_validate
}
start_service() {
@ -26,9 +32,9 @@ start_service() {
qosdef_init_header
qosdef_init_monitor
qosdef_init_dynamic
qosdef_init_static
qosdef_init_priority
qosdef_validate_dynamic default qosdef_init_dynamic
qosdef_validate_static default qosdef_init_static
qosdef_validate_priority default qosdef_init_priority
qosdef_init_done
qosdef_start
}