Search K
Appearance
Appearance
tc 的组件名称为 tc, 相关内核选项为
# Networking support
# -> Networking options
# -> QoS and/or fair queueing
# -> Token Bucket Filter (TBF)
CONFIG_NET_SCH_TBF=y
# Networking support
# -> Networking options
# -> QoS and/or fair queueing
# -> Network emulator (NETEM)
CONFIG_NET_SCH_NETEM=y检查工具为
#!/bin/bash
source ./cmd_utils.sh
source ./kernel_config_utils.sh
source ./net_utils.sh
tc_check() {
is_error=false
if ! kernel_config_check CONFIG_NET_SCH_TBF sch_tbf; then
is_error=true
fi
if ! kernel_config_check CONFIG_NET_SCH_NETEM sch_netem; then
is_error=true
fi
if [ "$is_error" == "true" ]; then
return 1
fi
local ifname="dodo"
if ! netif_new $ifname; then
return 1
fi
is_error=false
if ! tc_rule_check $ifname tbf rate 10Mbit latency 1000ms burst 100kb; then
is_error=true
fi
if ! tc_rule_check $ifname netem loss 10%; then
is_error=true
fi
if ! tc_rule_check $ifname netem delay 10ms; then
is_error=true
fi
netif_delete $ifname
if [ "$is_error" == "true" ]; then
return 1
fi
return 0
}