51 lines
1.3 KiB
Bash
51 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
|
|
logger -t natflow "disable gro for <$eth>"
|
|
}
|
|
ethtool -k "$eth" | grep -q "generic-segmentation-offload: off" || {
|
|
ethtool -K "$eth" gso off
|
|
logger -t natflow "disable gso for <$eth>"
|
|
}
|
|
done
|
|
}
|
|
|
|
enable_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: on" || {
|
|
ethtool -K "$eth" gro on
|
|
logger -t natflow "enable gro for <$eth>"
|
|
}
|
|
ethtool -k "$eth" | grep -q "generic-segmentation-offload: on" || {
|
|
ethtool -K "$eth" gso on
|
|
logger -t natflow "enable gro for <$eth>"
|
|
}
|
|
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 disabled=0 >/dev/natflow_ctl
|
|
echo "delay_pkts=$delay_pkts" >/dev/natflow_ctl
|
|
echo ifname_clear >/dev/natflow_ctl
|
|
}
|
|
|
|
stop() {
|
|
test -c /dev/natflow_ctl || return 0
|
|
enable_gro_gso
|
|
echo disabled=1 >/dev/natflow_ctl
|
|
}
|
|
|
|
restart() {
|
|
start
|
|
}
|