-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsc
More file actions
35 lines (23 loc) · 583 Bytes
/
Copy pathsc
File metadata and controls
35 lines (23 loc) · 583 Bytes
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
#!/bin/bash
TC="sudo /sbin/tc"
# interface traffic will leave on
IF=lo
DST_PORT="4040 0xffff"
U32="$TC filter add dev $IF protocol ip parent 1: prio 1 u32"
create () {
echo "== SHAPING INIT =="
# create the root qdisc
$TC qdisc add dev $IF root handle 1: prio
echo "$@"
$TC qdisc add dev $IF parent 1:3 handle 30: netem $@
$U32 match ip dport $DST_PORT flowid 1:3
echo "== SHAPING DONE =="
}
# run clean to ensure existing tc is not configured
clean () {
echo "== CLEAN INIT =="
$TC qdisc del dev $IF root
echo "== CLEAN DONE =="
}
clean
create "$@"