small-packages/open-app-filter/files/hnat.sh
2026-05-10 09:48:30 +08:00

44 lines
1.3 KiB
Bash
Executable File

. /usr/share/libubox/jshn.sh
. /lib/functions.sh
IS_BOOT=0
if [ "$1" = "1" ] ; then
IS_BOOT=1
fi
DISABLE_HNAT=$(uci -q get appfilter.global.disable_hnat)
if [ "$DISABLE_HNAT" != "1" ]; then
exit 0
fi
echo "DISABLE_HNAT: $DISABLE_HNAT"
# mt798x
test -d /sys/kernel/debug/hnat && {
echo 0 >/sys/kernel/debug/hnat/hook_toggle
}
# qca ecm
test -d /sys/kernel/debug/ecm/ && {
echo "1000000" > /sys/kernel/debug/ecm/ecm_classifier_default/accel_delay_pkts
}
if [ $IS_BOOT -ne 1 ] ; then
# turbo acc
test -f /etc/config/turboacc && {
uci -q set "turboacc.config.fastpath_fo_hw"="0"
uci -q set "turboacc.config.fastpath_fc_ipv6"="0"
uci -q set "turboacc.config.fastpath"="none"
uci -q set "turboacc.config.fullcone"="0"
uci commit turboacc
/etc/init.d/turboacc restart
}
uci -q set "firewall.@defaults[0].flow_offloading_hw"='0'
uci -q set "firewall.@defaults[0].flow_offloading"='0'
uci -q set "firewall.@defaults[0].fullcone"='0'
uci commit firewall
/etc/init.d/firewall reload
fi