mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
nft-qos: add new package
This is the nftables implementation for qos on OpenWrt, Currently, it has below features: * Static QoS : setting limit rate for devices or global network. * Dynamic/Auto QoS : setting limit rate according to the network bandwidth and adjust itself automatically (hotplug event). * Traffic Priority : this feature is like traffic shaping under tc, it uses ingress hook to handle to packets here. Signed-off-by: Rosy Song <rosysong@rosinson.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2018 rosysong@rosinson.com
|
||||
#
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/nft-qos/core.sh
|
||||
. /lib/nft-qos/dynamic.sh
|
||||
|
||||
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)'
|
||||
|
||||
[ $limit_enable -eq 1 -a \
|
||||
"$limit_type" = "dynamic" ] && \
|
||||
NFT_QOS_DYNAMIC_ON="y"
|
||||
}
|
||||
|
||||
|
||||
logger -t nft-qos-dynamic "ACTION=$ACTION, MACADDR=$MACADDR, IPADDR=$IPADDR, HOSTNAME=$HOSTNAME"
|
||||
|
||||
case "$ACTION" in
|
||||
add | update | remove)
|
||||
qosdef_validate_section_dynamic
|
||||
[ -z "$NFT_QOS_DYNAMIC_ON" ] && return
|
||||
|
||||
qosdef_init_env
|
||||
qosdef_flush_dynamic
|
||||
|
||||
qosdef_init_header
|
||||
qosdef_init_dynamic
|
||||
qosdef_init_done
|
||||
qosdef_start
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user