packages/net/nft-qos/Makefile
Tong Zhang 0483b8dc88 nft-qos: support mac address based speed limit
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>
2020-08-19 09:39:57 -04:00

59 lines
1.4 KiB
Makefile

#
# Copyright (C) 2018 rosysong@rosinson.com
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=nft-qos
PKG_VERSION:=1.0.6
PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Rosy Song <rosysong@rosinson.com>
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/nft-qos
SECTION:=utils
CATEGORY:=Base system
DEPENDS:=+kmod-nft-netdev +kmod-nft-bridge +nftables
TITLE:=QoS scripts over nftables
PKGARCH:=all
endef
define Package/nft-qos/description
This package provides implementation for qos over nftables.
Currently, static/dynamic qos and traffic shaping are supported.
endef
define Package/nft-qos/conffiles
/etc/config/nft-qos
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/nft-qos/install
$(INSTALL_DIR) $(1)/lib/nft-qos
$(INSTALL_DATA) ./files/lib/* $(1)/lib/nft-qos/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/nft-qos.config $(1)/etc/config/nft-qos
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/nft-qos.init $(1)/etc/init.d/nft-qos
$(INSTALL_DIR) $(1)/etc/hotplug.d/dhcp
$(INSTALL_BIN) ./files/nft-qos-monitor.hotplug $(1)/etc/hotplug.d/dhcp/00-nft-qos-monitor
$(INSTALL_BIN) ./files/nft-qos-dynamic.hotplug $(1)/etc/hotplug.d/dhcp/01-nft-qos-dynamic
endef
$(eval $(call BuildPackage,nft-qos))