aboutsummaryrefslogtreecommitdiff
path: root/net/nft-qos/files/nft-qos-dynamic.hotplug
blob: b81fa94a892882b9dd1d956ecefa54a085ff1296 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
#
# Copyright 2018 rosysong@rosinson.com
#

export initscript="nft-qos-dynamic"

. /lib/functions.sh
. /lib/nft-qos/core.sh
. /lib/nft-qos/dynamic.sh

NFT_QOS_DYNAMIC_ON=

qosdef_check_if_dynamic() {
	[ $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_dynamic default qosdef_check_if_dynamic
		[ -z "$NFT_QOS_DYNAMIC_ON" ] && return

		qosdef_init_env
		qosdef_flush_dynamic

		qosdef_init_header
		qosdef_validate_dynamic default qosdef_init_dynamic
		qosdef_init_done
		qosdef_start
		;;
esac