Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
mxtools/net_qdisc_nfs_low/net_qdisc_nfs_low
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
46 lines (40 sloc)
1.51 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -e | |
. /etc/local/mxhost.conf | |
case "$1" in | |
start) | |
tc qdisc add dev $MX_NETDEV root handle 10: prio | |
tc qdisc add dev $MX_NETDEV parent 10:1 handle 20: sfq # band 0 highest priority | |
tc qdisc add dev $MX_NETDEV parent 10:2 handle 30: sfq # band 2 | |
tc qdisc add dev $MX_NETDEV parent 10:3 handle 40: sfq # band 3 | |
tc filter add dev $MX_NETDEV parent 10: handle 100: protocol ip prio 4 u32 divisor 1 | |
tc filter add dev $MX_NETDEV parent 10: handle 100:0:1 protocol ip prio 4 u32 ht 100: match tcp dst 2049 FFFF flowid 10:2 | |
# The "root filter list is always 800:0. | |
# "match ip firstfrag" compiles to "match 00002000/00003fff at 4" which | |
# includes the "more fragments" flag, so only initial fragments of a | |
# fragmented packet would be selected, not single fragments of an | |
# unfragmented packet. So use "match u32 00000000 00001fff at 4" to | |
# make sure, this is a initial segment and has a tcp header. | |
tc filter add dev $MX_NETDEV parent 10: handle 800:0:1 protocol ip prio 4 u32 ht 800: \ | |
match ip protocol 06 ff \ | |
match u32 00000000 00001fff at 4 \ | |
offset at 0 mask 0f00 shift 6 \ | |
link 100: | |
tc filter add dev $MX_NETDEV parent 10: handle 800:0:2 protocol ip prio 4 u32 ht 800: match u32 0 0 flowid 10:1 | |
;; | |
stop) | |
tc filter delete dev $MX_NETDEV | |
tc qdisc delete dev $MX_NETDEV root | |
;; | |
restart) | |
$0 stop | |
$0 start | |
;; | |
status) | |
tc -s qdisc show dev $MX_NETDEV | |
tc -s filter show dev $MX_NETDEV | |
;; | |
*) | |
echo "usage: $0 { start | stop | restart | status }" >&2 | |
exit 1 | |
esac |