You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
757 B

  1. #!/bin/sh
  2. #
  3. # Copyright 2018 rosysong@rosinson.com
  4. #
  5. . /lib/functions.sh
  6. . /lib/nft-qos/core.sh
  7. . /lib/nft-qos/dynamic.sh
  8. NFT_QOS_DYNAMIC_ON=
  9. qosdef_validate_section_dynamic() {
  10. local limit_enable limit_type
  11. uci_validate_section nft-qos default default \
  12. 'limit_enable:bool:0' \
  13. 'limit_type:maxlength(8)'
  14. [ $limit_enable -eq 1 -a \
  15. "$limit_type" = "dynamic" ] && \
  16. NFT_QOS_DYNAMIC_ON="y"
  17. }
  18. logger -t nft-qos-dynamic "ACTION=$ACTION, MACADDR=$MACADDR, IPADDR=$IPADDR, HOSTNAME=$HOSTNAME"
  19. case "$ACTION" in
  20. add | update | remove)
  21. qosdef_validate_section_dynamic
  22. [ -z "$NFT_QOS_DYNAMIC_ON" ] && return
  23. qosdef_init_env
  24. qosdef_flush_dynamic
  25. qosdef_init_header
  26. qosdef_init_dynamic
  27. qosdef_init_done
  28. qosdef_start
  29. ;;
  30. esac