Apply netem packet rules to only UDP traffic (#6754)
This commit is contained in:
parent
1c5d2a85cf
commit
0c2bf022fa
|
@ -16,5 +16,14 @@ fi
|
|||
set -x
|
||||
|
||||
iface="$(ifconfig | grep mtu | grep -iv loopback | grep -i running | awk 'BEGIN { FS = ":" } ; {print $1}')"
|
||||
|
||||
if [[ "$1" = delete ]]; then
|
||||
$sudo iptables -F -t mangle
|
||||
else
|
||||
$sudo iptables -A POSTROUTING -t mangle -p udp -j MARK --set-mark 1
|
||||
fi
|
||||
|
||||
$sudo tc qdisc "$1" dev "$iface" root handle 1: prio
|
||||
# shellcheck disable=SC2086 # Do not want to quote $2. It has space separated arguments for netem
|
||||
$sudo tc qdisc "$1" dev "$iface" root netem $2
|
||||
$sudo tc qdisc "$1" dev "$iface" parent 1:3 handle 30: netem $2
|
||||
$sudo tc filter "$1" dev "$iface" parent 1:0 protocol ip prio 3 handle 1 fw flowid 1:3
|
||||
|
|
Loading…
Reference in New Issue