/etc/netscript/qos.conf is in netscript-2.4-upstart 5.2.9ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | ##############################################################################
# QoS/Fair queuing functions
###############################################################################
QOS_MODULES="sch_sfq sch_red sch_gred sch_cbq cls_fw"
echoMark () {
local IFS='_'
set -- $1
echo $1
}
echoRate () {
local IFS='_'
set -- $1
echo $2
}
echoAddParm () {
local IFS='_'
set -- $1
shift 2
echo "$@"
}
ip_QoSppp () {
# establish esistence of ppp Iface
if ! echo $1 | grep '^ppp' > /dev/null 2>&1 ; then
return 0
fi
! [ -f /var/run/${1}.pid ] && return 0
if ! kill -0 `cat /var/run/${1}.pid` > /dev/null 2>&1 ; then
return 0
fi
# Get Unit number
PPP_UNIT=`echo $1 | sed 's/^ppp\(.*\)$/\1/'`
# Transform variables
eval "$1"_HNDL1=$(( $PPP_UNIT + 8000 ))
eval "$1"_HNDL2=$(( $PPP_UNIT + 9000 ))
eval "$1"_FAIRQ=${ppp_FAIRQ:-}
eval "$1"_BNDWIDTH=${ppp_BNDWIDTH:-}
eval "$1"_PXMTU=${ppp_PXMTU:-}
eval "$1"_CARATE=${ppp_CARATE:-}
eval "$1"_IARATE=${ppp_IARATE:-}
eval "$1"_IABURST=${ppp_IABURST:-}
return 0
}
ip_QoSclear () {
[ -x /sbin/tc ] \
&& qt tc qdisc del dev $1 root
return 0
}
ip_QoS () {
# Set some vaiables
eval local HNDL1=\${"$1"_HNDL1:-""}
eval local HNDL2=\${"$1"_HNDL2:-""}
eval local FAIRQ=\${"$1"_FAIRQ:-""}
eval local BNDWIDTH=\${"$1"_BNDWIDTH:-""}
eval local PXMTU=\${"$1"_PXMTU:-""}
eval local CARATE=\${"$1"_CARATE:-""}
eval local IARATE=\${"$1"_IARATE:-""}
eval local IABURST=\${"$1"_IABURST:-""}
eval local SPQUEUE=\${"$1"_SPQUEUE:-""}
eval local PEAKRATE=\${"$1"_PEAKRATE:-"$BNDWIDTH"}
eval local BULKRATE=\${"$1"_BULKRATE:-"$CARATE"}
if [ ! -x /sbin/tc ]; then
return 1
fi
if [ "$FAIRQ" != "YES" -a "$FAIRQ" != "Yes" -a "$FAIRQ" != "yes" ]
then
return 1
fi
if [ -z "$BNDWIDTH" -o -z "$IABURST" -o -z "$IARATE" \
-o -z "$PXMTU" -o -z "$CARATE" ]; then
tc qdisc replace dev $1 root sfq
return 0
fi
local IF_INDEX=`ip link | grep $1 | sed -e "s/^\([0-9]\+\): $1.*$/\1/"`
if [ -z "$HNDL1" ]; then
HNDL1=$(( $IF_INDEX * 10 + 1001 ))
fi
if [ -z "$HNDL2" ]; then
HNDL2=$(( $IF_INDEX * 10 + 1002 ))
fi
# Attach CBQ to device
tc qdisc add dev $1 root handle $HNDL1: cbq \
bandwidth $BNDWIDTH allot 1514 \
avpkt 1000
# Set up classes
# Root class
tc class add dev $1 parent $HNDL1:0 classid :1 est 1sec 8sec \
cbq bandwidth $BNDWIDTH rate $PEAKRATE \
allot $PXMTU avpkt 1000 bounded
# Bulk class
tc class add dev $1 parent $HNDL1:1 classid :2 est 1sec 8sec \
cbq bandwidth $BNDWIDTH rate $CARATE \
allot $PXMTU avpkt 1000 bounded prio 6 \
split $HNDL1:0 defmap ff7f
# Interactive class
tc class add dev $1 parent $HNDL1:1 classid :3 est 2sec 16sec \
cbq bandwidth $BNDWIDTH rate $IARATE maxburst $IABURST \
allot $PXMTU avpkt 1000 bounded isolated \
prio 2 split $HNDL1:0 defmap 80
# Priority class
tc class add dev $1 parent $HNDL1:1 classid :4 est 1sec 8sec \
cbq bandwidth $BNDWIDTH rate $PEAKRATE \
allot $PXMTU avpkt 1000 bounded prio 1
# Attach queue disciplines
tc qdisc add dev $1 parent $HNDL1:3 sfq perturb 15
tc qdisc add dev $1 parent $HNDL1:4 pfifo
# Add filters
tc filter add dev $1 parent $HNDL1:0 protocol ip \
priority 50 handle $MRK_CRIT fw classid $HNDL1:4
tc filter add dev $1 parent $HNDL1:0 protocol ip \
priority 60 handle $MRK_IA fw classid $HNDL1:3
# Set up bulk queue
tc qdisc add dev $1 parent $HNDL1:2 handle $HNDL2: cbq \
bandwidth $CARATE allot 1514 avpkt 1000
tc class add dev $1 parent $HNDL2:0 classid :1 est 1sec 8sec \
cbq bandwidth $CARATE rate $BULKRATE \
allot $PXMTU avpkt 1000 prio 6 \
split $HNDL2:0 defmap ffff
tc qdisc add dev $1 parent $HNDL2:1 sfq perturb 15
# tc qdisc add dev $1 parent $HNDL2:1 red min 10000 max 30000 limit 75000 avpkt 1000 burst 16 ecn probability 0.02 bandwidth $CARATE
# Build special queueing
local ID=2
for QUEUE in $SPQUEUE; do
local BOUNDED=`echoAddParm $QUEUE`
# Add class and queue
tc class add dev $1 parent $HNDL2:0 classid :$ID \
est 1sec 8sec cbq bandwidth $BNDWIDTH \
rate `echoRate $QUEUE` allot $PXMTU \
$BOUNDED prio 6 \
avpkt 1000
tc qdisc add dev $1 parent $HNDL2:$ID sfq perturb 15
#tc qdisc add dev $1 parent $HNDL2:$ID red ecn min 10000 max 30000 limit 75000 avpkt 1000 burst 16 ecn probability 0.02 bandwidth $BNDWIDTH
# Add the filter
tc filter add dev $1 parent $HNDL2:0 protocol ip \
priority 70 handle `echoMark $QUEUE` fw \
classid $HNDL2:$ID
ID=$(($ID+1))
done
return 0
}
###############################################################################
# End
###############################################################################
|