This patch makes it possible to configure and limit per-client internet speed based on MAC address and it can work with SQM. This feature is what OpenWRT currently lacks. This patch is largely based on static.sh and the configuration file is similar to original nft-qos. New configuration options and examples are listed below config default 'default' option limit_mac_enable '1' config client option drunit 'kbytes' option urunit 'kbytes' option hostname 'tv-box' option macaddr 'AB:CD:EF:01:23:45' option drate '1000' option urate '50' config client option drunit 'kbytes' option urunit 'kbytes' option hostname 'my-pc' option macaddr 'AB:CD:EF:01:23:46' option drate '3000' option urate '2000' limit_mac_enable - enable rate limit based on MAC address drunit - download rate unit urunit - upload rate unit macaddr - client MAC address drate - download rate urate - upload rate Signed-off-by: Tong Zhang <ztong0001@gmail.com>
52 lines
990 B
Bash
Executable file
52 lines
990 B
Bash
Executable file
#!/bin/sh /etc/rc.common
|
|
#
|
|
# Copyright (C) 2018 rosysong@rosinson.com
|
|
#
|
|
|
|
. /lib/nft-qos/core.sh
|
|
. /lib/nft-qos/monitor.sh
|
|
. /lib/nft-qos/dynamic.sh
|
|
. /lib/nft-qos/static.sh
|
|
. /lib/nft-qos/mac.sh
|
|
. /lib/nft-qos/priority.sh
|
|
|
|
START=99
|
|
USE_PROCD=1
|
|
|
|
service_triggers() {
|
|
procd_add_reload_trigger nft-qos
|
|
|
|
procd_open_validate
|
|
qosdef_validate_dynamic
|
|
qosdef_validate_static
|
|
qosdef_validate_priority
|
|
qosdef_validate_mac
|
|
procd_close_validate
|
|
}
|
|
|
|
start_service() {
|
|
config_load nft-qos
|
|
|
|
qosdef_init_env
|
|
qosdef_flush_mac
|
|
qosdef_flush_static
|
|
qosdef_flush_dynamic
|
|
qosdef_remove_priority
|
|
|
|
qosdef_init_header
|
|
qosdef_init_monitor
|
|
qosdef_validate_dynamic default qosdef_init_dynamic
|
|
qosdef_validate_static default qosdef_init_static
|
|
qosdef_validate_mac default qosdef_init_mac
|
|
qosdef_validate_priority default qosdef_init_priority
|
|
qosdef_init_done
|
|
qosdef_start
|
|
}
|
|
|
|
stop_service() {
|
|
qosdef_flush_dynamic
|
|
qosdef_flush_static
|
|
qosdef_flush_mac
|
|
qosdef_remove_priority
|
|
qosdef_clean_cache
|
|
}
|