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.

41 lines
1.5 KiB

  1. #!/bin/sh
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License version 2 as
  4. # published by the Free Software Foundation.
  5. #
  6. # Copyright (C) 2012-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
  7. # allow passing in the IFACE as first command line argument
  8. [ ! -z ${1} ] && IFACE=${1}
  9. # now IFACE is defined so we can source functions.sh without creating a spurious ifb4ge00
  10. . /usr/lib/sqm/functions.sh
  11. # sqm_logger is defined in functions.sh...
  12. sqm_logger "${0}: Stopping ${IFACE}"
  13. # make sure to only delete the ifb associated with the current interface
  14. CUR_IFB=$( get_ifb_associated_with_if ${IFACE} )
  15. sqm_stop() {
  16. tc qdisc del dev $IFACE ingress 2> /dev/null
  17. tc qdisc del dev $IFACE root 2> /dev/null
  18. [ ! -z "$CUR_IFB" ] && tc qdisc del dev $CUR_IFB root 2> /dev/null
  19. [ ! -z "$CUR_IFB" ] && sqm_logger "${0}: ${CUR_IFB} shaper deleted"
  20. }
  21. ipt_stop() {
  22. [ ! -z "$CUR_IFB" ] && ipt -t mangle -D POSTROUTING -o $CUR_IFB -m mark --mark 0x00 -g QOS_MARK_${IFACE}
  23. ipt -t mangle -D POSTROUTING -o $IFACE -m mark --mark 0x00 -g QOS_MARK_${IFACE}
  24. ipt -t mangle -D PREROUTING -i vtun+ -p tcp -j MARK --set-mark 0x2
  25. ipt -t mangle -D OUTPUT -p udp -m multiport --ports 123,53 -j DSCP --set-dscp-class AF42
  26. ipt -t mangle -F QOS_MARK_${IFACE}
  27. ipt -t mangle -X QOS_MARK_${IFACE}
  28. }
  29. sqm_stop
  30. ipt_stop
  31. [ ! -z "$CUR_IFB" ] && ifconfig ${CUR_IFB} down
  32. [ ! -z "$CUR_IFB" ] && ip link delete ${CUR_IFB} type ifb
  33. [ ! -z "$CUR_IFB" ] && sqm_logger "${0}: ${CUR_IFB} interface deleted"
  34. exit 0