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.

42 lines
794 B

nft-qos: fix useless log in syslog Since the functions in procd.sh invoke "initscript" variable which is not defined when imported procd.sh from hotplug scripts. And this results in error when calling basename utility. Sun Jan 20 12:34:50 2019 daemon.debug dnsmasq-script[15340]: BusyBox v1.28.4 () multi-call binary. Sun Jan 20 12:34:50 2019 daemon.debug dnsmasq-script[15340]: Sun Jan 20 12:34:50 2019 daemon.debug dnsmasq-script[15340]: Usage: basename FILE [SUFFIX] Sun Jan 20 12:34:50 2019 daemon.debug dnsmasq-script[15340]: Sun Jan 20 12:34:50 2019 daemon.debug dnsmasq-script[15340]: Strip directory path and .SUFFIX from FILE Sun Jan 20 12:34:50 2019 user.notice nft-qos-monitor: ACTION=update, MACADDR=xxxxxx, IPADDR=192.168.11.109, HOSTNAME=Honor_Play Sun Jan 20 12:34:50 2019 daemon.info dnsmasq[15340]: 250 192.168.11.109/60566 reply www.google.com is 216.58.215.68 Sun Jan 20 12:34:50 2019 daemon.info dnsmasq[15340]: 251 192.168.11.109/43456 reply mtalk.google.com is <CNAME> Sun Jan 20 12:34:50 2019 daemon.info dnsmasq[15340]: 251 192.168.11.109/43456 reply mobile-gtalk.l.google.com is 173.194.222.188 Sun Jan 20 12:34:50 2019 daemon.debug dnsmasq-script[15340]: BusyBox v1.28.4 () multi-call binary. Sun Jan 20 12:34:50 2019 daemon.debug dnsmasq-script[15340]: Sun Jan 20 12:34:50 2019 daemon.debug dnsmasq-script[15340]: Usage: basename FILE [SUFFIX] Sun Jan 20 12:34:50 2019 daemon.debug dnsmasq-script[15340]: Sun Jan 20 12:34:50 2019 daemon.debug dnsmasq-script[15340]: Strip directory path and .SUFFIX from FILE Sun Jan 20 12:34:51 2019 daemon.debug dnsmasq-script[15340]: BusyBox v1.28.4 () multi-call binary. Sun Jan 20 12:34:51 2019 daemon.debug dnsmasq-script[15340]: Sun Jan 20 12:34:51 2019 daemon.debug dnsmasq-script[15340]: Usage: basename FILE [SUFFIX] Sun Jan 20 12:34:51 2019 daemon.debug dnsmasq-script[15340]: Sun Jan 20 12:34:51 2019 daemon.debug dnsmasq-script[15340]: Strip directory path and .SUFFIX from FILE Sun Jan 20 12:34:51 2019 user.notice nft-qos-dynamic: ACTION=update, MACADDR=xxxxxx, IPADDR=192.168.11.109, HOSTNAME=Honor_Play Signed-off-by: Rosy Song <rosysong@rosinson.com>
6 years ago
  1. #!/bin/sh
  2. #
  3. # Copyright 2018 rosysong@rosinson.com
  4. #
  5. export initscript="nft-qos-dynamic"
  6. . /lib/functions.sh
  7. . /lib/nft-qos/core.sh
  8. . /lib/nft-qos/dynamic.sh
  9. NFT_QOS_DYNAMIC_ON=
  10. qosdef_validate_section_dynamic() {
  11. local limit_enable limit_type
  12. uci_validate_section nft-qos default default \
  13. 'limit_enable:bool:0' \
  14. 'limit_type:maxlength(8)'
  15. [ $limit_enable -eq 1 -a \
  16. "$limit_type" = "dynamic" ] && \
  17. NFT_QOS_DYNAMIC_ON="y"
  18. }
  19. logger -t nft-qos-dynamic "ACTION=$ACTION, MACADDR=$MACADDR, IPADDR=$IPADDR, HOSTNAME=$HOSTNAME"
  20. case "$ACTION" in
  21. add | update | remove)
  22. qosdef_validate_section_dynamic
  23. [ -z "$NFT_QOS_DYNAMIC_ON" ] && return
  24. qosdef_init_env
  25. qosdef_flush_dynamic
  26. qosdef_init_header
  27. qosdef_init_dynamic
  28. qosdef_init_done
  29. qosdef_start
  30. ;;
  31. esac