diff options
author | James <> | 2013-03-17 12:16:37 +0000 |
---|---|---|
committer | James <> | 2013-03-17 12:16:37 +0000 |
commit | 27b76ab0671089c47506615a796a261e993896a7 (patch) | |
tree | 61213d67e7fa87b20356b23798558e2c4212c42f /package/network/config/qos-scripts/files/usr/bin | |
download | trunk-36060-master.tar.gz trunk-36060-master.tar.bz2 trunk-36060-master.zip |
Diffstat (limited to 'package/network/config/qos-scripts/files/usr/bin')
10 files changed, 311 insertions, 0 deletions
diff --git a/package/network/config/qos-scripts/files/usr/bin/.svn/entries b/package/network/config/qos-scripts/files/usr/bin/.svn/entries new file mode 100644 index 0000000..fa60ae7 --- /dev/null +++ b/package/network/config/qos-scripts/files/usr/bin/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/package/network/config/qos-scripts/files/usr/bin +svn://svn.openwrt.org/openwrt + + + +2012-06-05T16:04:23.055438Z +32062 +jow + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +qos-stop +file + + + + +2013-03-17T12:13:19.000000Z +d0c4c982503c87ad4984bccf1f8396ec +2011-10-27T12:39:19.714355Z +28623 +jow +has-props + + + + + + + + + + + + + + + + + + + + +224 + +qos-stat +file + + + + +2013-03-17T12:13:19.000000Z +8698b43c858ec4bc03de0270308c4c79 +2012-06-05T16:04:23.055438Z +32062 +jow +has-props + + + + + + + + + + + + + + + + + + + + +1568 + +qos-start +file + + + + +2013-03-17T12:13:19.000000Z +9418edd146e30aead985459b915b568e +2007-04-06T16:59:56.568018Z +6875 +nbd +has-props + + + + + + + + + + + + + + + + + + + + +55 + diff --git a/package/network/config/qos-scripts/files/usr/bin/.svn/prop-base/qos-start.svn-base b/package/network/config/qos-scripts/files/usr/bin/.svn/prop-base/qos-start.svn-base new file mode 100644 index 0000000..03b5bfa --- /dev/null +++ b/package/network/config/qos-scripts/files/usr/bin/.svn/prop-base/qos-start.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 14 +svn:executable +V 1 +* +END diff --git a/package/network/config/qos-scripts/files/usr/bin/.svn/prop-base/qos-stat.svn-base b/package/network/config/qos-scripts/files/usr/bin/.svn/prop-base/qos-stat.svn-base new file mode 100644 index 0000000..03b5bfa --- /dev/null +++ b/package/network/config/qos-scripts/files/usr/bin/.svn/prop-base/qos-stat.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 14 +svn:executable +V 1 +* +END diff --git a/package/network/config/qos-scripts/files/usr/bin/.svn/prop-base/qos-stop.svn-base b/package/network/config/qos-scripts/files/usr/bin/.svn/prop-base/qos-stop.svn-base new file mode 100644 index 0000000..03b5bfa --- /dev/null +++ b/package/network/config/qos-scripts/files/usr/bin/.svn/prop-base/qos-stop.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 14 +svn:executable +V 1 +* +END diff --git a/package/network/config/qos-scripts/files/usr/bin/.svn/text-base/qos-start.svn-base b/package/network/config/qos-scripts/files/usr/bin/.svn/text-base/qos-start.svn-base new file mode 100644 index 0000000..261ffb4 --- /dev/null +++ b/package/network/config/qos-scripts/files/usr/bin/.svn/text-base/qos-start.svn-base @@ -0,0 +1,4 @@ +#!/bin/sh +qos-stop +/usr/lib/qos/generate.sh all | sh + diff --git a/package/network/config/qos-scripts/files/usr/bin/.svn/text-base/qos-stat.svn-base b/package/network/config/qos-scripts/files/usr/bin/.svn/text-base/qos-stat.svn-base new file mode 100644 index 0000000..78d1638 --- /dev/null +++ b/package/network/config/qos-scripts/files/usr/bin/.svn/text-base/qos-stat.svn-base @@ -0,0 +1,67 @@ +#!/bin/sh +# Copyright (C) 2011 OpenWrt.org + +. /lib/functions.sh + +include /lib/network + +get_ifname() { + local interface="$1" + local cfgt + + scan_interfaces + config_get cfgt "$interface" TYPE + [ "$cfgt" == "interface" ] && config_get "$interface" ifname +} + +config_cb() { + config_get TYPE "$CONFIG_SECTION" TYPE + [ "interface" == "$TYPE" ] && { + config_get device "$CONFIG_SECTION" ifname + [ -z "$device" ] && device="$(get_ifname ${CONFIG_SECTION})" + config_set "$CONFIG_SECTION" device "$device" + } +} + +config_load qos + +print_comments() { + echo '' + echo '# Interface: '"$1" + echo '# Direction: '"$2" + echo '# Stats: '"$3" + echo '' +} + +get_device() { + ( config_load network; scan_interfaces; config_get "$1" ifname ) +} + +interface_stats() { + local interface="$1" + local device + + device="$(get_device "$interface")" + [ -z "$device" ] && config_get device "$interface" device + config_get_bool enabled "$interface" enabled 1 + [ -z "$device" -o 1 -ne "$enabled" ] && { + return 1 + } + config_get_bool halfduplex "$interface" halfduplex 0 + + if [ 1 -ne "$halfduplex" ]; then + unset halfduplex + print_comments "$interface" "Egress" "Start" + tc -s class show dev "$device" + print_comments "$interface" "Egress" "End" + id="root" + else + id="" + fi + + print_comments "$interface" "Ingress${halfduplex:+/Egress}" "Start" + tc -s class show dev "$(tc filter show dev $device $id | grep mirred | sed -e 's,.*\(ifb.*\)).*,\1,')" + print_comments "$interface" "Ingress${halfduplex:+/Egress}" "End" +} + +[ -z "$1" ] && config_foreach interface_stats interface || interface_stats "$1" diff --git a/package/network/config/qos-scripts/files/usr/bin/.svn/text-base/qos-stop.svn-base b/package/network/config/qos-scripts/files/usr/bin/.svn/text-base/qos-stop.svn-base new file mode 100644 index 0000000..7f654d8 --- /dev/null +++ b/package/network/config/qos-scripts/files/usr/bin/.svn/text-base/qos-stop.svn-base @@ -0,0 +1,6 @@ +#!/bin/sh +for iface in $(tc qdisc show | grep -E '(hfsc|ingress)' | awk '{print $5}'); do + tc qdisc del dev "$iface" ingress 2>&- >&- + tc qdisc del dev "$iface" root 2>&- >&- +done +/usr/lib/qos/generate.sh firewall stop | sh diff --git a/package/network/config/qos-scripts/files/usr/bin/qos-start b/package/network/config/qos-scripts/files/usr/bin/qos-start new file mode 100755 index 0000000..261ffb4 --- /dev/null +++ b/package/network/config/qos-scripts/files/usr/bin/qos-start @@ -0,0 +1,4 @@ +#!/bin/sh +qos-stop +/usr/lib/qos/generate.sh all | sh + diff --git a/package/network/config/qos-scripts/files/usr/bin/qos-stat b/package/network/config/qos-scripts/files/usr/bin/qos-stat new file mode 100755 index 0000000..78d1638 --- /dev/null +++ b/package/network/config/qos-scripts/files/usr/bin/qos-stat @@ -0,0 +1,67 @@ +#!/bin/sh +# Copyright (C) 2011 OpenWrt.org + +. /lib/functions.sh + +include /lib/network + +get_ifname() { + local interface="$1" + local cfgt + + scan_interfaces + config_get cfgt "$interface" TYPE + [ "$cfgt" == "interface" ] && config_get "$interface" ifname +} + +config_cb() { + config_get TYPE "$CONFIG_SECTION" TYPE + [ "interface" == "$TYPE" ] && { + config_get device "$CONFIG_SECTION" ifname + [ -z "$device" ] && device="$(get_ifname ${CONFIG_SECTION})" + config_set "$CONFIG_SECTION" device "$device" + } +} + +config_load qos + +print_comments() { + echo '' + echo '# Interface: '"$1" + echo '# Direction: '"$2" + echo '# Stats: '"$3" + echo '' +} + +get_device() { + ( config_load network; scan_interfaces; config_get "$1" ifname ) +} + +interface_stats() { + local interface="$1" + local device + + device="$(get_device "$interface")" + [ -z "$device" ] && config_get device "$interface" device + config_get_bool enabled "$interface" enabled 1 + [ -z "$device" -o 1 -ne "$enabled" ] && { + return 1 + } + config_get_bool halfduplex "$interface" halfduplex 0 + + if [ 1 -ne "$halfduplex" ]; then + unset halfduplex + print_comments "$interface" "Egress" "Start" + tc -s class show dev "$device" + print_comments "$interface" "Egress" "End" + id="root" + else + id="" + fi + + print_comments "$interface" "Ingress${halfduplex:+/Egress}" "Start" + tc -s class show dev "$(tc filter show dev $device $id | grep mirred | sed -e 's,.*\(ifb.*\)).*,\1,')" + print_comments "$interface" "Ingress${halfduplex:+/Egress}" "End" +} + +[ -z "$1" ] && config_foreach interface_stats interface || interface_stats "$1" diff --git a/package/network/config/qos-scripts/files/usr/bin/qos-stop b/package/network/config/qos-scripts/files/usr/bin/qos-stop new file mode 100755 index 0000000..7f654d8 --- /dev/null +++ b/package/network/config/qos-scripts/files/usr/bin/qos-stop @@ -0,0 +1,6 @@ +#!/bin/sh +for iface in $(tc qdisc show | grep -E '(hfsc|ingress)' | awk '{print $5}'); do + tc qdisc del dev "$iface" ingress 2>&- >&- + tc qdisc del dev "$iface" root 2>&- >&- +done +/usr/lib/qos/generate.sh firewall stop | sh |