sbwml 355bbd7ccf natflow: fix typo
Signed-off-by: sbwml <admin@cooluc.com>
2024-09-04 11:04:41 +08:00

45 lines
1.3 KiB
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=95
disable_gro_gso() {
for eth in $(ifconfig | grep "^eth\|^dsa\|^lan\|^wan" | awk '{print $1}' | sort | uniq); do
ethtool -k "$eth" | grep -q "generic-receive-offload: off" || ethtool -K "$eth" gro off
ethtool -k "$eth" | grep -q "generic-segmentation-offload: off" || ethtool -K "$eth" gso off
done
}
enable_gro_gso() {
for eth in $(ifconfig | grep "^eth\|^dsa\|^lan\|^wan" | awk '{print $1}' | sort | uniq); do
[[ "$(uname -m)" != arm* ]] && ethtool -k "$eth" | grep -q "generic-receive-offload: on" || ethtool -K "$eth" gro on
ethtool -k "$eth" | grep -q "generic-segmentation-offload: on" || ethtool -K "$eth" gso on
done
}
start() {
test -c /dev/natflow_ctl || return 0
[ "$(uci -q get firewall.@defaults[0].natflow)" != 1 ] && return 0
disable_gro_gso
delay_pkts=$(uci -q get firewall.@defaults[0].natflow_delay_pkts || echo 0)
echo "debug=0" >/dev/natflow_ctl
echo "disabled=0" >/dev/natflow_ctl
echo "delay_pkts=$delay_pkts" >/dev/natflow_ctl
echo "skip_qos_to_slow_path=0" >/dev/natflow_ctl
echo ifname_clear >/dev/natflow_ctl
logger -t natflow "natflow has been enabled"
}
stop() {
test -c /dev/natflow_ctl || return 0
enable_gro_gso
echo disabled=1 >/dev/natflow_ctl
logger -t natflow "natflow has been disabled"
}
restart() {
stop
start
}