Skip to content
Snippets Groups Projects
Select Git revision
  • 68ff34a125f30cc542ca75e238b941cec1fdbef4
  • master default protected
2 results

linux-5.10.143.tar.xz

Blame
  • 50-gluon-simple-tc 737 B
    [ "$ACTION" = 'add' ] || exit 0
    
    config_load gluon-simple-tc
    
    
    tc_interface() {
    	local iface="$1"
    
    	config_get ifname "$iface" ifname
    
    	[ "$INTERFACE" = "$ifname" ] || return
    
    	config_get_bool enabled "$iface" enabled 0
    
    	[ "$enabled" -eq 1 ] || return
    
    	config_get limit_egress "$iface" limit_egress
    	config_get limit_ingress "$iface" limit_ingress
    
    	if [ "$limit_egress" ]; then
    		tc qdisc add dev "$INTERFACE" root tbf rate "${limit_egress}kbit" latency 50ms burst 2k
    	fi
    
    	if [ "$limit_ingress" ]; then
    		tc qdisc add dev "$INTERFACE" handle ffff: ingress
    		tc filter add dev "$INTERFACE" parent ffff: u32 match u8 00 00 at 0 police rate "${limit_ingress}kbit" burst 10k drop flowid :1
    	fi
    }
    
    config_foreach tc_interface 'interface'